Files
customerTicket/tests/e2e/pages/customer_login_access.py
T
2026-10-14 12:27:55 +03:30

26 lines
1.1 KiB
Python

from django.urls import reverse
from playwright.sync_api import expect
from tests.e2e.pages.auth import AuthenticationPage
class CustomerLoginAccessPage(AuthenticationPage):
def request_otp(self, mobile):
self.goto(reverse("accounts:login"))
self.page.get_by_label("شماره موبایل").fill(mobile)
self.page.get_by_role("button", name="دریافت کد یک‌بارمصرف").click()
def assert_block_reason(self, reason):
alert = self.page.get_by_role("alert")
expect(alert).to_contain_text("ورود به حساب شما مسدود است")
expect(alert).to_contain_text(reason)
expect(alert).to_be_visible()
assert alert.locator(".customer-login-block-reason").evaluate(
"node => getComputedStyle(node).color"
) == "rgb(153, 27, 27)"
assert self.page.evaluate("document.documentElement.scrollWidth <= innerWidth + 1")
def assert_logged_out(self, reason):
expect(self.page).to_have_url(self.url(reverse("accounts:login")), timeout=20000)
self.assert_block_reason(reason)