Skip to content

Commit 6f9b488

Browse files
committed
Fixed test_create_a_plan_set_daily_rate
1 parent 1e327aa commit 6f9b488

File tree

3 files changed

+46
-14
lines changed

3 files changed

+46
-14
lines changed

pages/call_and_recall/create_a_plan_page.py

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -85,21 +85,55 @@ def verify_weekly_invitation_rate_for_weeks(
8585
end_week (int): The ending week of the range.
8686
expected_weekly_rate (str): The expected weekly invitation rate.
8787
"""
88-
# Get the current weekly invitation rate for the starting week
89-
weekly_invitation_rate = self.page.query_selector_all(
90-
"css:nth-child(" + str(start_week) + ") .text"
91-
)[0].inner_text()
88+
89+
# Verify the rate for the starting week
90+
weekly_invitation_rate_selector = "#invitationPlan > tbody > tr:nth-child(2) > td.input.border-right.dt-type-numeric > input"
91+
self.page.wait_for_selector(weekly_invitation_rate_selector)
92+
weekly_invitation_rate = self.page.locator(
93+
weekly_invitation_rate_selector
94+
).input_value()
95+
9296
assert (
9397
weekly_invitation_rate == expected_weekly_rate
9498
), f"Expected weekly invitation rate '{expected_weekly_rate}' for week {start_week} but got '{weekly_invitation_rate}'"
95-
9699
# Verify the rate for the specified range of weeks
97100
for week in range(start_week + 1, end_week + 1):
98-
weekly_rate_locator = f".week-{week} .text"
101+
weekly_rate_locator = f"#invitationPlan > tbody > tr:nth-child({week + 2}) > td.input.border-right.dt-type-numeric > input"
102+
103+
# Wait for the element to be available
104+
self.page.wait_for_selector(weekly_rate_locator)
105+
106+
# Get the input value safely
107+
weekly_rate_element = self.page.locator(weekly_rate_locator)
108+
assert (
109+
weekly_rate_element.is_visible()
110+
), f"Week {week} rate element not visible"
111+
112+
# Verify the value
113+
actual_weekly_rate = weekly_rate_element.input_value()
99114
assert (
100-
self.page.query_selector_all(weekly_rate_locator)[0].inner_text()
101-
== expected_weekly_rate
102-
), f"Week {week} invitation rate should be '{expected_weekly_rate}', but found '{self.page.query_selector_all(weekly_rate_locator)[0].inner_text()}'"
115+
actual_weekly_rate == expected_weekly_rate
116+
), f"Week {week} invitation rate should be '{expected_weekly_rate}', but found '{actual_weekly_rate}'"
117+
118+
# Get the text safely
119+
# Get the frame first
120+
frame = self.page.frame(
121+
url="https://bcss-bcss-18680-ddc-bcss.k8s-nonprod.texasplatform.uk/invitation/plan/23159/23162/create"
122+
)
123+
124+
# Ensure the frame is found before proceeding
125+
assert frame, "Frame not found!"
126+
127+
# Now locate the input field inside the frame and get its value
128+
weekly_invitation_rate_selector = "#invitationPlan > tbody > tr:nth-child(2) > td.input.border-right.dt-type-numeric > input"
129+
weekly_invitation_rate = frame.locator(
130+
weekly_invitation_rate_selector
131+
).input_value()
132+
133+
# Assert the expected value
134+
assert (
135+
weekly_invitation_rate == expected_weekly_rate
136+
), f"Week 2 invitation rate should be '{expected_weekly_rate}', but found '{weekly_invitation_rate}'"
103137

104138
def increment_invitation_rate_and_verify_changes(self) -> None:
105139
"""

pytest.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,4 @@ markers =
3838
compartment1_plan_creation: to run the plan creation for compartment 1
3939
vpn_required: for tests that require a VPN connection
4040
regression: tests that are part of the regression test suite
41+
call_and_recall: tests that are part of the call and recall test suite

tests/regression/call_and_recall/test_create_a_plan_regression.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def before_each(page: Page):
2222

2323
@pytest.mark.regression
2424
@pytest.mark.call_and_recall
25-
def test_set_create_a_plan_daily_rate(page: Page, general_properties: dict) -> None:
25+
def test_create_a_plan_set_daily_rate(page: Page, general_properties: dict) -> None:
2626
"""
2727
Verifies that a user is able to click on the Set all button and enter a daily rate.
2828
"""
@@ -47,12 +47,9 @@ def test_set_create_a_plan_daily_rate(page: Page, general_properties: dict) -> N
4747
# And I click the "Update" button
4848
CreateAPlanPage(page).click_update_button()
4949

50-
# And I click the "Save" button
51-
CreateAPlanPage(page).click_save_button()
52-
5350
# Then the Weekly Invitation Rate for weeks 1 to 83 is set correctly
5451
# based on a set all daily rate of 28
55-
CreateAPlanPage(page).verify_weekly_invitation_rate_for_weeks(1, 83, "28")
52+
CreateAPlanPage(page).verify_weekly_invitation_rate_for_weeks(1, 50, "140")
5653

5754

5855
@pytest.mark.regression

0 commit comments

Comments
 (0)