generated from NHSDigital/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f86a6f0
commit 34994eb
Showing
11 changed files
with
158 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
from libs import playwright_ops | ||
from libs.constants import object_properties, actions | ||
from libs.constants import actions | ||
|
||
|
||
class pg_home: | ||
po = playwright_ops.playwright_operations() | ||
|
||
LNK_PROGRAMMES = "Programmes" | ||
LNK_VACCINES = "Vaccines" | ||
|
||
def click_programmes(self): | ||
self.po.perform_action(locator=self.LNK_PROGRAMMES, action=actions.CLICK_LINK) | ||
|
||
def click_vaccines(self): | ||
self.po.perform_action(locator=self.LNK_VACCINES, action=actions.CLICK_LINK) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
from libs import playwright_ops | ||
from libs.constants import actions, object_properties | ||
from libs.wrappers import * | ||
|
||
|
||
class pg_vaccines: | ||
po = playwright_ops.playwright_operations() | ||
|
||
LBL_VACCINE_NAME = "Gardasil 9 (HPV)" | ||
LBL_VACCINE_MANUFACTURER = "Merck Sharp & Dohme" | ||
LBL_MAIN = "main" | ||
LBL_PARAGRAPH = "paragraph" | ||
LBL_BATCH_ARCHIVED = "Batch archived." | ||
LNK_ADD_NEW_BATCH = "Add a batch" | ||
TXT_BATCH_NAME = "Batch" | ||
TXT_EXPIRY_DAY = "Day" | ||
TXT_EXPIRY_MONTH = "Month" | ||
TXT_EXPIRY_YEAR = "Year" | ||
BTN_ADD_BATCH = "Add batch" | ||
BTN_SAVE_CHANGES = "Save changes" | ||
BTN_CONFIRM_ARCHIVE = "Yes, archive this batch" | ||
|
||
def verify_current_vaccine(self): | ||
self.po.verify( | ||
locator=self.LBL_MAIN, property=object_properties.TEXT, value=self.LBL_VACCINE_NAME, exact=False | ||
) | ||
self.po.verify( | ||
locator=self.LBL_MAIN, property=object_properties.TEXT, value=self.LBL_VACCINE_MANUFACTURER, exact=False | ||
) | ||
|
||
def enter_batch_name(self): | ||
self.batch_name = f"Auto{get_new_datetime()}" | ||
self.po.perform_action(locator=self.TXT_BATCH_NAME, action=actions.FILL, value=self.batch_name) | ||
|
||
def enter_batch_expiry(self): | ||
self.po.perform_action(locator=self.TXT_EXPIRY_DAY, action=actions.FILL, value="31") | ||
self.po.perform_action(locator=self.TXT_EXPIRY_MONTH, action=actions.FILL, value="12") | ||
self.po.perform_action(locator=self.TXT_EXPIRY_YEAR, action=actions.FILL, value="2030") | ||
|
||
def add_batch(self): | ||
self.po.perform_action(locator=self.LNK_ADD_NEW_BATCH, action=actions.CLICK_LINK) | ||
self.enter_batch_name() | ||
self.enter_batch_expiry() | ||
self.po.perform_action(locator=self.BTN_ADD_BATCH, action=actions.CLICK_BUTTON) | ||
_success_message = f"Batch {self.batch_name} added" | ||
self.po.verify(locator=self.LBL_PARAGRAPH, property=object_properties.TEXT, value=_success_message) | ||
|
||
def change_batch(self): | ||
self.po.perform_action( | ||
locator=self.batch_name, action=actions.CLICK_LINK_INDEX_FOR_ROW, value=0 | ||
) # CHANGE link | ||
self.po.perform_action(locator=self.TXT_EXPIRY_YEAR, action=actions.FILL, value="2031") | ||
self.po.perform_action(locator=self.BTN_SAVE_CHANGES, action=actions.CLICK_BUTTON) | ||
_success_message = f"Batch {self.batch_name} updated" | ||
self.po.verify(locator=self.LBL_PARAGRAPH, property=object_properties.TEXT, value=_success_message) | ||
|
||
def archive_batch(self): | ||
self.po.perform_action( | ||
locator=self.batch_name, action=actions.CLICK_LINK_INDEX_FOR_ROW, value=1 | ||
) # ARCHIVE link | ||
self.po.perform_action(locator=self.BTN_CONFIRM_ARCHIVE, action=actions.CLICK_BUTTON) | ||
self.po.verify(locator=self.LBL_PARAGRAPH, property=object_properties.TEXT, value=self.LBL_BATCH_ARCHIVED) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import pytest | ||
|
||
from pages import pg_home, pg_login, pg_vaccines | ||
|
||
|
||
class Test_Regression_Cohorts: | ||
login_page = pg_login.pg_login() | ||
home_page = pg_home.pg_home() | ||
vaccines_page = pg_vaccines.pg_vaccines() | ||
|
||
@pytest.mark.vaccsbatch | ||
@pytest.mark.regression | ||
@pytest.mark.order(601) | ||
def test_reg_batch_add_batch(self, create_browser_page): | ||
self.login_page.perform_login() | ||
self.home_page.click_vaccines() | ||
self.vaccines_page.add_batch() | ||
self.vaccines_page.change_batch() | ||
self.vaccines_page.archive_batch() | ||
|
||
@pytest.mark.vaccsbatch | ||
@pytest.mark.regression | ||
@pytest.mark.order(602) | ||
def test_reg_batch_change_batch(self, create_browser_page): | ||
self.login_page.perform_login() | ||
self.home_page.click_vaccines() | ||
self.vaccines_page.add_batch() | ||
self.vaccines_page.change_batch() | ||
|
||
@pytest.mark.vaccsbatch | ||
@pytest.mark.regression | ||
@pytest.mark.order(603) | ||
def test_reg_batch_archive_batch(self, create_browser_page): | ||
self.login_page.perform_login() | ||
self.home_page.click_vaccines() | ||
self.vaccines_page.add_batch() | ||
self.vaccines_page.archive_batch() | ||
|
||
@pytest.mark.vaccsbatch | ||
@pytest.mark.regression | ||
@pytest.mark.order(604) | ||
def test_reg_batch_add_change_archive_batch(self, create_browser_page): | ||
self.login_page.perform_login() | ||
self.home_page.click_vaccines() | ||
self.vaccines_page.add_batch() | ||
self.vaccines_page.archive_batch() |