From 3d138ff3ed02c46e226a2d8c2d337ae5e9fe32e7 Mon Sep 17 00:00:00 2001 From: samihamuhabathulla-jpg Date: Sun, 14 Jun 2026 20:46:39 +0530 Subject: [PATCH 1/4] Rename test marker from ShopByCategory to Samiha --- tests/test_shopbycategory.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_shopbycategory.py b/tests/test_shopbycategory.py index a551028..0d0344e 100644 --- a/tests/test_shopbycategory.py +++ b/tests/test_shopbycategory.py @@ -4,7 +4,7 @@ logger = get_logger(__name__) -@pytest.mark.ShopByCategory +@pytest.mark.Samiha class TestShopByCategory: @pytest.mark.parametrize( @@ -25,4 +25,4 @@ def test_category_navigation(self, driver, category, expected_title): action.select_category(category) actual_title = action.get_page_title() - assert expected_title in actual_title \ No newline at end of file + assert expected_title in actual_title From 9137032d083b6726fecea0ec92775876d68eecf3 Mon Sep 17 00:00:00 2001 From: win Date: Sun, 14 Jun 2026 21:34:17 +0530 Subject: [PATCH 2/4] Enhanced shopbycategory --- actions/ShopbycategoryAction.py | 24 ++++++++++-------------- pages/ShopbyCategoryPage.py | 2 +- tests/test_checkout.py | 3 ++- tests/test_shopbycategory.py | 2 +- 4 files changed, 14 insertions(+), 17 deletions(-) diff --git a/actions/ShopbycategoryAction.py b/actions/ShopbycategoryAction.py index 4781317..5e9340c 100644 --- a/actions/ShopbycategoryAction.py +++ b/actions/ShopbycategoryAction.py @@ -1,5 +1,6 @@ from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC +import os from pages.ShopbyCategoryPage import ShopByCategoryPage from utils.loggerCreator import get_logger @@ -14,29 +15,26 @@ def __init__(self, driver): self.wait = WebDriverWait(driver, 20) def launch_url(self, url): - try: logger.info(f"Launching URL: {url}") self.driver.get(url) - self.driver.maximize_window() + + is_headless = os.getenv("CI", "").lower() == "true" + if not is_headless: + self.driver.maximize_window() logger.info("Application launched successfully") except Exception as e: - logger.error( f"Failed to launch application: {e}") + logger.error(f"Failed to launch application: {e}") raise def click_shop_by_category(self): - try: logger.info("Clicking Shop By Category menu") - element = self.wait.until( - EC.element_to_be_clickable( - self.page.SHOP_BY_CATEGORY_MENU - ) - ) - - element.click() + element = self.wait.until(EC.presence_of_element_located(self.page.SHOP_BY_CATEGORY_MENU)) + self.driver.execute_script("arguments[0].scrollIntoView(true);", element) + self.driver.execute_script("arguments[0].click();", element) logger.info("Successfully clicked Shop By Category menu") except Exception as e: @@ -44,7 +42,6 @@ def click_shop_by_category(self): raise def select_category(self, category): - try: logger.info(f"Selecting category: {category}") @@ -73,10 +70,9 @@ def select_category(self, category): raise def get_page_title(self): - try: title = self.driver.title - logger.info( f"Page title fetched successfully: {title}") + logger.info(f"Page title fetched successfully: {title}") return title except Exception as e: logger.error(f"Unable to fetch page title: {e}") diff --git a/pages/ShopbyCategoryPage.py b/pages/ShopbyCategoryPage.py index 87b1c2c..7cf0db8 100644 --- a/pages/ShopbyCategoryPage.py +++ b/pages/ShopbyCategoryPage.py @@ -2,7 +2,7 @@ class ShopByCategoryPage: - SHOP_BY_CATEGORY_MENU = (By.XPATH, "//a[contains(.,'Shop by Category')]") + SHOP_BY_CATEGORY_MENU = (By.XPATH, "//button[contains(.,'Shop by Category')] | //a[contains(.,'Shop by Category')]") DESKTOPS_CATEGORY = (By.XPATH, "//span[@class='title' and normalize-space()='Desktops and Monitors']") CAMERAS = (By.LINK_TEXT, "Web Cameras") TABLETS = (By.LINK_TEXT, "Phone, Tablets & Ipod") diff --git a/tests/test_checkout.py b/tests/test_checkout.py index 6d23631..13ac064 100644 --- a/tests/test_checkout.py +++ b/tests/test_checkout.py @@ -49,7 +49,8 @@ def test_register_checkout(self, driver): action.select_register_account() - data = get_registration_data("D:\Pytest_Automation_Project\data_provider\DataProvider.xlsx", "Registration") + + data = get_registration_data(r"D:\Pytest_Automation_Project\data_provider\DataProvider.xlsx", "Registration") action.enter_registration_details(data) action.agree_to_privacy_policy() diff --git a/tests/test_shopbycategory.py b/tests/test_shopbycategory.py index a551028..9b9e0ab 100644 --- a/tests/test_shopbycategory.py +++ b/tests/test_shopbycategory.py @@ -4,7 +4,7 @@ logger = get_logger(__name__) -@pytest.mark.ShopByCategory +@pytest.mark.Samiha class TestShopByCategory: @pytest.mark.parametrize( From c421695a7c836a92e4bc905959c68e55212ed405 Mon Sep 17 00:00:00 2001 From: samihamuhabathulla-jpg Date: Mon, 15 Jun 2026 10:10:16 +0530 Subject: [PATCH 3/4] Change default browser from Chrome to Firefox --- configuration/config.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configuration/config.ini b/configuration/config.ini index 5521500..31e53f8 100644 --- a/configuration/config.ini +++ b/configuration/config.ini @@ -1,5 +1,5 @@ [browser] -browser = chrome +browser = firefox mode = normal From 46ee8f67cb130f0e29940ae48c741a4b9d90e905 Mon Sep 17 00:00:00 2001 From: TAMIL KUMAR E <153970943+TAMILKUMAR0027@users.noreply.github.com> Date: Mon, 15 Jun 2026 16:31:04 +0530 Subject: [PATCH 4/4] Update config.ini --- configuration/config.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configuration/config.ini b/configuration/config.ini index d11fc2d..e60686a 100644 --- a/configuration/config.ini +++ b/configuration/config.ini @@ -1,5 +1,5 @@ [browser] -browser = firefox +browser = chrome mode = headless mode = normal