Skip to content

Commit be92907

Browse files
committed
wip
1 parent 5511f28 commit be92907

File tree

7 files changed

+103
-49
lines changed

7 files changed

+103
-49
lines changed

pages/call_and_recall/create_a_plan_page.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def verify_weekly_invitation_rate_for_weeks(
8888
# Get the current weekly invitation rate for the starting week
8989
weekly_invitation_rate = self.page.query_selector_all(
9090
"css:nth-child(" + str(start_week) + ") .text"
91-
)[0].text
91+
)[0].inner_text()
9292
assert (
9393
weekly_invitation_rate == expected_weekly_rate
9494
), f"Expected weekly invitation rate '{expected_weekly_rate}' for week {start_week} but got '{weekly_invitation_rate}'"
@@ -97,9 +97,9 @@ def verify_weekly_invitation_rate_for_weeks(
9797
for week in range(start_week + 1, end_week + 1):
9898
weekly_rate_locator = f".week-{week} .text"
9999
assert (
100-
self.page.query_selector_all(weekly_rate_locator)[0].text
100+
self.page.query_selector_all(weekly_rate_locator)[0].inner_text()
101101
== 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].text}'"
102+
), f"Week {week} invitation rate should be '{expected_weekly_rate}', but found '{self.page.query_selector_all(weekly_rate_locator)[0].inner_text()}'"
103103

104104
def increment_invitation_rate_and_verify_changes(self) -> None:
105105
"""

pages/call_and_recall/non_invitations_days_page.py

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from playwright.sync_api import Page, expect
22
from pages.base_page import BasePage
3+
from utils.date_time_utils import DateTimeUtils
34

45

56
class NonInvitationDaysPage(BasePage):
@@ -9,7 +10,54 @@ def __init__(self, page: Page):
910
super().__init__(page)
1011
self.page = page
1112
# Non Invitation Days - page locators, methods
13+
self.enter_note_field = self.page.get_by_role("textbox", name="note")
14+
self.enter_date_field = self.page.get_by_role("textbox", name="date")
15+
self.add_non_invitation_day_button = self.page.get_by_role(
16+
"button", name="Add Non-Invitation Day"
17+
)
18+
self.non_invitation_day_delete_button = self.page.get_by_role(
19+
"button", name="Delete"
20+
)
21+
self.created_on_date_locator = self.page.locator("#displayRS")
1222

1323
def verify_non_invitation_days_tile(self) -> None:
1424
"""Verifies the page title of the Non Invitation Days page"""
1525
self.bowel_cancer_screening_page_title_contains_text("Non-Invitation Days")
26+
27+
def enter_date(self, date: str) -> None:
28+
"""Enters a date in the date input field
29+
Args:
30+
date (str): The date to enter in the field, formatted as 'dd/mm/yyyy'.
31+
"""
32+
self.enter_date_field.fill(date)
33+
34+
def enter_note(self, note: str) -> None:
35+
"""Enters a note in the note input field
36+
Args:
37+
note (str): The note to enter in the field.
38+
"""
39+
self.enter_note_field.fill(note)
40+
41+
def click_add_non_invitation_day_button(self) -> None:
42+
"""Clicks the Add Non-Invitation Day button"""
43+
self.click(self.add_non_invitation_day_button)
44+
45+
def click_delete_button(self) -> None:
46+
"""Clicks the Delete button for a non-invitation day"""
47+
self.click(self.non_invitation_day_delete_button)
48+
49+
def verify_date_is_visible(self) -> None:
50+
"""Verifies that the specified date is visible on the page
51+
Args:
52+
date (str): The date to verify, formatted as 'dd/mm/yyyy'.
53+
"""
54+
date = DateTimeUtils.current_datetime("dd/mm/yyyy")
55+
expect(self.created_on_date_locator).to_have_text(date)
56+
57+
def verify_date_is_not_visible(self) -> None:
58+
"""Verifies that the specified date is not visible on the page
59+
Args:
60+
date (str): The date to verify, formatted as 'dd/mm/yyyy'.
61+
"""
62+
date = DateTimeUtils.current_datetime("dd/mm/yyyy")
63+
expect(self.created_on_date_locator).not_to_have_text(date)

pytest.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,4 @@ markers =
3737
compartment6: only for compartment 6
3838
compartment1_plan_creation: to run the plan creation for compartment 1
3939
vpn_required: for tests that require a VPN connection
40+
regression: tests that are part of the regression test suite

tests/regression/call_and_recall/test_create_a_plan_regression renamed to tests/regression/call_and_recall/test_create_a_plan_regression.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,16 @@ 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, tests_properties: dict) -> None:
25+
def test_set_create_a_plan_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
"""
29-
3029
# When I go to "Invitations Monitoring - Screening Centre"
3130
CallAndRecallPage(page).go_to_planning_and_monitoring_page()
3231

3332
# And I click the link text "BCS001"
3433
InvitationsMonitoringPage(page).go_to_invitation_plan_page(
35-
tests_properties["screening_centre_code"]
34+
general_properties["screening_centre_code"]
3635
)
3736
# And I click the "Create a Plan" button
3837
InvitationsPlansPage(page).go_to_create_a_plan_page()
@@ -42,7 +41,7 @@ def test_set_create_a_plan_daily_rate(page: Page, tests_properties: dict) -> Non
4241

4342
# And I enter "28" in the input box with id "dailyRate"
4443
CreateAPlanPage(page).fill_daily_invitation_rate_field(
45-
tests_properties["daily_invitation_rate"]
44+
general_properties["daily_invitation_rate"]
4645
)
4746

4847
# And I click the "Update" button
@@ -51,14 +50,16 @@ def test_set_create_a_plan_daily_rate(page: Page, tests_properties: dict) -> Non
5150
# And I click the "Save" button
5251
CreateAPlanPage(page).click_save_button()
5352

54-
# Then the Weekly Invitation Rate for weeks 0 to 83 is set correctly
53+
# Then the Weekly Invitation Rate for weeks 1 to 83 is set correctly
5554
# based on a set all daily rate of 28
5655
CreateAPlanPage(page).verify_weekly_invitation_rate_for_weeks(1, 83, "28")
5756

5857

5958
@pytest.mark.regression
6059
@pytest.mark.call_and_recall
61-
def test_create_invitation_plan_weekly_rate(page: Page, tests_properties: dict) -> None:
60+
def test_create_invitation_plan_weekly_rate(
61+
page: Page, general_properties: dict
62+
) -> None:
6263
"""
6364
Verifies that a user can set a weekly invitation rate in Create a Plan.
6465
"""
@@ -68,7 +69,7 @@ def test_create_invitation_plan_weekly_rate(page: Page, tests_properties: dict)
6869

6970
# And I click the link text "BCS001"
7071
InvitationsMonitoringPage(page).go_to_invitation_plan_page(
71-
tests_properties["screening_centre_code"]
72+
general_properties["screening_centre_code"]
7273
)
7374
# And I click the "Create a Plan" button
7475
InvitationsPlansPage(page).go_to_create_a_plan_page()
@@ -78,7 +79,7 @@ def test_create_invitation_plan_weekly_rate(page: Page, tests_properties: dict)
7879

7980
# And I enter "130" in the input box with id "weeklyRate"
8081
CreateAPlanPage(page).fill_weekly_invitation_rate_field(
81-
tests_properties["weekly_invitation_rate"]
82+
general_properties["weekly_invitation_rate"]
8283
)
8384

8485
# And I click the "Update" button
@@ -88,7 +89,7 @@ def test_create_invitation_plan_weekly_rate(page: Page, tests_properties: dict)
8889
CreateAPlanPage(page).click_save_button()
8990

9091
# And the Weekly Invitation Rate for weeks 1 to 83 is set to the set all weekly rate of 130
91-
CreateAPlanPage(page).verify_weekly_invitation_rate_for_weeks(1, 83, "28")
92+
CreateAPlanPage(page).verify_weekly_invitation_rate_for_weeks(1, 83, "130")
9293

9394

9495
@pytest.mark.regression
@@ -113,4 +114,4 @@ def test_update_invitation_rate_weekly(page: Page, tests_properties: dict) -> No
113114
# When I increase the Weekly Invitation Rate for week 1 by 1 and tab out of the cell
114115
# Then the Cumulative Invitations Sent is incremented by 1 for week 1
115116
# And the Cumulative Resulting Position is incremented by 1 for week 1
116-
CreateAPlanPage(page).increment_invitation_rate_and_verify_changes()
117+
CreateAPlanPage(page).increment_invitation_rate_and_verify_changes()

tests/regression/call_and_recall/test_generate_fobt_invitation_regression renamed to tests/regression/call_and_recall/test_generate_fobt_invitation_regression.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import pytest
2-
import logging
32
from playwright.sync_api import Page
43
from pages.base_page import BasePage
54
from pages.call_and_recall.call_and_recall_page import CallAndRecallPage
@@ -17,15 +16,14 @@ def before_each(page: Page):
1716
Before every test is executed, this fixture logs in to BCSS as a test user and navigates to the call and recall page
1817
"""
1918
# Log in to BCSS
20-
UserTools.user_login(page, "Hub Manager State Registered at BCS01")
19+
UserTools.user_login(page, "Hub Manager at BCS01")
2120

2221
# Go to call and recall page
2322
BasePage(page).go_to_call_and_recall_page()
2423

2524

2625
# Scenario: Run FOBT invitations and process the S1 letter batch
2726
# Many feature scenarios need a subject at S9.
28-
# Given I log in to BCSS "England" as user role "Hub Manager"
2927
# When I generate invitations
3028
# And I view the active batch list
3129
# And I view the "Original" type "Open" status active letter batch for "S1" "Pre-invitation (FIT)"

tests/regression/call_and_recall/test_non_invitation_days_regression renamed to tests/regression/call_and_recall/test_non_invitation_days_regression.py

Lines changed: 21 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import pytest
2-
import logging
32
from playwright.sync_api import Page
43
from pages.base_page import BasePage
54
from pages.call_and_recall.call_and_recall_page import CallAndRecallPage
@@ -17,7 +16,7 @@ def before_each(page: Page):
1716
Before every test is executed, this fixture logs in to BCSS as a test user and navigates to the call and recall page
1817
"""
1918
# Log in to BCSS
20-
UserTools.user_login(page, "Hub Manager State Registered at BCS01")
19+
UserTools.user_login(page, "Hub Manager at BCS02")
2120

2221
# Go to call and recall page
2322
BasePage(page).go_to_call_and_recall_page()
@@ -29,55 +28,44 @@ def test_add_then_delete_non_invitation_day(page: Page) -> None:
2928
"""
3029
Verifies that a user can add and delete a non-invitation day.
3130
"""
32-
CallAndRecallPage(page).go_to_non_invitation_days_page()
33-
34-
NonInvitationDaysPage(page).enter_date("14/11/2030")
35-
NonInvitationDaysPage(page).enter_note(
36-
"Add a non-invitation day for automated test"
37-
)
38-
NonInvitationDaysPage(page).click_add_non_invitation_day_button()
39-
NonInvitationDaysPage(page).verify_date_is_visible("14/11/2030")
40-
41-
NonInvitationDaysPage(page).click_delete_button("14/11/2030")
42-
NonInvitationDaysPage(page).confirm_delete_action()
43-
NonInvitationDaysPage(page).verify_date_is_not_visible("14/11/2030")
44-
4531
# Scenario: Add then delete a non invitation day
46-
# Given I log in to BCSS "England" as user role "HubManagerAtBCS02"
4732
# And I go to "Non-Invitation Days"
33+
CallAndRecallPage(page).go_to_non_invitation_days_page()
4834

4935
# # The date entered should be a week day, otherwise a warning message will pop up
5036
# When I enter "14/11/2030" in the input box with id "date"
51-
37+
NonInvitationDaysPage(page).enter_date("14/11/2030")
5238
# # Add a new non invitation day
5339
# And I enter "Add a non invitation day for automated test" in the input box with id "note"
54-
# And I click the "Add Non-Invitation Day" button
55-
# Then the text "14/11/2030" is visible
40+
NonInvitationDaysPage(page).enter_note(
41+
"Add a non-invitation day for automated test"
42+
)
5643

57-
# # Delete the non invitation day using delete button whose element id happens to contain date information
58-
# When I click the element with id "actionButton14/11/2030"
59-
# And I press OK on my confirmation prompt
60-
# Then the text "14/11/2030" is not visible
44+
# And I click the "Add Non-Invitation Day" button
45+
NonInvitationDaysPage(page).click_add_non_invitation_day_button()
46+
# Then todays date is visible in the non-invitation days table
47+
NonInvitationDaysPage(page).verify_date_is_visible()
48+
# When I click the delete button for the non-invitation day
49+
NonInvitationDaysPage(page).click_delete_button()
50+
# And I press OK on my confirmation prompt TODO: This is a modal/popup that needs to be handled
51+
NonInvitationDaysPage(page).confirm_delete_action()
52+
# Then todays date is not visible in the non-invitation days table
53+
NonInvitationDaysPage(page).verify_date_is_not_visible()
6154

6255

6356
@pytest.mark.regression
6457
@pytest.mark.call_and_recall
65-
def test_non_invitation_day_note_required(page: Page) -> None:
58+
def test_non_invitation_day_note_is_mandatory(page: Page) -> None:
6659
"""
6760
Verifies that a note is required when adding a non-invitation day.
6861
"""
62+
# And I go to "Non-Invitation Days"
6963
CallAndRecallPage(page).go_to_non_invitation_days_page()
70-
64+
# When I enter "14/11/2030" in the input box with id "date"
7165
NonInvitationDaysPage(page).enter_date("14/11/2030")
66+
# And I click the "Add Non-Invitation Day" button
7267
NonInvitationDaysPage(page).click_add_non_invitation_day_button()
73-
68+
# Then I get an alert message that "contains" "The Note field is mandatory" TODO: This is a modal/popup that needs to be handled
7469
NonInvitationDaysPage(page).verify_alert_message_contains(
7570
"The Note field is mandatory"
7671
)
77-
78-
# Scenario: Non invitation day note is compulsory
79-
# Given I log in to BCSS "England" as user role "HubManagerAtBCS02"
80-
# And I go to "Non-Invitation Days"
81-
# When I enter "14/11/2030" in the input box with id "date"
82-
# And I click the "Add Non-Invitation Day" button
83-
# Then I get an alert message that "contains" "The Note field is mandatory"

users.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,28 @@
77
"Hub Manager State Registered, Midlands and North West"
88
]
99
},
10+
"Hub Manager at BCS01": {
11+
"username": "BCSS402",
12+
"roles": [
13+
"Hub Manager, Midlands and North West"
14+
]
15+
},
1016
"Screening Centre Manager at BCS001": {
1117
"username": "BCSS118",
1218
"roles": [
1319
"Screening Centre Manager for Wolverhampton, Midlands and North West"
1420
]
21+
},
22+
"Hub Manager State Registered at BCS02": {
23+
"username": "BCSS408",
24+
"roles": [
25+
"Hub Manager State Registered, Southern Bowel Cancer Screening Programme Hub"
26+
]
27+
},
28+
"Hub Manager at BCS02": {
29+
"username": "BCSS409",
30+
"roles": [
31+
"Hub Manager, Southern Bowel Cancer Screening Programme Hub"
32+
]
1533
}
1634
}

0 commit comments

Comments
 (0)