Skip to content

Commit 36b2bcf

Browse files
Altering test_compartment_1.pooy to make use of more POMs
1 parent e0be618 commit 36b2bcf

File tree

4 files changed

+36
-5
lines changed

4 files changed

+36
-5
lines changed

pages/active_batch_list_page.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ def __init__(self, page: Page):
1212
self.batch_split_by_filter = self.page.locator("#splitByFilter")
1313
self.screening_centre_filter = self.page.locator("#screeningCentreFilter")
1414
self.count_filter = self.page.locator("#countFilter")
15+
# self.td = self.page.locator("td")
16+
17+
# def filter_td(self, filter):
18+
# self.td.
1519

1620
def enter_id_filter(self, search_text: str):
1721
self.id_filter.click()

pages/navigation_bar_links.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def __init__(self, page: Page):
1212

1313
def click_main_menu_link(self):
1414
for _ in range(3): # Try up to 3 times
15-
self.page.wait_for_timeout(1000) # Wait for 1 second before trying (as sometimes this button is clicked as a redirect happens)
15+
self.page.wait_for_timeout(2000) # Wait for 2 seconds before trying (as sometimes this button is clicked as a redirect happens)
1616
if self.main_menu_link.is_visible():
1717
self.main_menu_link.click()
1818
return # Exit if successful

tests/Smokescreen/test_compartment_1.py

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,42 @@
1515
from pages.navigation_bar_links import *
1616
from pages.subject_screening_page import *
1717

18+
# @pytest.mark.wip2 # Not working at the moment
19+
# def test_prereq():
20+
# database_connection_exec("prereq_check")
21+
22+
# paramater_32 = database_connection_query("select DEFAULT_VALUE from PARAMETERS where PARAM_ID = 32")
23+
# print(f"paramater_32: {paramater_32}")
24+
# if paramater_32[0] != "-1":
25+
# database_connection_query("UPDATE PARAMETERS SET DEFAULT_VALUE = -1 WHERE PARAM_ID = 32")
26+
# database_connection_query("COMMIT")
27+
# paramater_31 = database_connection_query("select DEFAULT_VALUE from PARAMETERS where PARAM_ID = 31")
28+
# print(f"paramater_31: {paramater_31}")
29+
# if paramater_31[0] != "-1":
30+
# database_connection_query("UPDATE PARAMETERS SET DEFAULT_VALUE = -1 WHERE PARAM_ID = 31")
31+
# database_connection_query("COMMIT")
32+
33+
34+
# To Do:
35+
# Create more POM
36+
# Remove as many hard coded timeouts as possible
37+
# Add more fail states
38+
# Add more logging to understand what is going on
39+
# Convert import pages * into 1 line
40+
# Move functions to utils
41+
1842
@pytest.mark.wip
1943
def test_example(page: Page) -> None:
2044
page.goto("/")
2145
BcssLoginPage(page).login_as_user_bcss401()
2246

23-
# Create plan
47+
# 2 - Create plan
2448
MainMenu(page).go_to_call_and_recall_page()
2549
CallAndRecall(page).go_to_planning_and_monitoring_page()
2650
page.get_by_role("link", name="BCS001").click()
2751
page.get_by_role("button", name="Create a Plan").click()
2852
page.get_by_role("link", name="Set all").click()
29-
page.get_by_placeholder("Enter weekly invitation rate").fill("1")
53+
page.get_by_placeholder("Enter daily invitation rate").fill("1")
3054
page.get_by_role("button", name="Update").click()
3155
page.get_by_role("button", name="Confirm").click()
3256
page.get_by_role("link", name="Set all").click()
@@ -54,7 +78,7 @@ def test_example(page: Page) -> None:
5478
# Loop until the table no longer contains "Queued"
5579
while elapsed < timeout:
5680
table_text = page.locator("#displayRS").text_content()
57-
if "Queued" in table_text:
81+
if "Queued" in table_text or "In Progress" in table_text:
5882
# Click the Refresh button
5983
page.get_by_role("button", name="Refresh").click()
6084
page.wait_for_timeout(wait_interval)
@@ -93,7 +117,7 @@ def batch_processing(page: Page, batch_type: str, batch_description: str, latest
93117
if pre_invitation_cells.count() == 0 and batch_description == "Pre-invitation (FIT) (digital leaflet)":
94118
print(f"No S1 Pre-invitation (FIT) (digital leaflet) batch found. Skipping to next step")
95119
return
96-
elif page.locator("td", has_text="No matching records found"):
120+
elif pre_invitation_cells.count() == 0 and page.locator("td", has_text="No matching records found"):
97121
pytest.fail(f"No {batch_type} {batch_description} batch found")
98122

99123
for i in range(pre_invitation_cells.count()):
@@ -147,6 +171,8 @@ def batch_processing(page: Page, batch_type: str, batch_description: str, latest
147171
page.get_by_role("button", name="Confirm Printed").nth(0).click()
148172
page.wait_for_timeout(1000)
149173

174+
# Add wait for batch successfully archived
175+
150176
NavigationBar(page).click_main_menu_link()
151177
MainMenu(page).go_to_communications_production_page()
152178
CommunicationsProduction(page).go_to_archived_batch_list_page()

utils/oracle.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ def database_connection_query(sql: str): # To use when "select a from b"
1919
with connection.cursor() as cursor:
2020
for r in cursor.execute(sql):
2121
print(r)
22+
return r

0 commit comments

Comments
 (0)