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")))