Skip to content

Commit dae72af

Browse files
Addressing PR comments
1 parent d0aff55 commit dae72af

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

tests/regression/subject/episodes/datasets/investigation/endoscopy/polypcategories/test_advanced_colorectal_polyp.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import logging
22
import pytest
33
import pandas as pd
4-
from _pytest.fixtures import FixtureRequest
4+
from pytest import FixtureRequest
55
from datetime import datetime
66
from playwright.sync_api import Page
77
from classes.subject import Subject
@@ -103,6 +103,9 @@
103103

104104
@pytest.fixture(autouse=True)
105105
def before_test(page: Page, request: FixtureRequest) -> None:
106+
"""
107+
Before each test this will get the relevant subject and navigate to their investigation dataset
108+
"""
106109
if request.node.get_closest_marker("skip_before_test"):
107110
return
108111
df = obtain_test_data()
@@ -1174,6 +1177,9 @@ def assert_test_results(page: Page, expected_size: str) -> None:
11741177
"""
11751178
This function asserts that the polyp algorithm size and category match the expected values.
11761179
"""
1180+
logging.info(
1181+
f"Asserting test results\nExpected result: Abnormal\nExpected size: {expected_size}\nExpected category: Advanced colorectal polyp"
1182+
)
11771183
InvestigationDatasetsPage(page).expect_text_to_be_visible("Abnormal")
11781184
InvestigationDatasetsPage(page).assert_polyp_alogrithm_size(1, expected_size)
11791185
InvestigationDatasetsPage(page).assert_polyp_categrory(
@@ -1184,5 +1190,6 @@ def assert_test_results(page: Page, expected_size: str) -> None:
11841190
InvestigationDatasetsPage(page).click_save_dataset_button()
11851191
InvestigationDatasetsPage(page).assert_polyp_alogrithm_size(1, None)
11861192
InvestigationDatasetsPage(page).assert_polyp_categrory(1, None)
1193+
logging.info("Test results asserted successfully.")
11871194

11881195
LogoutPage(page).log_out()

utils/investigation_dataset.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ def complete_dataset_with_args(
341341
polyp_1_intervention (Optional[dict]): An optional dictionary containing the polyp 1 intervention to be filled in the form.
342342
polyp_1_histology (Optional[dict]): An optional dictionary containing the polyp 1 histology to be filled in the form.
343343
"""
344+
logging.info("Completing investigation dataset with the provided dictionaries")
344345
# Investigation Dataset
345346
InvestigationDatasetsPage(self.page).select_site_lookup_option_index(
346347
general_information["site"]
@@ -366,17 +367,20 @@ def complete_dataset_with_args(
366367
# Drug Information
367368
InvestigationDatasetsPage(self.page).click_show_drug_information()
368369
if drug_information.get("drug_type1"):
370+
logging.info("Filling out drug information")
369371
InvestigationDatasetsPage(self.page).select_drug_type_option1(
370372
drug_information["drug_type1"]
371373
)
372374
InvestigationDatasetsPage(self.page).fill_drug_type_dose1(
373375
drug_information["drug_dose1"]
374376
)
375377

378+
logging.info("Filling out endoscopy information")
376379
self.fill_endoscopy_information(endoscopy_information)
377380

378381
# Completion Proof Information
379382
if completion_information:
383+
logging.info("Filling out completion proof information")
380384
InvestigationDatasetsPage(
381385
self.page
382386
).click_show_completion_proof_information()
@@ -385,6 +389,7 @@ def complete_dataset_with_args(
385389
)
386390

387391
# Failure Information
392+
logging.info("Filling out failure information")
388393
InvestigationDatasetsPage(self.page).click_show_failure_information()
389394
DatasetFieldUtil(self.page).populate_select_locator_for_field_inside_div(
390395
self.failure_reasons_string,
@@ -393,14 +398,18 @@ def complete_dataset_with_args(
393398
)
394399

395400
if polyp_1_information:
401+
logging.info("Filling out polyp 1 information")
396402
self.fill_polyp_1_information(polyp_1_information)
397403

398404
if polyp_1_intervention:
405+
logging.info("Filling out polyp 1 intervention")
399406
self.fill_polyp_1_intervention(polyp_1_intervention)
400407

401408
if polyp_1_histology:
409+
logging.info("Filling out polyp 1 histology")
402410
self.fill_polyp_1_histology(polyp_1_histology)
403411

412+
logging.info("Saving the investigation dataset")
404413
InvestigationDatasetsPage(self.page).check_dataset_complete_checkbox()
405414
InvestigationDatasetsPage(self.page).click_save_dataset_button()
406415

0 commit comments

Comments
 (0)