Skip to content

Commit 56b9819

Browse files
Working on comments on PR: Feature/smokescreen compartment 1 #6 regarding Oracle connetion
Also removing duplicated lines from the active batch list
1 parent e011412 commit 56b9819

12 files changed

+184
-275
lines changed

pages/archived_batch_list_page.py

Lines changed: 0 additions & 65 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
from playwright.sync_api import Page
1+
from playwright.sync_api import Page, expect
22
from utils.click_helper import click
33

44

5-
class ActiveBatchList:
5+
class BatchList:
66
def __init__(self, page: Page):
77
self.page = page
8-
# Active Batch List - page filters
8+
#Batch List - page filters
99
self.id_filter = self.page.locator("#batchIdFilter")
1010
self.type_filter = self.page.locator("#batchTypeFilter")
1111
self.original_filter = self.page.locator("#originalBatchIdFilter")
@@ -14,44 +14,48 @@ def __init__(self, page: Page):
1414
self.batch_split_by_filter = self.page.locator("#splitByFilter")
1515
self.screening_centre_filter = self.page.locator("#screeningCentreFilter")
1616
self.count_filter = self.page.locator("#countFilter")
17+
self.table_data = self.page.locator("td")
1718
self.batch_successfully_archived_msg = self.page.locator('text="Batch Successfully Archived and Printed"')
1819

20+
def verify_table_data(self, value):
21+
expect(self.table_data.filter(has_text=value)).to_be_visible()
22+
1923
def enter_id_filter(self, search_text: str):
20-
click(self.page, self.id_filter)
2124
self.id_filter.fill(search_text)
2225
self.id_filter.press("Enter")
2326

2427
def enter_type_filter(self, search_text: str):
25-
click(self.page, self.type_filter)
2628
self.type_filter.fill(search_text)
2729
self.type_filter.press("Enter")
2830

2931
def enter_original_filter(self, search_text: str):
30-
click(self.page, self.original_filter)
3132
self.original_filter.fill(search_text)
3233
self.original_filter.press("Enter")
3334

3435
def enter_event_code_filter(self, search_text: str):
35-
click(self.page, self.event_code_filter)
3636
self.event_code_filter.fill(search_text)
3737
self.event_code_filter.press("Enter")
3838

3939
def enter_description_filter(self, search_text: str):
40-
click(self.page, self.description_filter)
4140
self.description_filter.fill(search_text)
4241
self.description_filter.press("Enter")
4342

4443
def enter_batch_split_by_filter(self, search_text: str):
45-
click(self.page, self.batch_split_by_filter)
4644
self.batch_split_by_filter.fill(search_text)
4745
self.batch_split_by_filter.press("Enter")
4846

4947
def enter_screening_centre_filter(self, search_text: str):
50-
click(self.page, self.screening_centre_filter)
5148
self.screening_centre_filter.fill(search_text)
5249
self.screening_centre_filter.press("Enter")
5350

5451
def enter_count_filter(self, search_text: str):
55-
click(self.page, self.count_filter)
5652
self.count_filter.fill(search_text)
5753
self.count_filter.press("Enter")
54+
55+
class ActiveBatchList(BatchList):
56+
def __init__(self, page):
57+
super().__init__(page)
58+
59+
class ArchivedBatchList(BatchList):
60+
def __init__(self, page):
61+
super().__init__(page)

pages/communications_production_page.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ def __init__(self, page: Page):
1010
self.archived_batch_list_page = self.page.get_by_role("link", name="Archived Batch List")
1111
self.letter_library_index_page = self.page.get_by_role("link", name="Letter Library Index")
1212
self.letter_signatory_page = self.page.get_by_role("link", name="Letter Signatory")
13-
self.electronic_communication_management_page = self.page.get_by_role("link",
14-
name="Electronic Communication Management")
13+
self.electronic_communication_management_page = self.page.get_by_role("link", name="Electronic Communication Management")
1514

1615
def go_to_active_batch_list_page(self):
1716
click(self.page, self.active_batch_list_page)

pages/log_devices_page.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,11 @@ def __init__(self, page: Page):
1212
self.save_and_log_device_button = self.page.get_by_role("button", name="Save and Log Device")
1313
self.device_spoilt_button = self.page.get_by_role("button", name="Device Spoilt")
1414
self.sample_date_field = self.page.locator("#sampleDate")
15-
self.successfully_logged_device_text = self.page.get_by_text("Successfully logged device")
15+
self.successfully_logged_device_text = self.page.get_by_text("×Successfully logged device")
1616
self.spoilt_device_dropdown = self.page.get_by_label("Spoil reason drop down")
1717
self.log_as_spoilt_button = self.page.get_by_role("button", name="Log as Spoilt")
1818

1919
def fill_fit_device_id_field(self, value):
20-
click(self.page, self.fit_device_id_field)
2120
self.fit_device_id_field.fill(value)
2221
self.fit_device_id_field.press("Enter")
2322

@@ -28,7 +27,6 @@ def click_device_spoilt_button(self):
2827
click(self.page, self.device_spoilt_button)
2928

3029
def fill_sample_date_field(self, value):
31-
click(self.page, self.sample_date_field)
3230
self.sample_date_field.fill(value)
3331
self.sample_date_field.press("Enter")
3432

tests/test_bcss_19181_users_permit_list.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import pytest
22
from playwright.sync_api import Page
33
from utils.user_tools import UserTools
4-
from pages import (login_page as login, bcss_home_page as bcss_home, navigation_bar_links as nav_bar_links,
5-
log_out_page as logout, login_failure_screen as login_failure)
6-
from utils.oracle import OracleDB
4+
from pages import (login_page as login, bcss_home_page as bcss_home, navigation_bar_links as nav_bar_links, log_out_page as logout, login_failure_screen as login_failure)
5+
from utils.oracle.oracle import OracleDB
76

87

98
@pytest.fixture(scope="function", autouse=True)

tests/test_home_page_links.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ def test_home_page_links_navigation(page: Page) -> None:
5252
# Click the refresh alerts link
5353
homepage.click_refresh_alerts_link()
5454
# Verify that the 'last updated' timestamp matches the current date and time
55-
(expect(page.locator("form[name=\"refreshCockpit\"]")).to_contain_text
56-
("Refresh alerts (last updated :" + DateTimeUtils.current_datetime()))
55+
(expect(page.locator("form[name=\"refreshCockpit\"]")).to_contain_text("Refresh alerts (last updated :" + DateTimeUtils.current_datetime()))
5756

5857
# Click the user guide link
5958
with page.expect_popup() as page1_info:

utils/batch_processing.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
from pages.navigation_bar_links import NavigationBar
22
from pages.bcss_home_page import MainMenu
33
from pages.communications_production_page import CommunicationsProduction
4-
from pages.active_batch_list_page import ActiveBatchList
54
from pages.manage_active_batch_page import ManageActiveBatch
6-
from pages.archived_batch_list_page import ArchivedBatchList
5+
from pages.batch_list_page import ActiveBatchList, ArchivedBatchList
76
from utils.screening_subject_page_searcher import verify_subject_event_status_by_nhs_no
8-
from utils.get_nhs_no_from_batch_id import get_nhs_no_from_batch_id
9-
from utils.oracle import OracleDB
7+
from utils.oracle.oracle_specific_functions import get_nhs_no_from_batch_id
8+
from utils.oracle.oracle import OracleDB
109
import os
1110
import pytest
1211
from playwright.sync_api import Page
1312
import logging
1413

1514

16-
def batch_processing(page: Page, batch_type: str, batch_description: str, latest_event_status: str,
17-
run_timed_events: bool = False) -> None:
15+
def batch_processing(page: Page, batch_type: str, batch_description: str, latest_event_status: str, run_timed_events: bool = False) -> None:
1816
"""
1917
This util is used to process batches. It expects the following inputs:
2018
- page: This is playwright page variable
@@ -88,6 +86,7 @@ def batch_processing(page: Page, batch_type: str, batch_description: str, latest
8886

8987
try:
9088
ActiveBatchList(page).batch_successfully_archived_msg.wait_for()
89+
9190
logging.info(f"Batch {link_text} successfully archived")
9291
except Exception as e:
9392
pytest.fail(f"Batch successfully archived message is not shown: {str(e)}")

utils/fit_kit_generation.py

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from oracle import OracleDB
1+
from utils.oracle.oracle_specific_functions import get_kit_id_from_db
22
import pandas as pd
33
from datetime import datetime
44
import logging
@@ -10,25 +10,6 @@ def create_fit_id_df():
1010
df["fit_device_id"] = df["fit_device_id"].apply(convert_kit_id_to_fit_device_id)
1111
return df
1212

13-
14-
def get_kit_id_from_db():
15-
logging.info("Retrieving useable test kit ids")
16-
kit_id_df = OracleDB().execute_query("""select tk.kitid, tk.screening_subject_id, sst.subject_nhs_number
17-
from tk_items_t tk
18-
inner join ep_subject_episode_t se on se.screening_subject_id = tk.screening_subject_id
19-
inner join screening_subject_t sst on (sst.screening_subject_id = tk.screening_subject_id)
20-
inner join sd_contact_t sdc on (sdc.nhs_number = sst.subject_nhs_number)
21-
where tk.tk_type_id = 2
22-
and tk.logged_in_flag = 'N'
23-
and sdc.hub_id = 23159
24-
and device_id is null
25-
and tk.invalidated_date is null
26-
and se.latest_event_status_id in (11198, 11213)
27-
fetch first 10 rows only""")
28-
29-
return kit_id_df
30-
31-
3213
def calculate_check_digit(kitID: str):
3314
logging.info(f"Calculating check digit for kit id: {kitID}")
3415
total = 0
@@ -38,7 +19,6 @@ def calculate_check_digit(kitID: str):
3819
check_digit = charString[total % 43]
3920
return f"{kitID}-{check_digit}"
4021

41-
4222
def convert_kit_id_to_fit_device_id(kit_id: str):
4323
logging.info(f"Generating FIT Device ID from: {kit_id}")
4424
today = datetime.now()

utils/get_nhs_no_from_batch_id.py

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)