Skip to content

Commit

Permalink
chore(runway): cherry-pick fix: Update steps of the methods that are …
Browse files Browse the repository at this point in the history
…no longer valid (#11423)

- fix: Update steps of the methods that are no longer valid (#11367)

<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **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**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **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 <dan.s.cross@icloud.com>
Co-authored-by: Curtis David <Curtis.David7@gmail.com>
[fb86c83](fb86c83)

Co-authored-by: SamuelSalas <samuel.salas.reyes@gmail.com>
Co-authored-by: Daniel Cross <dan.s.cross@icloud.com>
Co-authored-by: Curtis David <Curtis.David7@gmail.com>
  • Loading branch information
4 people authored Sep 25, 2024
1 parent 590736e commit af0b314
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down
25 changes: 14 additions & 11 deletions e2e/specs/swaps/swap-token-chart.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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');
Expand All @@ -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);
Expand All @@ -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) {
Expand All @@ -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();
Expand Down
9 changes: 5 additions & 4 deletions e2e/utils/Matchers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<Detox.IndexableNativeElement> | Promise<Detox.NativeElement>} - Resolves to the located element
* @return {Promise<Detox.IndexableNativeElement | Detox.NativeElement>} - Resolves to the located element
*/
static async getElementByID(elementId, index) {
if (index) {
Expand Down Expand Up @@ -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<Detox.IndexableNativeElement>} - Resolves to the located element
* @param {number} index - Index of the element (default: 0)
* @return {Promise<Detox.NativeElement>} - Resolves to the located element
*/
static async getElementByLabel(label, index = 0) {
return element(by.label(label)).atIndex(index);
Expand Down Expand Up @@ -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<Detox.IndexableWebElement>} Resolves to the located element
* @return {Promise<Detox.IndexableWebElement | Detox.SecuredWebElementFacade>} Resolves to the located element
*/
static async getElementByWebID(webviewID, innerID) {
const myWebView = this.getWebViewByID(webviewID);
Expand All @@ -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<Detox.WebElement>} - Resolves to the located element
* @return {Promise<Detox.IndexableWebElement | Detox.SecuredWebElementFacade>} - Resolves to the located element
*/
static async getElementByXPath(webviewID, xpath) {
const myWebView = this.getWebViewByID(webviewID);
Expand Down

0 comments on commit af0b314

Please sign in to comment.