fix payment UI UX
This commit is contained in:
1 parent
bb3ddd1610
commit
90931a5a64
6 files changed
+104
-10
No files matched your search
@@ -0,0 +1,25 @@
|
||||
from playwright.sync_api import expect
|
||||
|
||||
from .payments import PaymentsPage
|
||||
|
||||
|
||||
class PaymentFeedbackPage(PaymentsPage):
|
||||
def check_amount(self, raw, expected):
|
||||
self.page.locator('#id_amount').fill(raw)
|
||||
expect(self.page.locator('#amount-words')).to_have_text(expected)
|
||||
|
||||
def request_share(self):
|
||||
self.page.locator('[data-share-link] button').click()
|
||||
|
||||
def expect_pending_share(self):
|
||||
button = self.page.locator('[data-share-link] button')
|
||||
expect(button).to_be_disabled()
|
||||
expect(button).to_have_attribute('aria-busy', 'true')
|
||||
expect(button).to_have_text('در حال آمادهسازی لینک…')
|
||||
|
||||
def expect_failed_share(self):
|
||||
button = self.page.locator('[data-share-link] button')
|
||||
expect(button).to_be_enabled()
|
||||
expect(button).not_to_have_attribute('aria-busy', 'true')
|
||||
expect(button).to_have_text('کپی لینک کوتاه این صفحه برای ارسال به دیگران')
|
||||
expect(self.page.locator('.pay-share-feedback')).to_contain_text('دریافت لینک ممکن نشد')
|
||||
@@ -12,9 +12,10 @@ class PaymentLinkPage(PaymentsPage):
|
||||
self.page.context.grant_permissions(['clipboard-read', 'clipboard-write'])
|
||||
|
||||
def copied_text(self, button_name):
|
||||
self.page.get_by_role('button', name=button_name, exact=True).click()
|
||||
button = self.page.locator('[data-share-link] button') if button_name == 'کپی لینک کوتاه این صفحه برای ارسال به دیگران' else self.page.get_by_role('button', name=button_name, exact=True)
|
||||
button.click()
|
||||
if button_name == 'کپی لینک کوتاه این صفحه برای ارسال به دیگران':
|
||||
expect(self.page.locator('.pay-share-feedback')).to_contain_text('لینک آماده است')
|
||||
expect(self.page.locator('.pay-share-feedback')).to_contain_text('لینک آماده است' if self.manual_copy else 'لینک کوتاه کپی شد')
|
||||
if self.manual_copy:
|
||||
dialog = self.page.get_by_role('dialog')
|
||||
expect(dialog).to_be_visible()
|
||||
@@ -26,7 +27,9 @@ class PaymentLinkPage(PaymentsPage):
|
||||
|
||||
def copy_short_link(self):
|
||||
value = self.copied_text('کپی لینک کوتاه این صفحه برای ارسال به دیگران')
|
||||
expect(self.page.locator('.pay-share-feedback')).to_contain_text('لینک آماده است')
|
||||
expect(self.page.locator('[data-share-link] button')).to_be_enabled()
|
||||
expect(self.page.locator('[data-share-link] button')).not_to_have_attribute('aria-busy', 'true')
|
||||
expect(self.page.locator('[data-share-link] button')).to_have_text('کپی لینک کوتاه این صفحه برای ارسال به دیگران' if self.manual_copy else 'لینک کپی شد؛ کپی دوباره')
|
||||
return value
|
||||
|
||||
def open_link(self, path):
|
||||
|
||||
Reference in new issue
Block a user