fix payment
This commit is contained in:
1 parent
4f7486152c
commit
bb3ddd1610
47 files changed
+2137
-51
No files matched your search
@@ -4,6 +4,31 @@ from .payments import PaymentsPage
|
||||
|
||||
|
||||
class PaymentLinkPage(PaymentsPage):
|
||||
def prepare_copy(self, manual=False):
|
||||
self.manual_copy = manual
|
||||
if manual:
|
||||
self.page.add_init_script("Object.defineProperty(navigator, 'clipboard', {value: {writeText: async () => {throw new Error('Clipboard unavailable');}}});")
|
||||
else:
|
||||
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()
|
||||
if button_name == 'کپی لینک کوتاه این صفحه برای ارسال به دیگران':
|
||||
expect(self.page.locator('.pay-share-feedback')).to_contain_text('لینک آماده است')
|
||||
if self.manual_copy:
|
||||
dialog = self.page.get_by_role('dialog')
|
||||
expect(dialog).to_be_visible()
|
||||
value = dialog.locator('textarea').input_value()
|
||||
dialog.get_by_role('button', name='بستن', exact=True).click()
|
||||
return value
|
||||
expect(self.page.get_by_text('کپی شد', exact=True)).to_be_visible()
|
||||
return self.page.evaluate('navigator.clipboard.readText()')
|
||||
|
||||
def copy_short_link(self):
|
||||
value = self.copied_text('کپی لینک کوتاه این صفحه برای ارسال به دیگران')
|
||||
expect(self.page.locator('.pay-share-feedback')).to_contain_text('لینک آماده است')
|
||||
return value
|
||||
|
||||
def open_link(self, path):
|
||||
self.goto(path)
|
||||
expect(self.page.get_by_role('heading', name='جزئیات واریز', exact=True)).to_be_visible()
|
||||
|
||||
Reference in new issue
Block a user