Skip to content

Commit 948de75

Browse files
pylint-cp-st
1 parent b4bd56d commit 948de75

6 files changed

Lines changed: 89 additions & 25 deletions

File tree

tests/e2e-test/base/base.py

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,38 @@
1+
"""
2+
Base page module providing common functionality for all page objects.
3+
"""
4+
5+
16
class BasePage:
7+
"""Base class for all page objects with common methods."""
8+
29
def __init__(self, page):
10+
"""
11+
Initialize the BasePage with a Playwright page instance.
12+
13+
Args:
14+
page: Playwright page object
15+
"""
316
self.page = page
417

518
def scroll_into_view(self, locator):
19+
"""
20+
Scroll the last element matching the locator into view.
21+
22+
Args:
23+
locator: Playwright locator object
24+
"""
625
reference_list = locator
726
locator.nth(reference_list.count() - 1).scroll_into_view_if_needed()
827

928
def is_visible(self, locator):
10-
locator.is_visible()
29+
"""
30+
Check if an element is visible on the page.
31+
32+
Args:
33+
locator: Playwright locator object
34+
35+
Returns:
36+
bool: True if visible, False otherwise
37+
"""
38+
return locator.is_visible()

tests/e2e-test/config/constants.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1+
"""
2+
Configuration constants module for test environment settings.
3+
"""
4+
15
import os
26

37
from dotenv import load_dotenv
48

59
load_dotenv()
610
URL = os.getenv("url")
7-
if URL.endswith("/"):
11+
if URL and URL.endswith("/"):
812
URL = URL[:-1]

tests/e2e-test/pages/HomePage.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
"""
2+
Home page module for Content Processing Solution Accelerator.
3+
"""
4+
15
import os.path
26
import logging
37

@@ -8,7 +12,11 @@
812

913

1014
class HomePage(BasePage):
11-
#HOMEPAGE
15+
"""
16+
Home page object containing all locators and methods for interacting
17+
with the Content Processing home page.
18+
"""
19+
# HOMEPAGE
1220
PROCESSING_QUEUE = "//span[normalize-space()='Processing Queue']"
1321
OUTPUT_REVIEW = "//span[normalize-space()='Output Review']"
1422
SOURCE_DOC = "//span[normalize-space()='Source Document']"
@@ -114,6 +122,13 @@ class HomePage(BasePage):
114122
)
115123

116124
def __init__(self, page):
125+
"""
126+
Initialize the HomePage.
127+
128+
Args:
129+
page: Playwright page object
130+
"""
131+
super().__init__(page)
117132
self.page = page
118133

119134
def validate_home_page(self):

tests/e2e-test/pages/loginPage.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1+
"""
2+
Login page module for authentication functionality.
3+
"""
4+
15
from base.base import BasePage
26

37

48
class LoginPage(BasePage):
9+
"""Login page object with authentication methods."""
510

611
EMAIL_TEXT_BOX = "//input[@type='email']"
712
NEXT_BUTTON = "//input[@type='submit']"
@@ -11,9 +16,23 @@ class LoginPage(BasePage):
1116
PERMISSION_ACCEPT_BUTTON = "//input[@type='submit']"
1217

1318
def __init__(self, page):
19+
"""
20+
Initialize the LoginPage.
21+
22+
Args:
23+
page: Playwright page object
24+
"""
25+
super().__init__(page)
1426
self.page = page
1527

1628
def authenticate(self, username, password):
29+
"""
30+
Authenticate user with username and password.
31+
32+
Args:
33+
username: User email address
34+
password: User password
35+
"""
1736
# login with username and password in web url
1837
self.page.locator(self.EMAIL_TEXT_BOX).fill(username)
1938
self.page.locator(self.NEXT_BUTTON).click()

tests/e2e-test/tests/conftest.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import atexit
77
import logging
88
from pathlib import Path
9-
from venv import logger
109

1110
import pytest
1211
from bs4 import BeautifulSoup
@@ -17,6 +16,9 @@
1716
# Global dictionary to store log streams for each test
1817
LOG_STREAMS = {}
1918

19+
# Get logger for this module
20+
logger = logging.getLogger(__name__)
21+
2022

2123
@pytest.fixture(scope="session")
2224
def login_logout():
@@ -115,9 +117,10 @@ def rename_duration_column():
115117
for th in headers:
116118
if th.text.strip() == "Duration":
117119
th.string = "Execution Time"
120+
logger.info("Renamed 'Duration' column to 'Execution Time'")
118121
break
119122
else:
120-
print("'Duration' column not found in report.")
123+
logger.info("'Duration' column not found in report.")
121124

122125
with report_path.open("w", encoding="utf-8") as file:
123126
file.write(str(soup))

tests/e2e-test/tests/test_contentProcessing_gp_tc.py

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
1+
"""
2+
Test module for Content Processing Solution Accelerator end-to-end tests.
3+
"""
4+
15
import logging
2-
import time
36
import pytest
47
from pages.HomePage import HomePage
58

69
logger = logging.getLogger(__name__)
710

811

9-
def _timed_refresh(home):
10-
"""Refresh and wait for processing to complete with timing."""
11-
start = time.time()
12-
home.refresh()
13-
end = time.time()
14-
logger.info(f"Refresh process took {end - start:.2f} seconds")
15-
16-
1712
def test_content_processing_golden_path(login_logout, request):
1813
"""
1914
Content Processing - Validate Golden path works as expected
@@ -48,7 +43,7 @@ def test_content_processing_golden_path(login_logout, request):
4843
try:
4944
action()
5045
logger.info(f"Step passed: {description}")
51-
except Exception:
46+
except Exception: # pylint: disable=broad-exception-caught
5247
logger.error(f"Step failed: {description}", exc_info=True)
5348
raise
5449

@@ -69,7 +64,7 @@ def test_content_processing_sections_display(login_logout, request):
6964
try:
7065
home.validate_home_page()
7166
logger.info("Test passed: All sections displayed properly")
72-
except Exception:
67+
except Exception: # pylint: disable=broad-exception-caught
7368
logger.error("Test failed: All sections display validation", exc_info=True)
7469
raise
7570

@@ -99,7 +94,7 @@ def test_content_processing_file_upload(login_logout, request):
9994
try:
10095
action()
10196
logger.info(f"Step passed: {description}")
102-
except Exception:
97+
except Exception: # pylint: disable=broad-exception-caught
10398
logger.error(f"Step failed: {description}", exc_info=True)
10499
raise
105100

@@ -128,7 +123,7 @@ def test_content_processing_refresh_screen(login_logout, request):
128123
try:
129124
action()
130125
logger.info(f"Step passed: {description}")
131-
except Exception:
126+
except Exception: # pylint: disable=broad-exception-caught
132127
logger.error(f"Step failed: {description}", exc_info=True)
133128
raise
134129

@@ -163,7 +158,7 @@ def test_content_processing_schema_validation(login_logout, request):
163158
try:
164159
action()
165160
logger.info(f"Step passed: {description}")
166-
except Exception:
161+
except Exception: # pylint: disable=broad-exception-caught
167162
logger.error(f"Step failed: {description}", exc_info=True)
168163
raise
169164

@@ -192,7 +187,7 @@ def test_content_processing_import_without_schema(login_logout, request):
192187
try:
193188
action()
194189
logger.info(f"Step passed: {description}")
195-
except Exception:
190+
except Exception: # pylint: disable=broad-exception-caught
196191
logger.error(f"Step failed: {description}", exc_info=True)
197192
raise
198193

@@ -221,7 +216,7 @@ def test_content_processing_delete_file(login_logout, request):
221216
try:
222217
action()
223218
logger.info(f"Step passed: {description}")
224-
except Exception:
219+
except Exception: # pylint: disable=broad-exception-caught
225220
logger.error(f"Step failed: {description}", exc_info=True)
226221
raise
227222

@@ -253,7 +248,7 @@ def test_content_processing_search_functionality(login_logout, request):
253248
try:
254249
action()
255250
logger.info(f"Step passed: {description}")
256-
except Exception:
251+
except Exception: # pylint: disable=broad-exception-caught
257252
logger.error(f"Step failed: {description}", exc_info=True)
258253
raise
259254

@@ -282,7 +277,7 @@ def test_content_processing_collapsible_panels(login_logout, request):
282277
try:
283278
action()
284279
logger.info(f"Step passed: {description}")
285-
except Exception:
280+
except Exception: # pylint: disable=broad-exception-caught
286281
logger.error(f"Step failed: {description}", exc_info=True)
287282
raise
288283

@@ -311,7 +306,7 @@ def test_content_processing_api_documentation(login_logout, request):
311306
try:
312307
action()
313308
logger.info(f"Step passed: {description}")
314-
except Exception:
309+
except Exception: # pylint: disable=broad-exception-caught
315310
logger.error(f"Step failed: {description}", exc_info=True)
316311
raise
317312

@@ -343,7 +338,7 @@ def test_content_processing_expandable_process_steps(login_logout, request):
343338
try:
344339
action()
345340
logger.info(f"Step passed: {description}")
346-
except Exception:
341+
except Exception: # pylint: disable=broad-exception-caught
347342
logger.error(f"Step failed: {description}", exc_info=True)
348343
raise
349344

0 commit comments

Comments
 (0)