Skip to content

Commit

Permalink
sessions fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
chinmaymudholkar1 committed Nov 15, 2024
1 parent d1c8436 commit ddda4d3
Show file tree
Hide file tree
Showing 16 changed files with 35 additions and 23 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ venv/
# Local
logs/pytest.log
main.py
reports/*
working/*

1 change: 1 addition & 0 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def start_playwright():
@pytest.fixture()
def start_mavis(start_exe_session, start_playwright):
_browser, _context = start_browser(pw=start_playwright, browser_or_device=ce.current_browser_name)
ce.browser = _browser
ce.page = _context.new_page()
ce.page.goto(url=ce.service_url)
yield
Expand Down
1 change: 1 addition & 0 deletions libs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

class CurrentExecution:
page = None
browser = None
service_url: str = ""
base_auth_username: str = ""
base_auth_password: str = ""
Expand Down
6 changes: 6 additions & 0 deletions pages/pg_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class pg_login:
TXT_EMAIL_ADDRESS = "Email address"
TXT_PASSWORD = "Password"
BTN_LOGIN = "Log in"
BTN_LOGOUT = "Log out"
LBL_BANNER = "banner"
LBL_USER = "Nurse Joy"
LBL_PARAGRAPH = "paragraph"
Expand Down Expand Up @@ -42,3 +43,8 @@ def perform_invalid_login(self, user: str, pwd: str, expected_message: str) -> s
self.enter_password(password=pwd)
self.click_login()
self.po.verify(locator=self.LBL_PARAGRAPH, property=object_properties.TEXT, value=expected_message, exact=True)

def logout(self):
self.po.perform_action(locator=self.BTN_LOGOUT, action=actions.CLICK_BUTTON)
self.ce.page.close()
# self.ce.browser.close()
4 changes: 2 additions & 2 deletions pages/pg_sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def create_invalid_session(self):

def upload_class_list(self, file_paths: str):
_input_file_path, _output_file_path = self.tdo.split_file_paths(file_paths=file_paths)
self.click_unscheduled()
self.click_scheduled()
self.click_school1()
self.click_import_class_list()
self.choose_file_child_records(file_path=_input_file_path)
Expand All @@ -238,7 +238,7 @@ def upload_class_list(self, file_paths: str):

def upload_invalid_class_list_records(self, file_paths: str):
_input_file_path, _output_file_path = self.tdo.split_file_paths(file_paths=file_paths)
self.click_unscheduled()
self.click_scheduled()
self.click_school1()
self.click_import_class_list()
self.choose_file_child_records(file_path=_input_file_path)
Expand Down
Binary file modified requirements.txt
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,39 @@ class Test_Regression_Class_List_Upload:
dashboard_page = pg_dashboard.pg_dashboard()
sessions_page = pg_sessions.pg_sessions()

@pytest.mark.classlist
@pytest.mark.order(901)
def test_reg_class_list_file_upload_positive(self, start_mavis):
@pytest.fixture()
def create_session(self, start_mavis: None):
self.login_page.perform_valid_login()
self.dashboard_page.click_sessions()
self.sessions_page.schedule_a_valid_session()
self.dashboard_page.go_to_dashboard()
self.dashboard_page.click_sessions()
yield
self.dashboard_page.go_to_dashboard()
self.dashboard_page.click_sessions()
self.sessions_page.delete_all_sessions()

@pytest.mark.classlist
@pytest.mark.order(301)
def test_reg_class_list_file_upload_positive(self, create_session: None):
self.sessions_page.upload_class_list(file_paths=test_data_file_paths.CLASS_POSITIVE)

@pytest.mark.classlist
@pytest.mark.order(902)
def test_reg_class_list_file_upload_negative(self, start_mavis):
self.login_page.perform_valid_login()
self.dashboard_page.click_sessions()
@pytest.mark.order(302)
def test_reg_class_list_file_upload_negative(self, create_session: None):
self.sessions_page.upload_class_list(file_paths=test_data_file_paths.CLASS_NEGATIVE)

@pytest.mark.classlist
@pytest.mark.order(903)
def test_reg_class_list_file_structure(self, start_mavis):
self.login_page.perform_valid_login()
self.dashboard_page.click_sessions()
@pytest.mark.order(303)
def test_reg_class_list_file_structure(self, create_session: None):
self.sessions_page.upload_invalid_class_list_records(file_paths=test_data_file_paths.CLASS_INVALID_STRUCTURE)

@pytest.mark.classlist
@pytest.mark.order(904)
def test_reg_class_list_no_record(self, start_mavis):
self.login_page.perform_valid_login()
self.dashboard_page.click_sessions()
@pytest.mark.order(304)
def test_reg_class_list_no_record(self, create_session: None):
self.sessions_page.upload_invalid_class_list_records(file_paths=test_data_file_paths.CLASS_HEADER_ONLY)

@pytest.mark.classlist
@pytest.mark.order(905)
def test_reg_class_list_empty_file(self, start_mavis):
self.login_page.perform_valid_login()
self.dashboard_page.click_sessions()
@pytest.mark.order(305)
def test_reg_class_list_empty_file(self, create_session: None):
self.sessions_page.upload_invalid_class_list_records(file_paths=test_data_file_paths.CLASS_EMPTY_FILE)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions tests/test_3_consent.py → tests/test_10_consent.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ class Test_Regression_Consent:

@pytest.mark.consent
@pytest.mark.mobile
@pytest.mark.order(301)
@pytest.mark.order(1001)
@pytest.mark.parametrize("scenario_data", helper.df.iterrows(), ids=[_tc[0] for _tc in helper.df.iterrows()])
def test_reg_parental_consent_workflow(self, start_consent_workflow, scenario_data):
self.helper.read_data_for_scenario(scenario_data=scenario_data)
self.helper.enter_details()

@pytest.mark.consent
@pytest.mark.mobile
@pytest.mark.order(302)
@pytest.mark.order(1002)
def test_reg_gillick_consent(self, start_mavis):
self.login_page.perform_valid_login()
self.dashboard_page.click_sessions()
Expand Down

0 comments on commit ddda4d3

Please sign in to comment.