@@ -26,11 +26,12 @@ def __init__(self, page: Page):
2626 )
2727 # Create A Plan Table Locators
2828 self .weekly_invitation_rate_field_on_table = self .page .locator (
29- "#invitationRateField "
29+ "#invitationPlan > tbody > tr:nth-child(1) > td.input.border-right.dt-type-numeric > input "
3030 )
3131 self .invitations_sent_value = self .page .locator (
32- "#invitationPlan > tbody > tr:nth-child(1) > td:nth-child(8)"
32+ "tbody tr:nth-child(1) td:nth-child(8)"
3333 )
34+
3435 self .resulting_position_value = self .page .locator (
3536 "#invitationPlan > tbody > tr:nth-child(1) > td:nth-child(9)"
3637 )
@@ -137,28 +138,42 @@ def verify_weekly_invitation_rate_for_weeks(
137138
138139 def increment_invitation_rate_and_verify_changes (self ) -> None :
139140 """
140- Increments the invitation rate by 1, then verifies that both the 'Invitations Sent' and 'Resulting Position' have increased by 1.
141+ Increments the invitation rate by 1, then verifies that both the
142+ 'Invitations Sent' has increased by 1 and 'Resulting Position' has decreased by 1.
141143 """
142- # Get the current value of the Weekly Invitation Rate field
143- current_value = int (
144- self .create_a_plan_table .get_cell_value ("Invitation Rate" , 0 )
144+ # Capture initial values before any changes
145+ initial_invitations_sent = int (self .invitations_sent_value .inner_text ().strip ())
146+ initial_resulting_position = int (
147+ self .resulting_position_value .inner_text ().strip ()
148+ )
149+
150+ # Increment the invitation rate
151+ current_rate = int (
152+ self .create_a_plan_table .get_cell_value ("Invitation Rate" , 1 )
153+ )
154+ new_rate = str (current_rate + 1 )
155+ self .weekly_invitation_rate_field_on_table .fill (new_rate )
156+ self .page .keyboard .press ("Tab" )
157+
158+ # Wait dynamically for updates
159+ expect (self .invitations_sent_value ).to_have_text (
160+ str (initial_invitations_sent + 1 )
145161 )
146- # Increments by 1, fills the field with the new value, and Tabs out of the field
147- new_value = str (current_value + 1 )
148- locator = self .weekly_invitation_rate_field_on_table
149- locator .fill (new_value )
150- locator .press ("Tab" )
151-
152- # Verifies 'Invitations Sent' has increased by 1
153- initial_invitations_sent = int (self .invitations_sent_value .inner_text ())
162+ expect (self .resulting_position_value ).to_have_text (
163+ str (initial_resulting_position + 1 )
164+ )
165+
166+ # Capture updated values
167+ updated_invitations_sent = int (self .invitations_sent_value .inner_text ().strip ())
168+ updated_resulting_position = int (
169+ self .resulting_position_value .inner_text ().strip ()
170+ )
171+
172+ # Assert changes
154173 assert (
155- int (self .invitations_sent_value .inner_text ())
156- == initial_invitations_sent + 1
157- ), "Invitations Sent did not increase by 1."
174+ updated_invitations_sent == initial_invitations_sent + 1
175+ ), f"Expected Invitations Sent to increase by 1. Was { initial_invitations_sent } , now { updated_invitations_sent } ."
158176
159- # Verifies 'Resulting Position' has increased by 1
160- initial_resulting_position = int (self .resulting_position_value .inner_text ())
161177 assert (
162- int (self .resulting_position_value .inner_text ())
163- == initial_resulting_position - 1
164- ), "Resulting Position did not decrease by 1."
178+ updated_resulting_position == initial_resulting_position + 1
179+ ), f"Expected Resulting Position to increase by 1. Was { initial_resulting_position } , now { updated_resulting_position } ."
0 commit comments