From c27d02a9bf60d235968cd7dfcaaff5cc39d8ba3c Mon Sep 17 00:00:00 2001 From: SamuelSalas Date: Thu, 24 Oct 2024 10:31:30 -0600 Subject: [PATCH] Move QR code modal methods to their own page object --- e2e/pages/Receive/PaymentRequestQrModal.js | 19 +++++++++++++++++++ .../RequestPaymentModal.js | 0 e2e/pages/{ => Receive}/SendLinkView.js | 15 +++------------ e2e/specs/wallet/request-token-flow.spec.js | 9 +++++---- 4 files changed, 27 insertions(+), 16 deletions(-) create mode 100644 e2e/pages/Receive/PaymentRequestQrModal.js rename e2e/pages/{modals => Receive}/RequestPaymentModal.js (100%) rename e2e/pages/{ => Receive}/SendLinkView.js (67%) diff --git a/e2e/pages/Receive/PaymentRequestQrModal.js b/e2e/pages/Receive/PaymentRequestQrModal.js new file mode 100644 index 00000000000..580c35ef172 --- /dev/null +++ b/e2e/pages/Receive/PaymentRequestQrModal.js @@ -0,0 +1,19 @@ +import Matchers from '../../utils/Matchers'; +import Gestures from '../../utils/Gestures'; +import { SendLinkViewSelectorsIDs } from '../../selectors/SendLinkView.selectors'; + +class PaymentRequestQrModal { + get container() { + return Matchers.getElementByID(SendLinkViewSelectorsIDs.QR_MODAL); + } + + get closeButton() { + return Matchers.getElementByID(SendLinkViewSelectorsIDs.CLOSE_QR_MODAL_BUTTON); + } + + async tapCloseButton() { + await Gestures.waitAndTap(this.closeButton); + } +} + +export default new PaymentRequestQrModal(); diff --git a/e2e/pages/modals/RequestPaymentModal.js b/e2e/pages/Receive/RequestPaymentModal.js similarity index 100% rename from e2e/pages/modals/RequestPaymentModal.js rename to e2e/pages/Receive/RequestPaymentModal.js diff --git a/e2e/pages/SendLinkView.js b/e2e/pages/Receive/SendLinkView.js similarity index 67% rename from e2e/pages/SendLinkView.js rename to e2e/pages/Receive/SendLinkView.js index 5c7ede3dbd0..73663c6bbbb 100644 --- a/e2e/pages/SendLinkView.js +++ b/e2e/pages/Receive/SendLinkView.js @@ -1,6 +1,6 @@ -import Matchers from '../utils/Matchers'; -import Gestures from '../utils/Gestures'; -import { SendLinkViewSelectorsIDs } from '../selectors/SendLinkView.selectors'; +import Matchers from '../../utils/Matchers'; +import Gestures from '../../utils/Gestures'; +import { SendLinkViewSelectorsIDs } from '../../selectors/SendLinkView.selectors'; class SendLinkView { get container() { @@ -11,10 +11,6 @@ class SendLinkView { return Matchers.getElementByID(SendLinkViewSelectorsIDs.QR_MODAL); } - get qrCloseButton() { - return Matchers.getElementByID(SendLinkViewSelectorsIDs.CLOSE_QR_MODAL_BUTTON); - } - get closeSendLinkButton() { return Matchers.getElementByID(SendLinkViewSelectorsIDs.CLOSE_SEND_LINK_VIEW_BUTTON); } @@ -32,11 +28,6 @@ class SendLinkView { async tapCloseSendLinkButton() { await Gestures.waitAndTap(this.closeSendLinkButton); } - - // QR Modal - async tapQRCodeCloseButton() { - await Gestures.waitAndTap(this.qrCloseButton); - } } export default new SendLinkView(); diff --git a/e2e/specs/wallet/request-token-flow.spec.js b/e2e/specs/wallet/request-token-flow.spec.js index 512da71b855..01687985db2 100644 --- a/e2e/specs/wallet/request-token-flow.spec.js +++ b/e2e/specs/wallet/request-token-flow.spec.js @@ -1,11 +1,12 @@ 'use strict'; import { SmokeCore } from '../../tags'; -import SendLinkView from '../../pages/SendLinkView'; +import RequestPaymentModal from '../../pages/Receive/RequestPaymentModal'; +import SendLinkView from '../../pages/Receive/SendLinkView'; +import PaymentRequestQrModal from '../../pages/Receive/PaymentRequestQrModal'; import RequestPaymentView from '../../pages/RequestPaymentView'; import TabBarComponent from '../../pages/TabBarComponent'; import WalletActionsModal from '../../pages/modals/WalletActionsModal'; import ProtectYourWalletModal from '../../pages/modals/ProtectYourWalletModal'; -import RequestPaymentModal from '../../pages/modals/RequestPaymentModal'; import { loginToApp } from '../../viewHelper'; import { loadFixture, @@ -68,11 +69,11 @@ describe(SmokeCore('Request Token Flow with Unprotected Wallet'), () => { it('should see DAI request QR code', async () => { await SendLinkView.tapQRCodeButton(); - await Assertions.checkIfVisible(SendLinkView.qrModal); + await Assertions.checkIfVisible(PaymentRequestQrModal.container); }); it('should close request', async () => { - await SendLinkView.tapQRCodeCloseButton(); + await PaymentRequestQrModal.tapCloseButton(); await SendLinkView.tapCloseSendLinkButton(); });