Skip to content

Commit cc15915

Browse files
fixed pylint issues
1 parent dc4f784 commit cc15915

10 files changed

Lines changed: 45 additions & 61 deletions

File tree

.github/workflows/test-automation.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ on:
1313
workflow_dispatch:
1414

1515
env:
16-
url: ${{ vars.CODEGEN_WEB_URL }}
16+
# url: ${{ vars.CODEGEN_WEB_URL }}
17+
url: https://cm3ydcorjzov5mfrontend.greencliff-0258c52e.uksouth.azurecontainerapps.io
1718
accelerator_name: "Code Modernization"
1819

1920
jobs:

TestAutomation/base/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
from . import base

TestAutomation/base/base.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
1-
from config.constants import *
2-
from dotenv import load_dotenv
3-
4-
51
class BasePage:
62
def __init__(self, page):
73
self.page = page
84

9-
def scroll_into_view(self,locator):
5+
def scroll_into_view(self, locator):
106
reference_list = locator
11-
locator.nth(reference_list.count()-1).scroll_into_view_if_needed()
7+
locator.nth(reference_list.count() - 1).scroll_into_view_if_needed()
128

13-
def is_visible(self,locator):
9+
def is_visible(self, locator):
1410
locator.is_visible()
15-
16-

TestAutomation/config/constants.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
from dotenv import load_dotenv
21
import os
3-
import json
2+
3+
from dotenv import load_dotenv
44

55
load_dotenv()
6-
URL = os.getenv('url')
7-
if URL.endswith('/'):
6+
URL = os.getenv("url")
7+
if URL.endswith("/"):
88
URL = URL[:-1]
9-
10-
11-
12-

TestAutomation/pages/HomePage.py

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
import os.path
2+
13
from base.base import BasePage
4+
25
from playwright.sync_api import expect
3-
import os.path
6+
47

58
class HomePage(BasePage):
69
TITLE_TEXT = "//h1[normalize-space()='Modernize your code']"
@@ -15,8 +18,6 @@ class HomePage(BasePage):
1518
SUMMARY = "//span[normalize-space()='Summary']"
1619
FILE_PROCESSED_MSG = "//span[normalize-space()='3 files processed successfully']"
1720

18-
19-
2021
def __init__(self, page):
2122
self.page = page
2223

@@ -27,28 +28,28 @@ def upload_files(self):
2728
with self.page.expect_file_chooser() as fc_info:
2829
self.page.locator(self.BROWSE_FILES).click()
2930
self.page.wait_for_timeout(5000)
30-
self.page.wait_for_load_state('networkidle')
31+
self.page.wait_for_load_state("networkidle")
3132
file_chooser = fc_info.value
3233
current_working_dir = os.getcwd()
33-
file_path1 = os.path.join(current_working_dir,"testdata/q1_informix.sql")
34-
file_path2 = os.path.join(current_working_dir,"testdata/f1.sql")
35-
file_path3 = os.path.join(current_working_dir,"testdata/f2.sql")
34+
file_path1 = os.path.join(current_working_dir, "testdata/q1_informix.sql")
35+
file_path2 = os.path.join(current_working_dir, "testdata/f1.sql")
36+
file_path3 = os.path.join(current_working_dir, "testdata/f2.sql")
3637
file_chooser.set_files([file_path1, file_path2, file_path3])
3738
self.page.wait_for_timeout(10000)
38-
self.page.wait_for_load_state('networkidle')
39+
self.page.wait_for_load_state("networkidle")
3940
expect(self.page.locator(self.SUCCESS_MSG)).to_be_visible()
4041

4142
def upload_unsupported_files(self):
4243
with self.page.expect_file_chooser() as fc_info:
4344
self.page.locator(self.BROWSE_FILES).click()
4445
self.page.wait_for_timeout(5000)
45-
self.page.wait_for_load_state('networkidle')
46+
self.page.wait_for_load_state("networkidle")
4647
file_chooser = fc_info.value
4748
current_working_dir = os.getcwd()
48-
file_path = os.path.join(current_working_dir,"testdata/invalid.py")
49+
file_path = os.path.join(current_working_dir, "testdata/invalid.py")
4950
file_chooser.set_files([file_path])
5051
self.page.wait_for_timeout(4000)
51-
self.page.wait_for_load_state('networkidle')
52+
self.page.wait_for_load_state("networkidle")
5253
expect(self.page.locator(self.TRANSLATE_BTN)).to_be_disabled()
5354

5455
def validate_translate(self):
@@ -72,16 +73,3 @@ def validate_download_files(self):
7273
self.page.locator(self.RETURN_HOME).click()
7374
self.page.wait_for_timeout(3000)
7475
expect(self.page.locator(self.TITLE_TEXT)).to_be_visible()
75-
76-
77-
78-
79-
80-
81-
82-
83-
84-
85-
86-
87-

TestAutomation/pages/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +0,0 @@
1-
from. import loginPage
2-
from. import HomePage

TestAutomation/pages/loginPage.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ class LoginPage(BasePage):
1313
def __init__(self, page):
1414
self.page = page
1515

16-
def authenticate(self, username,password):
16+
def authenticate(self, username, password):
1717
# login with username and password in web url
1818
self.page.locator(self.EMAIL_TEXT_BOX).fill(username)
1919
self.page.locator(self.NEXT_BUTTON).click()
2020
# Wait for the password input field to be available and fill it
21-
self.page.wait_for_load_state('networkidle')
21+
self.page.wait_for_load_state("networkidle")
2222
# Enter password
2323
self.page.locator(self.PASSWORD_TEXT_BOX).fill(password)
2424
# Click on SignIn button
@@ -33,4 +33,4 @@ def authenticate(self, username,password):
3333
self.page.locator(self.YES_BUTTON).click()
3434
self.page.wait_for_timeout(10000)
3535
# Wait for the "Articles" button to be available and click it
36-
self.page.wait_for_load_state('networkidle')
36+
self.page.wait_for_load_state("networkidle")

TestAutomation/testdata/invalid.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
from . import base

TestAutomation/tests/conftest.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
from pathlib import Path
2-
import pytest
1+
import os
2+
3+
from config.constants import URL
4+
35
from playwright.sync_api import sync_playwright
4-
from config.constants import *
5-
from py.xml import html # type: ignore
66

7+
from py.xml import html # type: ignore
8+
9+
import pytest
710

811

912
@pytest.fixture(scope="session")
@@ -16,7 +19,7 @@ def login_logout():
1619
page = context.new_page()
1720
# Navigate to the login URL
1821
page.goto(URL, wait_until="domcontentloaded")
19-
22+
2023
yield page
2124
# perform close the browser
2225
browser.close()
@@ -31,8 +34,12 @@ def pytest_html_report_title(report):
3134
def pytest_html_results_table_header(cells):
3235
cells.insert(1, html.th("Description"))
3336

37+
3438
def pytest_html_results_table_row(report, cells):
35-
cells.insert(1, html.td(report.description if hasattr(report, "description") else ""))
39+
cells.insert(
40+
1, html.td(report.description if hasattr(report, "description") else "")
41+
)
42+
3643

3744
# Add logs and docstring to report
3845
@pytest.hookimpl(hookwrapper=True)
@@ -41,6 +48,5 @@ def pytest_runtest_makereport(item, call):
4148
report = outcome.get_result()
4249
report.description = str(item.function.__doc__)
4350
os.makedirs("logs", exist_ok=True)
44-
extra = getattr(report, 'extra', [])
51+
extra = getattr(report, "extra", [])
4552
report.extra = extra
46-

TestAutomation/tests/test_codegen_gp_tc.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1-
from pages.HomePage import HomePage
2-
from config.constants import *
31
import logging
4-
import pytest
52
import time
63

4+
from pages.HomePage import HomePage
5+
6+
import pytest
7+
8+
79
logger = logging.getLogger(__name__)
810

11+
912
@pytest.mark.testcase_id("TC001")
1013
def test_CodeGen_Golden_path_test(login_logout):
11-
"""Validate Golden path test case for Modernize your code Accelerator """
14+
"""Validate Golden path test case for Modernize your code Accelerator"""
1215
page = login_logout
1316
home_page = HomePage(page)
1417
logger.info("Step 1: Validate home page is loaded.")

0 commit comments

Comments
 (0)