Skip to content

Commit 8070b26

Browse files
Fixtures updated
1 parent 02cbcdd commit 8070b26

12 files changed

+116
-65
lines changed

conftest.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def start_playwright():
2525
yield _playwright
2626

2727

28-
@pytest.fixture()
28+
@pytest.fixture(scope="session")
2929
def start_mavis(start_exe_session, start_playwright):
3030
_browser, _context = start_browser(pw=start_playwright, browser_or_device=ce.current_browser_name)
3131
ce.browser = _browser
@@ -35,15 +35,6 @@ def start_mavis(start_exe_session, start_playwright):
3535
close_browser(browser=_browser, page=ce.page)
3636

3737

38-
# @pytest.fixture
39-
# def start_consent_workflow(start_exe_session, start_playwright):
40-
# _browser, _context = start_browser(pw=start_playwright, browser_or_device=ce.current_browser_name)
41-
# ce.page = _context.new_page()
42-
# ce.page.goto(url=ce.parental_consent_url)
43-
# yield
44-
# close_browser(browser=_browser, page=ce.page)
45-
46-
4738
@pytest.fixture
4839
def start_consent_workflow(start_exe_session, start_playwright):
4940
_browser, _context = start_browser(pw=start_playwright, browser_or_device=ce.current_browser_name)

libs/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class playwright_roles:
5555

5656

5757
class wait_time:
58-
MIN: Final[str] = "3s"
58+
MIN: Final[str] = "1s"
5959
MED: Final[str] = "10s"
6060
MAX: Final[str] = "30s"
6161

pages/pg_login.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def perform_valid_login(self):
3838
self.verify_login_successful()
3939

4040
def perform_invalid_login(self, user: str, pwd: str, expected_message: str) -> str:
41-
self.click_start()
41+
# self.click_start()
4242
self.enter_username(username=user)
4343
self.enter_password(password=pwd)
4444
self.click_login()

pages/pg_sessions.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ class pg_sessions:
5858
BTN_UPDATE_GILLICK_ASSESSMENT = "Update your assessment"
5959
LNK_CONSENT_FORM = "View parental consent form ("
6060
LNK_COULD_NOT_VACCINATE = "Could not vaccinate"
61+
LNK_CONSENT_REFUSED = "Consent refused"
6162

6263
def __get_display_formatted_date(self, date_to_format: str) -> str:
6364
_parsed_date = datetime.strptime(date_to_format, "%Y%m%d")
@@ -134,6 +135,9 @@ def click_edit_gillick_competence(self):
134135
def click_could_not_vaccinate(self):
135136
self.po.perform_action(locator=self.LNK_COULD_NOT_VACCINATE, action=actions.CLICK_LINK)
136137

138+
def click_consent_refused(self):
139+
self.po.perform_action(locator=self.LNK_CONSENT_REFUSED, action=actions.CLICK_LINK)
140+
137141
def add_gillick_competence(self, is_competent: bool, competence_details: str) -> None:
138142
self.__set_gillick_consent(is_add=True, is_competent=is_competent, competence_details=competence_details)
139143

@@ -315,12 +319,13 @@ def update_triage_outcome_consent_refused(self, file_paths):
315319
self.click_child_full_name()
316320
self.click_get_consent_responses()
317321
self.consent_page.service_refuse_consent()
318-
self.dashboard_page.go_to_dashboard()
319-
self.dashboard_page.click_sessions()
320-
self.click_scheduled()
321-
self.click_school1()
322-
self.click_record_vaccinations()
323-
self.click_could_not_vaccinate()
322+
# self.dashboard_page.go_to_dashboard()
323+
# self.dashboard_page.click_sessions()
324+
# self.click_scheduled()
325+
# self.click_school1()
326+
# self.click_record_vaccinations()
327+
# self.click_could_not_vaccinate()
328+
self.click_consent_refused()
324329
self.click_child_full_name()
325330
self.click_activity_log()
326331
self.verify_activity_log_entry(consent_given=False)

tests/test_01_login.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ class Test_Regression_Login:
77
login_page = pg_login.pg_login()
88
dashboard_page = pg_dashboard.pg_dashboard()
99

10+
@pytest.fixture(scope="class", autouse=True)
11+
def test_setup(self, start_mavis):
12+
yield
13+
14+
@pytest.fixture(scope="class")
15+
def reset_navigation(self):
16+
self.login_page.click_start()
17+
yield
18+
1019
test_parameters = [
1120
("invalid_user", "invalid_password", "Invalid Email or password."),
1221
("invalid_user", "", "Invalid Email or password."),
@@ -17,12 +26,14 @@ class Test_Regression_Login:
1726
@pytest.mark.mobile
1827
@pytest.mark.order(101)
1928
@pytest.mark.parametrize("user,pwd,expected_message", test_parameters)
20-
def test_reg_invalid_login(self, start_mavis, user, pwd, expected_message):
29+
def test_reg_invalid_login(self, reset_navigation, user, pwd, expected_message):
2130
self.login_page.perform_invalid_login(user=user, pwd=pwd, expected_message=expected_message)
2231

2332
@pytest.mark.login
2433
@pytest.mark.mobile
2534
@pytest.mark.order(102)
26-
def test_reg_home_page_links(self, start_mavis):
35+
def test_reg_home_page_links(self):
36+
self.login_page.go_to_login_page()
2737
self.login_page.perform_valid_login()
2838
self.dashboard_page.verify_all_expected_links()
39+
self.login_page.perform_logout()

tests/test_02_sessions.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,31 @@ class Test_Regression_Sessions:
88
dashboard_page = pg_dashboard.pg_dashboard()
99
sessions_page = pg_sessions.pg_sessions()
1010

11-
@pytest.fixture
11+
@pytest.fixture(scope="class", autouse=True)
1212
def test_setup(self, start_mavis):
1313
self.login_page.perform_valid_login()
14-
self.dashboard_page.click_sessions()
1514
yield
1615
self.login_page.perform_logout()
1716

17+
@pytest.fixture(scope="function", autouse=True)
18+
def reset_navigation(self):
19+
self.dashboard_page.go_to_dashboard()
20+
self.dashboard_page.click_sessions()
21+
yield
22+
self.dashboard_page.go_to_dashboard()
23+
self.dashboard_page.click_sessions()
24+
1825
@pytest.mark.sessions
1926
@pytest.mark.order(201)
20-
def test_reg_create_valid_session(self, test_setup):
27+
def test_reg_create_valid_session(self):
2128
self.sessions_page.schedule_a_valid_session()
2229

2330
@pytest.mark.sessions
2431
@pytest.mark.order(202)
25-
def test_reg_delete_all_sessions(self, test_setup):
32+
def test_reg_delete_all_sessions(self):
2633
self.sessions_page.delete_all_sessions()
2734

2835
@pytest.mark.sessions
2936
@pytest.mark.order(203)
30-
def test_reg_create_invalid_session(self, test_setup):
37+
def test_reg_create_invalid_session(self):
3138
self.sessions_page.create_invalid_session()

tests/test_03_class_list_upload.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,39 +9,44 @@ class Test_Regression_Class_List_Upload:
99
dashboard_page = pg_dashboard.pg_dashboard()
1010
sessions_page = pg_sessions.pg_sessions()
1111

12-
@pytest.fixture()
12+
@pytest.fixture(scope="class", autouse=True)
1313
def test_setup(self, start_mavis: None):
1414
self.login_page.perform_valid_login()
1515
self.dashboard_page.click_sessions()
1616
self.sessions_page.schedule_a_valid_session()
17+
yield
18+
self.sessions_page.delete_all_sessions()
19+
self.login_page.perform_logout()
20+
21+
@pytest.fixture(scope="function", autouse=True)
22+
def reset_navigation(self):
1723
self.dashboard_page.go_to_dashboard()
1824
self.dashboard_page.click_sessions()
1925
yield
2026
self.dashboard_page.go_to_dashboard()
2127
self.dashboard_page.click_sessions()
22-
self.sessions_page.delete_all_sessions()
2328

2429
@pytest.mark.classlist
2530
@pytest.mark.order(301)
26-
def test_reg_class_list_file_upload_positive(self, test_setup: None):
31+
def test_reg_class_list_file_upload_positive(self):
2732
self.sessions_page.upload_class_list(file_paths=test_data_file_paths.CLASS_POSITIVE)
2833

2934
@pytest.mark.classlist
3035
@pytest.mark.order(302)
31-
def test_reg_class_list_file_upload_negative(self, test_setup: None):
36+
def test_reg_class_list_file_upload_negative(self):
3237
self.sessions_page.upload_class_list(file_paths=test_data_file_paths.CLASS_NEGATIVE)
3338

3439
@pytest.mark.classlist
3540
@pytest.mark.order(303)
36-
def test_reg_class_list_file_structure(self, test_setup: None):
41+
def test_reg_class_list_file_structure(self):
3742
self.sessions_page.upload_invalid_class_list_records(file_paths=test_data_file_paths.CLASS_INVALID_STRUCTURE)
3843

3944
@pytest.mark.classlist
4045
@pytest.mark.order(304)
41-
def test_reg_class_list_no_record(self, test_setup: None):
46+
def test_reg_class_list_no_record(self):
4247
self.sessions_page.upload_invalid_class_list_records(file_paths=test_data_file_paths.CLASS_HEADER_ONLY)
4348

4449
@pytest.mark.classlist
4550
@pytest.mark.order(305)
46-
def test_reg_class_list_empty_file(self, test_setup: None):
51+
def test_reg_class_list_empty_file(self):
4752
self.sessions_page.upload_invalid_class_list_records(file_paths=test_data_file_paths.CLASS_EMPTY_FILE)

tests/test_04_cohorts.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,34 +9,42 @@ class Test_Regression_Cohorts:
99
dashboard_page = pg_dashboard.pg_dashboard()
1010
programmes_page = pg_programmes.pg_programmes()
1111

12-
@pytest.fixture()
12+
@pytest.fixture(scope="class", autouse=True)
1313
def test_setup(self, start_mavis: None):
1414
self.login_page.perform_valid_login()
1515
self.dashboard_page.click_programmes()
1616
yield
1717
self.login_page.perform_logout()
1818

19+
@pytest.fixture(scope="function", autouse=True)
20+
def reset_navigation(self):
21+
self.dashboard_page.go_to_dashboard()
22+
self.dashboard_page.click_programmes()
23+
yield
24+
self.dashboard_page.go_to_dashboard()
25+
self.dashboard_page.click_programmes()
26+
1927
@pytest.mark.cohorts
2028
@pytest.mark.order(401)
21-
def test_reg_cohort_upload_positive(self, test_setup):
29+
def test_reg_cohort_upload_positive(self):
2230
self.programmes_page.upload_cohorts(file_paths=test_data_file_paths.COHORTS_POSITIVE)
2331

2432
@pytest.mark.cohorts
2533
@pytest.mark.order(402)
26-
def test_reg_cohort_upload_negative(self, test_setup):
34+
def test_reg_cohort_upload_negative(self):
2735
self.programmes_page.upload_cohorts(file_paths=test_data_file_paths.COHORTS_NEGATIVE)
2836

2937
@pytest.mark.cohorts
3038
@pytest.mark.order(403)
31-
def test_reg_cohorts_file_structure(self, test_setup):
39+
def test_reg_cohorts_file_structure(self):
3240
self.programmes_page.upload_invalid_cohorts(file_paths=test_data_file_paths.COHORTS_INVALID_STRUCTURE)
3341

3442
@pytest.mark.cohorts
3543
@pytest.mark.order(404)
36-
def test_reg_cohorts_no_record(self, test_setup):
44+
def test_reg_cohorts_no_record(self):
3745
self.programmes_page.upload_invalid_cohorts(file_paths=test_data_file_paths.COHORTS_HEADER_ONLY)
3846

3947
@pytest.mark.cohorts
4048
@pytest.mark.order(405)
41-
def test_reg_cohorts_empty_file(self, test_setup):
49+
def test_reg_cohorts_empty_file(self):
4250
self.programmes_page.upload_invalid_cohorts(file_paths=test_data_file_paths.COHORTS_EMPTY_FILE)

tests/test_05_child_list_upload.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,34 +9,42 @@ class Test_Regression_Child_List_Upload:
99
dashboard_page = pg_dashboard.pg_dashboard()
1010
programmes_page = pg_programmes.pg_programmes()
1111

12-
@pytest.fixture()
12+
@pytest.fixture(scope="class", autouse=True)
1313
def test_setup(self, start_mavis: None):
1414
self.login_page.perform_valid_login()
1515
self.dashboard_page.click_programmes()
1616
yield
1717
self.login_page.perform_logout()
1818

19+
@pytest.fixture(scope="function", autouse=True)
20+
def reset_navigation(self):
21+
self.dashboard_page.go_to_dashboard()
22+
self.dashboard_page.click_programmes()
23+
yield
24+
self.dashboard_page.go_to_dashboard()
25+
self.dashboard_page.click_programmes()
26+
1927
@pytest.mark.childlist
2028
@pytest.mark.order(501)
21-
def test_reg_child_list_file_upload_positive(self, test_setup):
29+
def test_reg_child_list_file_upload_positive(self):
2230
self.programmes_page.upload_hpv_child_records(file_paths=test_data_file_paths.CHILD_POSITIVE)
2331

2432
@pytest.mark.childlist
2533
@pytest.mark.order(502)
26-
def test_reg_child_list_file_upload_negative(self, test_setup):
34+
def test_reg_child_list_file_upload_negative(self):
2735
self.programmes_page.upload_hpv_child_records(file_paths=test_data_file_paths.CHILD_NEGATIVE)
2836

2937
@pytest.mark.childlist
3038
@pytest.mark.order(503)
31-
def test_reg_child_list_file_structure(self, test_setup):
39+
def test_reg_child_list_file_structure(self):
3240
self.programmes_page.upload_invalid_hpv_child_records(file_paths=test_data_file_paths.CHILD_INVALID_STRUCTURE)
3341

3442
@pytest.mark.childlist
3543
@pytest.mark.order(504)
36-
def test_reg_child_list_no_record(self, test_setup):
44+
def test_reg_child_list_no_record(self):
3745
self.programmes_page.upload_invalid_hpv_child_records(file_paths=test_data_file_paths.CHILD_HEADER_ONLY)
3846

3947
@pytest.mark.childlist
4048
@pytest.mark.order(505)
41-
def test_reg_child_list_empty_file(self, test_setup):
49+
def test_reg_child_list_empty_file(self):
4250
self.programmes_page.upload_invalid_hpv_child_records(file_paths=test_data_file_paths.CHILD_EMPTY_FILE)

tests/test_06_vaccs_batch.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,45 @@ class Test_Regression_Cohorts:
88
dashboard_page = pg_dashboard.pg_dashboard()
99
vaccines_page = pg_vaccines.pg_vaccines()
1010

11-
@pytest.fixture
12-
def test_setup(self, start_mavis):
11+
@pytest.fixture(scope="class", autouse=True)
12+
def test_setup(self, start_mavis: None):
1313
self.login_page.perform_valid_login()
14-
self.dashboard_page.click_vaccines()
14+
self.dashboard_page.click_programmes()
1515
yield
1616
self.login_page.perform_logout()
1717

18+
@pytest.fixture(scope="function", autouse=True)
19+
def reset_navigation(self):
20+
self.dashboard_page.go_to_dashboard()
21+
self.dashboard_page.click_vaccines()
22+
yield
23+
self.dashboard_page.go_to_dashboard()
24+
self.dashboard_page.click_vaccines()
25+
1826
@pytest.mark.vaccsbatch
1927
@pytest.mark.mobile
2028
@pytest.mark.order(601)
21-
def test_reg_batch_add_batch(self, test_setup):
29+
def test_reg_batch_add_batch(self):
2230
self.vaccines_page.add_batch()
2331

2432
@pytest.mark.vaccsbatch
2533
@pytest.mark.mobile
2634
@pytest.mark.order(602)
27-
def test_reg_batch_change_batch(self, test_setup):
35+
def test_reg_batch_change_batch(self):
2836
self.vaccines_page.add_batch()
2937
self.vaccines_page.change_batch()
3038

3139
@pytest.mark.vaccsbatch
3240
@pytest.mark.mobile
3341
@pytest.mark.order(603)
34-
def test_reg_batch_archive_batch(self, test_setup):
42+
def test_reg_batch_archive_batch(self):
3543
self.vaccines_page.add_batch()
3644
self.vaccines_page.archive_batch()
3745

3846
@pytest.mark.vaccsbatch
3947
@pytest.mark.mobile
4048
@pytest.mark.order(604)
41-
def test_reg_batch_add_change_archive_batch(self, test_setup):
49+
def test_reg_batch_add_change_archive_batch(self):
4250
self.vaccines_page.add_batch()
4351
self.vaccines_page.change_batch()
4452
self.vaccines_page.archive_batch()

0 commit comments

Comments
 (0)