Skip to content

Commit

Permalink
test(TXL-308): initial e2e for stx using swaps (#27215)
Browse files Browse the repository at this point in the history
## **Description**
* Initial e2e test for stx

<!--
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/27215?quickstart=1)

## **Related issues**

Fixes:

## **Manual testing steps**

1. Go to this page...
2.
3.

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

- [ ] 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).
- [ ] 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-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
dbrans authored Oct 15, 2024
1 parent dc0dc67 commit 82e5a45
Show file tree
Hide file tree
Showing 15 changed files with 617 additions and 94 deletions.
1 change: 1 addition & 0 deletions privacy-snapshot.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"test.metamask-phishing.io",
"token.api.cx.metamask.io",
"tokens.api.cx.metamask.io",
"transaction.api.cx.metamask.io",
"tx-sentinel-ethereum-mainnet.api.cx.metamask.io",
"unresponsive-rpc.test",
"unresponsive-rpc.url",
Expand Down
2 changes: 2 additions & 0 deletions test/e2e/default-fixture.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,9 @@ function defaultFixture(inputChainId = CHAIN_IDS.LOCALHOST) {
SmartTransactionsController: {
smartTransactionsState: {
fees: {},
feesByChainId: {},
liveness: true,
livenessByChainId: {},
smartTransactions: {
[CHAIN_IDS.MAINNET]: [],
},
Expand Down
8 changes: 8 additions & 0 deletions test/e2e/fixture-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,14 @@ class FixtureBuilder {
});
}

withPreferencesControllerSmartTransactionsOptedIn() {
return this.withPreferencesController({
preferences: {
smartTransactionsOptInStatus: true,
},
});
}

withPreferencesControllerAndFeatureFlag(flags) {
merge(this.fixture.data.PreferencesController, flags);
return this;
Expand Down
58 changes: 28 additions & 30 deletions test/e2e/mock-e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,35 +272,33 @@ async function setupMocking(
.thenCallback(() => {
return {
statusCode: 200,
json: [
{
ethereum: {
fallbackToV1: false,
mobileActive: true,
extensionActive: true,
},
bsc: {
fallbackToV1: false,
mobileActive: true,
extensionActive: true,
},
polygon: {
fallbackToV1: false,
mobileActive: true,
extensionActive: true,
},
avalanche: {
fallbackToV1: false,
mobileActive: true,
extensionActive: true,
},
smartTransactions: {
mobileActive: false,
extensionActive: false,
},
updated_at: '2022-03-17T15:54:00.360Z',
json: {
ethereum: {
fallbackToV1: false,
mobileActive: true,
extensionActive: true,
},
],
bsc: {
fallbackToV1: false,
mobileActive: true,
extensionActive: true,
},
polygon: {
fallbackToV1: false,
mobileActive: true,
extensionActive: true,
},
avalanche: {
fallbackToV1: false,
mobileActive: true,
extensionActive: true,
},
smartTransactions: {
mobileActive: false,
extensionActive: true,
},
updated_at: '2022-03-17T15:54:00.360Z',
},
};
});

Expand Down Expand Up @@ -470,7 +468,7 @@ async function setupMocking(
decimals: 18,
name: 'Dai Stablecoin',
iconUrl:
'https://crypto.com/price/coin-data/icon/DAI/color_icon.png',
'https://static.cx.metamask.io/api/v1/tokenIcons/1/0x6b175474e89094c44da98b954eedeac495271d0f.png',
type: 'erc20',
aggregators: [
'aave',
Expand All @@ -497,7 +495,7 @@ async function setupMocking(
decimals: 6,
name: 'USD Coin',
iconUrl:
'https://crypto.com/price/coin-data/icon/USDC/color_icon.png',
'https://static.cx.metamask.io/api/v1/tokenIcons/1/0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48.png',
type: 'erc20',
aggregators: [
'aave',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,9 @@
"SmartTransactionsController": {
"smartTransactionsState": {
"fees": {},
"feesByChainId": "object",
"liveness": true,
"livenessByChainId": "object",
"smartTransactions": "object"
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,9 @@
"allDetectedTokens": {},
"smartTransactionsState": {
"fees": {},
"feesByChainId": "object",
"liveness": true,
"livenessByChainId": "object",
"smartTransactions": "object"
},
"allNftContracts": "object",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,23 @@
},
"snapsInstallPrivacyWarningShown": true
},
"BridgeController": {
"bridgeState": {
"bridgeFeatureFlags": {
"extensionSupport": "boolean",
"srcNetworkAllowlist": {
"0": "string",
"1": "string",
"2": "string"
},
"destNetworkAllowlist": {
"0": "string",
"1": "string",
"2": "string"
}
}
}
},
"CurrencyController": {
"currentCurrency": "usd",
"currencyRates": {
Expand Down Expand Up @@ -138,7 +155,9 @@
"SmartTransactionsController": {
"smartTransactionsState": {
"fees": {},
"feesByChainId": "object",
"liveness": true,
"livenessByChainId": "object",
"smartTransactions": "object"
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,23 @@
},
"snapsInstallPrivacyWarningShown": true
},
"BridgeController": {
"bridgeState": {
"bridgeFeatureFlags": {
"extensionSupport": "boolean",
"srcNetworkAllowlist": {
"0": "string",
"1": "string",
"2": "string"
},
"destNetworkAllowlist": {
"0": "string",
"1": "string",
"2": "string"
}
}
}
},
"CurrencyController": {
"currentCurrency": "usd",
"currencyRates": {
Expand Down Expand Up @@ -138,7 +155,9 @@
"SmartTransactionsController": {
"smartTransactionsState": {
"fees": {},
"feesByChainId": "object",
"liveness": true,
"livenessByChainId": "object",
"smartTransactions": "object"
}
},
Expand Down
Loading

0 comments on commit 82e5a45

Please sign in to comment.