Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 1 addition & 22 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
[build-system]
build-backend = "hatchling.build"
requires = ["hatchling"]

[dependency-groups]
dev = [
"ruff==0.11.8",
"pre-commit==4.2.0"
]

[project]
authors = [{name = "nirtal85", email = "nirt236@gmail.com"}]
dependencies = [
"allure-pytest==2.14.1",
"axe-playwright-python==0.1.4",
Expand All @@ -21,28 +16,12 @@ dependencies = [
"requests==2.32.3"
]
description = "Playwright Python example project with pytest and Allure report"
keywords = [
"playwright",
"automation",
"testing",
"web"
]
name = "playwright-python"
readme = "README.md"
requires-python = "~=3.11"
version = "0.1.0"

[tool.hatch.build.targets.sdist]
include = ["playwright_python"]

[tool.hatch.build.targets.wheel]
include = ["playwright_python"]

[tool.isort]
profile = "black"
skip = ["env", "venv"]

[tool.pytest.ini_options]
pythonpath = ["src"]
addopts = [
"--clean-alluredir",
"--alluredir=allure-results",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion pages/login_page.py → src/pages/login_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import allure
from playwright.sync_api import Page

from enums import User
from src.enums import User


@allure.severity(allure.severity_level.CRITICAL)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions tests/accesability_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

class TestAccessibility:
@allure.title("Test Accessibility with Default Counts")
def test_accessibility_default_counts(self, axe_playwright, page):
def test_accessibility_default_counts(self, axe_playwright, page) -> None:
axe_playwright.check_accessibility(page)

@allure.title("Test Accessibility with Custom Counts")
def test_accessibility_custom_counts(self, axe_playwright, page):
def test_accessibility_custom_counts(self, axe_playwright, page) -> None:
axe_playwright.check_accessibility(
page,
maximum_allowed_violations_by_impact={
Expand Down
4 changes: 2 additions & 2 deletions tests/checkout_test.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import pytest
from playwright.sync_api import Page, expect

from enums.User import User
from src.enums.User import User


class TestCheckout:
@pytest.mark.parametrize("browser_context_args", [User.STANDARD_USER], indirect=True)
def test_checkout_counter(self, browser_context_args, page: Page):
def test_checkout_counter(self, browser_context_args, page: Page) -> None:
page.evaluate("localStorage.setItem('cart-contents', '[4,0]');")
page.reload()
expect(page.get_by_test_id("shopping-cart-badge")).to_have_text("2")
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from axe_playwright_python.sync_playwright import Axe
from playwright.sync_api import Page, Playwright

from utilities.axe_helper import AxeHelper
from utilities.constants import Constants
from src.utilities.axe_helper import AxeHelper
from src.utilities.constants import Constants


@pytest.fixture(scope="function", autouse=True)
Expand Down
4 changes: 2 additions & 2 deletions tests/inventory_test.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import pytest
from playwright.sync_api import Page, expect

from enums.User import User
from src.enums.User import User


class TestInventory:
@pytest.mark.parametrize("browser_context_args", [User.STANDARD_USER], indirect=True)
def test_inventory_page(self, browser_context_args, page: Page):
def test_inventory_page(self, browser_context_args, page: Page) -> None:
expect(page.get_by_test_id("title")).to_have_text("Products")
8 changes: 4 additions & 4 deletions tests/login_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import pytest
from playwright.sync_api import Page, expect

from enums.User import User
from pages.login_page import LoginPage
from src.enums.User import User
from src.pages.login_page import LoginPage


class TestLogin:
Expand All @@ -13,7 +13,7 @@ def setup(self, page: Page):

@pytest.mark.devRun
@allure.title("Login with valid credentials test")
def test_valid_login(self, base_url, page: Page):
def test_valid_login(self, base_url, page: Page) -> None:
self.login_page.login(User.STANDARD_USER, "secret_sauce")
expect(page).to_have_url(f"{base_url}inventory.html")

Expand All @@ -34,6 +34,6 @@ def test_valid_login(self, base_url, page: Page):
ids=["invalid_password", "locked_user"],
)
@allure.title("Login with invalid credentials test")
def test_login_error(self, page: Page, username: str, password: str, expected_error: str):
def test_login_error(self, page: Page, username: str, password: str, expected_error: str) -> None:
self.login_page.login(username, password)
expect(self.login_page.error_message).to_have_text(expected_error)
Loading