first
This commit is contained in:
commit
fa9d154db9
260 files changed
+17643
No files matched your search
@@ -0,0 +1,31 @@
|
||||
import re
|
||||
|
||||
from playwright.sync_api import expect
|
||||
from tests.e2e.pages.base import BasePage
|
||||
|
||||
|
||||
class CustomerNewTicketPage(BasePage):
|
||||
def __init__(self, page, live_server_url: str):
|
||||
super().__init__(page, live_server_url)
|
||||
self.unit=page.locator("[data-ticket-unit]")
|
||||
self.category=page.locator("[data-ticket-category]")
|
||||
|
||||
def open(self):
|
||||
self.goto("/tickets/new/")
|
||||
expect(self.unit).to_be_visible()
|
||||
|
||||
def select_unit(self, unit_id: int, expected_category: str):
|
||||
with self.page.expect_response(lambda response: "/tickets/new/options/" in response.url and response.ok):
|
||||
self.unit.select_option(str(unit_id))
|
||||
expect(self.category.locator("option", has_text=expected_category)).to_have_count(1)
|
||||
|
||||
def search_and_choose(self, query: str, category_name: str):
|
||||
self.page.locator("[data-ticket-search]").fill(query)
|
||||
result=self.page.get_by_role(
|
||||
"button", name=re.compile(rf"^{re.escape(category_name)}")
|
||||
)
|
||||
expect(result).to_be_visible()
|
||||
result.click()
|
||||
option = self.category.get_by_role("option", name=category_name, exact=True)
|
||||
expect(option).to_have_count(1)
|
||||
expect(self.category).to_have_value(option.get_attribute("value"))
|
||||
Reference in new issue
Block a user