auto-added

This commit is contained in:
2026-08-30 18:34:41 +03:00
parent c5e0213c74
commit e2022c2dae
4 changed files with 545 additions and 31 deletions
+111
View File
@@ -0,0 +1,111 @@
import pytest
import allure
from playwright.sync_api import Page, expect
@pytest.mark.login_page
class TestLoginPageAccessibility:
"""Anonymized accessibility checks from an enterprise Playwright project."""
def _check_accessibility(self, login_page_devices, accessibility_checker):
login_page_devices.wait_for_load_state("networkidle")
accessibility_checker.check(login_page_devices)
@pytest.mark.axe
def test_accessibility_login_page(
self,
login_page_devices: Page,
accessibility_checker,
):
with allure.step("Check login page accessibility"):
self._check_accessibility(login_page_devices, accessibility_checker)
@pytest.mark.axe
def test_accessibility_password_recovery(
self,
login_page_devices: Page,
login_page_object,
accessibility_checker,
):
with allure.step("Open password recovery form"):
login_page_object.forgot_password_link.click()
with allure.step("Check password recovery accessibility"):
self._check_accessibility(login_page_devices, accessibility_checker)
@pytest.mark.axe
def test_accessibility_security_questions(
self,
login_page_devices: Page,
login_page_object,
security_questions_user,
accessibility_checker,
):
with allure.step("Open password recovery form"):
login_page_object.forgot_password_link.click()
with allure.step("Fill login and email"):
login_page_object.login_field.fill(security_questions_user.login)
login_page_object.email_field.fill(security_questions_user.email)
with allure.step("Submit password recovery request"):
login_page_object.next_btn.click()
with allure.step("Check security questions accessibility"):
self._check_accessibility(login_page_devices, accessibility_checker)
@pytest.mark.axe
@pytest.mark.parametrize(
"username,password,expected_error",
[
pytest.param(
"valid_user",
"invalid_password",
"Unable to logon with specified login and password",
id="invalid-password",
),
pytest.param(
"",
"valid_password",
"Form validation failed",
id="empty-username",
),
],
)
def test_accessibility_login_error_state(
self,
login_page_devices: Page,
login_page_object,
accessibility_checker,
username: str,
password: str,
expected_error: str,
):
with allure.step("Fill login and password"):
login_page_object.login_field.fill(username)
login_page_object.password_field.fill(password)
with allure.step("Submit login form"):
login_page_object.logon_btn.click()
with allure.step("Check error message"):
expect(login_page_devices.get_by_text(expected_error)).to_contain_text(
expected_error
)
with allure.step("Check error state accessibility"):
self._check_accessibility(login_page_devices, accessibility_checker)
@pytest.mark.axe
def test_accessibility_dark_theme(
self,
login_page_devices: Page,
accessibility_checker,
):
with allure.step("Switch to dark theme"):
login_page_devices.locator("html").evaluate(
"element => element.className = 'dark'"
)
with allure.step("Check dark theme accessibility"):
self._check_accessibility(login_page_devices, accessibility_checker)