-
Notifications
You must be signed in to change notification settings - Fork 5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: ensure bridge button handles clicks according to feature flags (#…
…25812) <!-- 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** Adds e2e tests for new cross-chain swaps routes <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/25793?quickstart=1) ## **Related issues** Follow-up to #25811 ## **Manual testing steps** 1. New tests should run successfully ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [X] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [X] I've completed the PR template to the best of my ability - [X] I’ve included tests if applicable - [X] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ X] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.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.
- Loading branch information
Showing
7 changed files
with
183 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
test/e2e/tests/bridge/bridge-button-opens-portfolio.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { Suite } from 'mocha'; | ||
import { withFixtures, logInWithBalanceValidation } from '../../helpers'; | ||
import { Ganache } from '../../seeder/ganache'; | ||
import { Driver } from '../../webdriver/driver'; | ||
import GanacheContractAddressRegistry from '../../seeder/ganache-contract-address-registry'; | ||
import { BridgePage, getBridgeFixtures } from './bridge-test-utils'; | ||
|
||
describe('Click bridge button @no-mmi', function (this: Suite) { | ||
it('loads portfolio tab from wallet overview when flag is turned off', async function () { | ||
await withFixtures( | ||
getBridgeFixtures(this.test?.fullTitle()), | ||
async ({ | ||
driver, | ||
ganacheServer, | ||
}: { | ||
driver: Driver; | ||
ganacheServer: Ganache; | ||
}) => { | ||
const bridgePage = new BridgePage(driver); | ||
await logInWithBalanceValidation(driver, ganacheServer); | ||
await bridgePage.navigateToBridgePage(); | ||
await bridgePage.verifyPortfolioTab(2); | ||
}, | ||
); | ||
}); | ||
|
||
it('loads portfolio tab from asset overview when flag is turned off', async function () { | ||
await withFixtures( | ||
// withErc20 param is false, as we test it manually below | ||
getBridgeFixtures(this.test?.fullTitle(), undefined, false), | ||
async ({ | ||
driver, | ||
ganacheServer, | ||
contractRegistry, | ||
}: { | ||
driver: Driver; | ||
ganacheServer: Ganache; | ||
contractRegistry: GanacheContractAddressRegistry; | ||
}) => { | ||
const bridgePage = new BridgePage(driver); | ||
await logInWithBalanceValidation(driver, ganacheServer); | ||
|
||
// ETH | ||
await bridgePage.navigateToAssetPage(contractRegistry, 'ETH', false); | ||
await bridgePage.navigateToBridgePage('coin-overview'); | ||
await bridgePage.verifyPortfolioTab(2); | ||
|
||
await bridgePage.reloadHome(); | ||
|
||
// TST | ||
await bridgePage.navigateToAssetPage(contractRegistry, 'TST'); | ||
await bridgePage.navigateToBridgePage('token-overview'); | ||
await bridgePage.verifyPortfolioTab(3); | ||
}, | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 0 additions & 41 deletions
41
test/e2e/tests/bridge/bridge-click-from-asset-overview.spec.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { FeatureFlagResponse } from '../../../../ui/pages/bridge/bridge.util'; | ||
|
||
export const DEFAULT_FEATURE_FLAGS_RESPONSE: FeatureFlagResponse = { | ||
'extension-support': false, | ||
}; | ||
|
||
export const LOCATOR = { | ||
MM_IMPORT_TOKENS_MODAL: (suffix: string) => | ||
`[data-testid="import-tokens-modal-${suffix}"]`, | ||
}; | ||
|
||
export const ETH_CONVERSION_RATE_USD = 3010; | ||
export const MOCK_CURRENCY_RATES = { | ||
currencyRates: { | ||
ETH: { | ||
conversionDate: 1665507609.0, | ||
conversionRate: ETH_CONVERSION_RATE_USD, | ||
usdConversionRate: ETH_CONVERSION_RATE_USD, | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters