Files
customerTicket/tests/e2e/pages/auth.py
T
2026-09-10 11:34:19 +03:30

21 lines
952 B
Python

from django.urls import reverse
from playwright.sync_api import expect
from tests.e2e.pages.base import BasePage
class AuthenticationPage(BasePage):
def login_customer(self, customer, password):
self.goto(reverse("accounts:password_login"))
self.page.locator('input[name="mobile"]').fill(customer.local_mobile)
self.page.locator('input[name="password"]').fill(password)
self.page.get_by_role("button", name="ورود به حساب").click()
expect(self.page).to_have_url(self.url(reverse("tickets:list")))
def login_staff(self, staff, password):
self.goto(reverse("accounts:staff_login"))
self.page.locator('input[name="username"]').fill(staff.username)
self.page.locator('input[name="password"]').fill(password)
self.page.get_by_role("button", name="ورود به میز کار").click()
expect(self.page).to_have_url(self.url(reverse("staff_tickets:list")))