fix sms and ticket user frindly
This commit is contained in:
1 parent
1ee83374fd
commit
b8b3aba855
30 files changed
+2220
-119
No files matched your search
@@ -37,7 +37,8 @@ class TicketConversationPage(BasePage):
|
||||
class PublicTicketCreatePage(BasePage):
|
||||
def open(self):
|
||||
self.goto("/tickets/new/")
|
||||
expect(self.unit).to_be_visible()
|
||||
expect(self.page.locator('[data-wizard-step="1"]')).to_be_visible()
|
||||
expect(self.page.locator('[data-ticket-subject]')).to_be_visible()
|
||||
|
||||
@property
|
||||
def unit(self):
|
||||
@@ -66,7 +67,10 @@ class PublicTicketCreatePage(BasePage):
|
||||
and f"unit={unit_id}" in response.url
|
||||
and response.status == 200
|
||||
) as response_info:
|
||||
self.unit.select_option(unit_id)
|
||||
self.unit.evaluate(
|
||||
"(node, value) => { node.value = value; node.dispatchEvent(new Event('change', {bubbles: true})); }",
|
||||
unit_id,
|
||||
)
|
||||
payload = response_info.value.json()
|
||||
expect(self.page.locator("[data-general-queue]")).to_have_attribute("data-unit-id", unit_id)
|
||||
expected_ids = {str(item["id"]) for item in payload["experts"]}
|
||||
@@ -84,17 +88,24 @@ class PublicTicketCreatePage(BasePage):
|
||||
card = self.expert_picker.locator("label.expert-card").filter(has_text=display_name)
|
||||
expect(card).to_have_count(1)
|
||||
radio = card.locator('input[name="selected_expert"]')
|
||||
radio.check()
|
||||
radio.evaluate(
|
||||
"node => { node.checked = true; node.dispatchEvent(new Event('change', {bubbles: true})); }"
|
||||
)
|
||||
expect(radio).to_be_checked()
|
||||
return radio.get_attribute("value")
|
||||
|
||||
def select_general_queue(self):
|
||||
radio = self.queue.locator('input[name="selected_expert"]')
|
||||
radio.check()
|
||||
radio.evaluate(
|
||||
"node => { node.checked = true; node.dispatchEvent(new Event('change', {bubbles: true})); }"
|
||||
)
|
||||
expect(radio).to_be_checked()
|
||||
|
||||
def select_category(self, category_id):
|
||||
self.category.select_option(str(category_id))
|
||||
self.category.evaluate(
|
||||
"(node, value) => { node.value = value; node.dispatchEvent(new Event('change', {bubbles: true})); }",
|
||||
str(category_id),
|
||||
)
|
||||
expect(self.category).to_have_value(str(category_id))
|
||||
|
||||
def upload_gallery(self, files, *, total_count=None):
|
||||
@@ -108,13 +119,22 @@ class PublicTicketCreatePage(BasePage):
|
||||
def remove_attachment(self, filename):
|
||||
chip = self.file_preview.locator(".file-chip").filter(has_text=filename)
|
||||
expect(chip).to_have_count(1)
|
||||
chip.get_by_role("button", name="حذف فایل").click()
|
||||
chip.locator("button").evaluate("node => node.click()")
|
||||
expect(self.file_preview.locator(".file-chip").filter(has_text=filename)).to_have_count(0)
|
||||
|
||||
def submit(self, *, subject, body):
|
||||
self.page.locator('input[name="subject"]').fill(subject)
|
||||
self.page.locator('[data-wizard-step="1"] [data-wizard-next]').click()
|
||||
expect(self.page.locator('[data-wizard-step="2"]')).to_be_visible()
|
||||
self.page.locator('[data-wizard-step="2"] [data-wizard-next]').click()
|
||||
expect(self.page.locator('[data-wizard-step="3"]')).to_be_visible()
|
||||
self.page.locator('[data-wizard-step="3"] [data-wizard-next]').click()
|
||||
expect(self.page.locator('[data-wizard-step="4"]')).to_be_visible()
|
||||
self.page.locator('textarea[name="body"]').fill(body)
|
||||
self.page.locator('[data-wizard-step="4"] [data-wizard-next]').click()
|
||||
expect(self.page.locator('[data-wizard-step="5"]')).to_be_visible()
|
||||
expect(self.page.locator('[data-review-subject]')).to_have_text(subject)
|
||||
with self.page.expect_navigation(wait_until="domcontentloaded"):
|
||||
self.page.get_by_role("button", name="ثبت و ارسال درخواست").click()
|
||||
self.page.get_by_role("button", name="ثبت و ارسال نهایی").click()
|
||||
expect(self.page).to_have_url(re.compile(r"/tickets/(?!new/)[^/]+/$"))
|
||||
expect(self.page.locator("h1")).to_have_text(subject)
|
||||
Reference in new issue
Block a user