Skip to content

Commit 09471c8

Browse files
committed
wip generate fobt invitations regression tests
1 parent c751ad7 commit 09471c8

File tree

2 files changed

+61
-35
lines changed

2 files changed

+61
-35
lines changed

pages/communication_production/batch_list_page.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,26 @@ def clear_deadline_filter_date(self) -> None:
9393
def verify_deadline_date_filter_input(self, expected_text: str) -> None:
9494
expect(self.deadline_date_filter_with_input).to_have_value(expected_text)
9595

96+
def open_letter_batch(
97+
self, batch_type: str, status: str, level: str, description: str
98+
) -> None:
99+
"""
100+
Finds and opens the batch row based on type, status, level, and description.
101+
"""
102+
# Step 1: Match the row using nested filters, one per column value
103+
row = (
104+
self.page.locator("table tbody tr")
105+
.filter(has=self.page.locator("td", has_text=batch_type))
106+
.filter(has=self.page.locator("td", has_text=status))
107+
.filter(has=self.page.locator("td", has_text=level))
108+
.filter(has=self.page.locator("td", has_text=description))
109+
)
110+
111+
# Step 2: Click the "View" link in the matched row
112+
view_link = row.get_by_role("link", name="View")
113+
expect(view_link).to_be_visible()
114+
view_link.click()
115+
96116

97117
class ActiveBatchListPage(BatchListPage):
98118
"""Active Batch List Page locators, and methods for interacting with the Active Batch List page"""
Lines changed: 41 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
import pytest
22
from playwright.sync_api import Page
3+
import logging
34
from pages.base_page import BasePage
45
from pages.call_and_recall.call_and_recall_page import CallAndRecallPage
5-
from pages.call_and_recall.invitations_monitoring_page import InvitationsMonitoringPage
66
from pages.call_and_recall.generate_invitations_page import GenerateInvitationsPage
7-
from pages.call_and_recall.non_invitations_days_page import NonInvitationDaysPage
8-
from pages.call_and_recall.invitations_plans_page import InvitationsPlansPage
9-
from pages.call_and_recall.create_a_plan_page import CreateAPlanPage
7+
from pages.communication_production.batch_list_page import BatchListPage
8+
from pages.communication_production.communications_production_page import (
9+
CommunicationsProductionPage,
10+
)
11+
from pages.communication_production.manage_active_batch_page import (
12+
ManageActiveBatchPage,
13+
)
1014
from utils.user_tools import UserTools
1115

1216

@@ -22,43 +26,45 @@ def before_each(page: Page):
2226
BasePage(page).go_to_call_and_recall_page()
2327

2428

25-
# Scenario: Run FOBT invitations and process the S1 letter batch
26-
# Many feature scenarios need a subject at S9.
27-
# When I generate invitations
28-
# And I view the active batch list
29-
# And I view the "Original" type "Open" status active letter batch for "S1" "Pre-invitation (FIT)"
30-
# And I prepare the letter batch
31-
# And I retrieve and confirm the letters
32-
# Then there is a subject who meets the following criteria:
33-
# | Latest episode kit class | FIT |
34-
# | Latest event status | S9 |
35-
# | Latest episode type | FOBT |
36-
# | Subject hub code | BCS01 |
37-
38-
# Scenario: User generates invitations for screening episodes (#3)
39-
# # Version copied from now-deleted UserPathway.feature - duplicate steps etc need to be sorted out
40-
# Given I log in to BCSS "England" as user role "Hub Manager - State Registered"
41-
# When I navigate to the Call and Recall > Generate Invitations Page
42-
# And I press the Generate Invitations button and generate invitations
43-
# Then Invitations are successfully generated
44-
45-
29+
@pytest.mark.wip
4630
@pytest.mark.regression
4731
@pytest.mark.call_and_recall
48-
def test_generate_fobt_invitations(page: Page) -> None:
32+
def test_run_fobt_invitations_and_process_s1_batch(page, general_properties: dict):
4933
"""
50-
Verifies that a user can generate FOBT invitations and process the S1 letter batch.
34+
Run FOBT invitations, open the S1 batch, prepare, retrieve+confirm,
35+
and assert we have a subject at status S9.
5136
"""
37+
# Navigate to generate invitations
5238
CallAndRecallPage(page).go_to_generate_invitations_page()
53-
GenerateInvitationsPage(page).click_generate_invitations_button()
5439

55-
GenerateInvitationsPage(page).view_active_batch_list()
56-
GenerateInvitationsPage(page).view_original_open_status_batch(
57-
"S1", "Pre-invitation (FIT)"
40+
# When I generate invitations
41+
logging.info("Generating invitations based on the invitation plan")
42+
GenerateInvitationsPage(page).click_generate_invitations_button()
43+
GenerateInvitationsPage(page).wait_for_invitation_generation_complete(
44+
int(general_properties["daily_invitation_rate"])
5845
)
59-
GenerateInvitationsPage(page).prepare_letter_batch()
60-
GenerateInvitationsPage(page).retrieve_and_confirm_letters()
46+
logging.info("Invitations generated successfully")
47+
48+
# And I view the active batch list
49+
CommunicationsProductionPage(page).go_to_active_batch_list_page()
6150

62-
GenerateInvitationsPage(page).verify_subject_meets_criteria(
63-
kit_class="FIT", event_status="S9", episode_type="FOBT", hub_code="BCS01"
51+
# And I open the "Original" / "Open" / "S1" / "Pre-invitation (FIT)" batch
52+
BatchListPage(page).open_letter_batch(
53+
batch_type="Original",
54+
status="Open",
55+
level="S1",
56+
description="Pre-invitation (FIT)",
6457
)
58+
59+
# # And I prepare, retrieve & confirm
60+
# ManageActiveBatchPage(page).click_prepare_button()
61+
# ManageActiveBatchPage(page).click_retrieve_button()
62+
# ManageActiveBatchPage(page).click_confirm_button()
63+
64+
# # Then there is a subject matching the criteria
65+
# assert lb.subject_exists(
66+
# latest_kit_class="FIT",
67+
# latest_event_status="S9",
68+
# latest_episode_type="FOBT",
69+
# subject_hub_code="BCS01",
70+
# ), "Expected at least one subject at S9 with FIT/FOBT/BCS01"

0 commit comments

Comments
 (0)