1212from pages .communication_production .manage_archived_batch_page import (
1313 ManageArchivedBatchPage ,
1414)
15+ from pages .communication_production .letter_library_index_page import (
16+ LetterLibraryIndexPage ,
17+ )
18+ from pages .communication_production import letter_library_index_page
1519from utils .batch_processing import prepare_and_print_batch
1620
1721
@@ -20,15 +24,13 @@ def select_user(page: Page):
2024 def _login_as (user_role : str ):
2125 # Log in with the specified user
2226 UserTools .user_login (page , user_role )
23- # Navigate to Active Batch List
27+ # Navigate to communications production page
2428 BasePage (page ).go_to_communications_production_page ()
25- CommunicationsProductionPage (page ).go_to_archived_batch_list_page ()
2629 return page
2730
2831 return _login_as
2932
3033
31- @pytest .mark .wip
3234@pytest .mark .letters_tests
3335@pytest .mark .regression
3436def test_reprint_and_archive_letter_batch (select_user ) -> None :
@@ -44,6 +46,7 @@ def test_reprint_and_archive_letter_batch(select_user) -> None:
4446 """
4547 # Step 1: Log in as user and navigate to Archived Batch List
4648 page = select_user ("Hub Manager State Registered at BCS01" )
49+ CommunicationsProductionPage (page ).go_to_archived_batch_list_page ()
4750 batch_list_page = ArchivedBatchListPage (page )
4851
4952 # Step 2: Ensure the archived batch list table is visible
@@ -87,14 +90,61 @@ def test_reprint_and_archive_letter_batch(select_user) -> None:
8790 manage_archived_page .confirm_archived_message_visible ()
8891
8992
90- # Scenario: Check that S1 has supplementary batches
91- # Given I log in to BCSS "England" as user role "HubManagerStateRegistered"
92- # When I view the letter library index
93- # And I filter the letter library index list to view the "Supplementary Letters" letters group
94- # And I ensure that I can create "S1" supplementary batches
95- # And I view the archived batch list
96- # And I view the "Original" type archived letter batch for "S1" "Pre"
97- # And I create a supplementary batch
98- # And I prepare the letter batch
99- # And I retrieve and confirm the letters
100- # And my batch is now archived
93+ @pytest .mark .wip
94+ @pytest .mark .letters_tests
95+ @pytest .mark .regression
96+ def test_check_that_s1_has_supplementary_batches (select_user ) -> None :
97+ """
98+ Scenario: I can create a supplementary batch for S1 and archive it
99+ Given I log in to BCSS "England" as user role "HubManagerStateRegistered"
100+ When I view the letter library index
101+ And I filter the letter library index list to view the "Supplementary Letters" letters group
102+ And I ensure that I can create "S1" supplementary batches
103+ And I view the archived batch list
104+ And I view the "Original" type archived letter batch for "S1" "Pre"
105+ And I create a supplementary batch
106+ And I prepare the letter batch
107+ And I retrieve and confirm the letters
108+ And my batch is now archived
109+ """
110+ # Step 1: Log in as user and navigate to Letter Library Index
111+ page = select_user ("Hub Manager State Registered at BCS01" )
112+ CommunicationsProductionPage (page ).go_to_letter_library_index_page ()
113+
114+ # Step 2: Filter for "Supplementary Letters" group
115+ LetterLibraryIndexPage (page ).filter_by_letters_group ("Supplementary Letters" )
116+
117+ # TODO: Is this below step required? There is no button to create a supplementary batch in the letter library index page.
118+ # and there are no supplementary letters in the letter library index page.
119+
120+ # Step 3: Ensure S1 supplementary batches can be created
121+ if not letter_library_index_page .can_create_supplementary_batches ("S1" ):
122+ pytest .skip ("No S1 supplementary batches available for creation." )
123+
124+ # Step 4: Navigate to Archived Batch List
125+ archived_batch_list_page = ArchivedBatchListPage (page )
126+ archived_batch_list_page .assert_batch_table_visible ()
127+
128+ # Step 5: Find and open archived batch with Type "Original", Event Code "S1", and Description "Pre"
129+ row = archived_batch_list_page .get_archived_batch_row (
130+ "Original" , "S1" , "Pre-invitation (FIT)"
131+ )
132+ if not row :
133+ pytest .skip ("No archived 'Original' S1 Pre batches found to reprint." )
134+
135+ batch_id = row .locator ("a" ).first .inner_text ()
136+ row .locator ("a" ).first .click ()
137+
138+ # Step 6: Create a supplementary batch
139+ manage_active_page = ManageActiveBatchPage (page )
140+ manage_active_page .click_prepare_button ()
141+
142+ # Step 7: Prepare the letter batch
143+ manage_active_page .prepare_and_print ()
144+
145+ # Step 8: Retrieve and confirm letters
146+ manage_active_page .retrieve_and_confirm_letters ()
147+
148+ # Step 9: Confirm the batch is now archived
149+ manage_archived_page = ManageArchivedBatchPage (page )
150+ manage_archived_page .confirm_archived_message_visible ()
0 commit comments