From af0b314efb5626c00eb04cb1ef1e8917372dcda6 Mon Sep 17 00:00:00 2001 From: "runway-github[bot]" <73448015+runway-github[bot]@users.noreply.github.com> Date: Wed, 25 Sep 2024 10:07:02 -0600 Subject: [PATCH] chore(runway): cherry-pick fix: Update steps of the methods that are no longer valid (#11423) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - fix: Update steps of the methods that are no longer valid (#11367) ## **Description** Currently, e2e/specs/permission-systems/permission-system-revoking-multiple-accounts.spec.js is failing on main. Some of the methods used on some steps were changed in a previous PR. But they spec was not updated as expected, so the test failed because is unable to find those methods. ## **Related issues** Fixes: ## **Manual testing steps** 1. Go to this page... 2. 3. ## **Screenshots/Recordings** Regression Test run: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/d7aa537e-ac76-44dc-ab7d-b47b4ff995a8 iOS: ![image](https://github.com/user-attachments/assets/46120985-a3f6-4a3a-9782-9b996ac6d365) Android: ![image](https://github.com/user-attachments/assets/f9bd7103-de33-40de-a2a5-59d6eb28b752) ### **Before** ### **After** ## **Pre-merge author checklist** - [ ] I’ve followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. --------- Co-authored-by: Daniel Cross Co-authored-by: Curtis David [fb86c83](https://github.com/MetaMask/metamask-mobile/commit/fb86c8355dfc0269ed868d9a669882ae2f7254f3) Co-authored-by: SamuelSalas Co-authored-by: Daniel Cross Co-authored-by: Curtis David --- ...-system-revoking-multiple-accounts.spec.js | 14 ++++++++--- e2e/specs/swaps/swap-token-chart.spec.js | 25 +++++++++++-------- e2e/utils/Matchers.js | 9 ++++--- 3 files changed, 29 insertions(+), 19 deletions(-) diff --git a/e2e/specs/permission-systems/permission-system-revoking-multiple-accounts.spec.js b/e2e/specs/permission-systems/permission-system-revoking-multiple-accounts.spec.js index c92f296ea36..685361d5729 100644 --- a/e2e/specs/permission-systems/permission-system-revoking-multiple-accounts.spec.js +++ b/e2e/specs/permission-systems/permission-system-revoking-multiple-accounts.spec.js @@ -6,12 +6,16 @@ import TabBarComponent from '../../pages/TabBarComponent'; import ToastModal from '../../pages/modals/ToastModal'; import ConnectedAccountsModal from '../../pages/modals/ConnectedAccountsModal'; import NetworkListModal from '../../pages/modals/NetworkListModal'; +import AddAccountModal from '../../pages/modals/AddAccountModal'; import { loginToApp } from '../../viewHelper'; import FixtureBuilder from '../../fixtures/fixture-builder'; import { withFixtures } from '../../fixtures/fixture-helper'; import Assertions from '../../utils/Assertions'; +import { Regression } from '../../tags'; -describe('Connecting to multiple dapps and revoking permission on one but staying connected to the other', () => { +const AccountTwoText = 'Account 2'; + +describe(Regression('Connecting to multiple dapps and revoking permission on one but staying connected to the other'), () => { beforeAll(async () => { jest.setTimeout(150000); await TestHelpers.reverseServerPort(); @@ -42,10 +46,12 @@ describe('Connecting to multiple dapps and revoking permission on one but stayin await Assertions.checkIfNotVisible(ToastModal.notificationTitle); await ConnectedAccountsModal.tapConnectMoreAccountsButton(); await AccountListView.tapAddAccountButton(); - await AccountListView.tapCreateAccountButton(); - await AccountListView.isAccount2VisibleAtIndex(0); + await AddAccountModal.tapCreateAccount(); + if (device.getPlatform() === 'android') { + await Assertions.checkIfTextIsDisplayed(AccountTwoText); + } await AccountListView.tapAccountIndex(0); - await AccountListView.connectAccountsButton(); + await AccountListView.tapConnectAccountsButton(); // should revoke accounts await Browser.tapNetworkAvatarButtonOnBrowser(); diff --git a/e2e/specs/swaps/swap-token-chart.spec.js b/e2e/specs/swaps/swap-token-chart.spec.js index 422ec021e37..d6d6bbbf0e9 100644 --- a/e2e/specs/swaps/swap-token-chart.spec.js +++ b/e2e/specs/swaps/swap-token-chart.spec.js @@ -22,6 +22,8 @@ import ActivitiesView from '../../pages/ActivitiesView'; import DetailsModal from '../../pages/modals/DetailsModal'; const fixtureServer = new FixtureServer(); +const sourceTokenSymbol = 'USDT'; +const destTokenSymbol = 'DAI'; describe(Regression('Swap from Token view'), () => { const swapOnboarded = true; // TODO: Set it to false once we show the onboarding page again. @@ -47,7 +49,7 @@ describe(Regression('Swap from Token view'), () => { jest.setTimeout(150000); }); - it('should complete a USDC to DAI swap from the token chart', async () => { + it('should complete a USDT to ETH swap from the token chart', async () => { await TabBarComponent.tapWallet(); await Assertions.checkIfVisible(WalletView.container); await WalletView.tapOnToken('Ethereum'); @@ -58,15 +60,15 @@ describe(Regression('Swap from Token view'), () => { await Assertions.checkIfVisible(QuoteView.getQuotes); await QuoteView.tapOnSelectSourceToken(); await QuoteView.tapSearchToken(); - await QuoteView.typeSearchToken('LINK'); + await QuoteView.typeSearchToken(sourceTokenSymbol); await TestHelpers.delay(1000); - await QuoteView.selectToken('LINK'); - await QuoteView.enterSwapAmount('5'); + await QuoteView.selectToken(sourceTokenSymbol); + await QuoteView.enterSwapAmount('10'); await QuoteView.tapOnSelectDestToken(); await QuoteView.tapSearchToken(); - await QuoteView.typeSearchToken('DAI'); + await QuoteView.typeSearchToken(destTokenSymbol); await TestHelpers.delay(1000); - await QuoteView.selectToken('DAI'); + await QuoteView.selectToken(destTokenSymbol); await QuoteView.tapOnGetQuotes(); await Assertions.checkIfVisible(SwapView.fetchingQuotes); await Assertions.checkIfVisible(SwapView.quoteSummary); @@ -75,7 +77,7 @@ describe(Regression('Swap from Token view'), () => { await SwapView.swipeToSwap(); try { await Assertions.checkIfVisible( - SwapView.swapCompleteLabel('LINK', 'DAI'), + SwapView.swapCompleteLabel(sourceTokenSymbol, destTokenSymbol), 100000, ); } catch (e) { @@ -84,22 +86,23 @@ describe(Regression('Swap from Token view'), () => { } await device.enableSynchronization(); await TestHelpers.delay(5000); + await TokenOverview.tapBackButton(); await TabBarComponent.tapActivity(); await Assertions.checkIfVisible(ActivitiesView.title); - await Assertions.checkIfVisible(ActivitiesView.swapActivity('LINK', 'DAI')); - await ActivitiesView.tapOnSwapActivity('LINK', 'DAI'); + await Assertions.checkIfVisible(ActivitiesView.swapActivity(sourceTokenSymbol, destTokenSymbol)); + await ActivitiesView.tapOnSwapActivity(sourceTokenSymbol, destTokenSymbol); try { await Assertions.checkIfVisible(DetailsModal.title); } catch (e) { - await ActivitiesView.tapOnSwapActivity('LINK', 'DAI'); + await ActivitiesView.tapOnSwapActivity(sourceTokenSymbol, destTokenSymbol); await Assertions.checkIfVisible(DetailsModal.title); } await Assertions.checkIfVisible(DetailsModal.title); await Assertions.checkIfElementToHaveText( DetailsModal.title, - DetailsModal.generateExpectedTitle('LINK', 'DAI'), + DetailsModal.generateExpectedTitle(sourceTokenSymbol, destTokenSymbol), ); await Assertions.checkIfVisible(DetailsModal.statusConfirmed); await DetailsModal.tapOnCloseIcon(); diff --git a/e2e/utils/Matchers.js b/e2e/utils/Matchers.js index cd9255de69e..50896f66702 100644 --- a/e2e/utils/Matchers.js +++ b/e2e/utils/Matchers.js @@ -9,7 +9,7 @@ class Matchers { * * @param {string} elementId - Match elements with the specified testID * @param {number} [index] - Index of the element (default: 0) - * @return {Promise | Promise} - Resolves to the located element + * @return {Promise} - Resolves to the located element */ static async getElementByID(elementId, index) { if (index) { @@ -49,7 +49,8 @@ class Matchers { * Get element by label. * * @param {string} label - Match elements with the specified accessibility label (iOS) or content description (Android) - * @return {Promise} - Resolves to the located element + * @param {number} index - Index of the element (default: 0) + * @return {Promise} - Resolves to the located element */ static async getElementByLabel(label, index = 0) { return element(by.label(label)).atIndex(index); @@ -96,7 +97,7 @@ class Matchers { * * @param {string} webviewID - The web ID of the inner element to locate within the webview * @param {string} innerID - The web ID of the browser webview - * @return {Promise} Resolves to the located element + * @return {Promise} Resolves to the located element */ static async getElementByWebID(webviewID, innerID) { const myWebView = this.getWebViewByID(webviewID); @@ -119,7 +120,7 @@ class Matchers { * Get element by XPath. * @param {string} webviewID - The web ID of the browser webview * @param {string} xpath - XPath expression to locate the element - * @return {Promise} - Resolves to the located element + * @return {Promise} - Resolves to the located element */ static async getElementByXPath(webviewID, xpath) { const myWebView = this.getWebViewByID(webviewID);