diff --git a/test/e2e/fixture-builder.js b/test/e2e/fixture-builder.js index 94e515d46ff6..7269bda82153 100644 --- a/test/e2e/fixture-builder.js +++ b/test/e2e/fixture-builder.js @@ -299,6 +299,22 @@ class FixtureBuilder { }); } + withNetworkControllerOnPolygon() { + return this.withNetworkController({ + networkConfigurations: { + networkConfigurationId: { + chainId: CHAIN_IDS.POLYGON, + nickname: 'Polygon Mainnet', + rpcPrefs: {}, + rpcUrl: 'https://mainnet.infura.io', + ticker: 'ETH', + networkConfigurationId: 'networkConfigurationId', + id: 'networkConfigurationId', + }, + }, + }); + } + withNetworkControllerDoubleGanache() { const ganacheNetworks = mockNetworkStateOld({ id: '76e9cd59-d8e2-47e7-b369-9c205ccb602c', diff --git a/test/e2e/tests/multichain/asset-list.spec.ts b/test/e2e/tests/multichain/asset-list.spec.ts index 5b210730ef36..d7120a1fcace 100644 --- a/test/e2e/tests/multichain/asset-list.spec.ts +++ b/test/e2e/tests/multichain/asset-list.spec.ts @@ -13,14 +13,15 @@ import AssetListPage from '../../page-objects/pages/asset-list'; const NETWORK_NAME_MAINNET = 'Ethereum Mainnet'; const LINEA_NAME_MAINNET = 'Linea Mainnet'; -const LOCALHOST = 'Localhost 8545'; +const POLYGON_NAME_MAINNET = 'Polygon'; const BALANCE_AMOUNT = '24.9956'; -function buildFixtures(title: string) { +function buildFixtures(title: string, chainId: number = 1337) { return { fixtures: new FixtureBuilder() .withPermissionControllerConnectedToTestDapp() - .withTokensControllerERC20() + .withNetworkControllerOnPolygon() + .withTokensControllerERC20({ chainId }) .build(), ganacheOptions: defaultGanacheOptions, smartContract: SMART_CONTRACTS.HST, @@ -49,7 +50,7 @@ describe('Multichain Asset List', function (this: Suite) { const assetListPage = new AssetListPage(driver); await headerNavbar.clickSwitchNetworkDropDown(); await selectNetworkDialog.selectNetworkName(NETWORK_NAME_MAINNET); - await assetListPage.waitUntilAssetListHasItems(2); + await assetListPage.waitUntilAssetListHasItems(3); await assetListPage.openNetworksFilter(); await assetListPage.clickCurrentNetworkOption(); await headerNavbar.clickSwitchNetworkDropDown(); @@ -79,7 +80,7 @@ describe('Multichain Asset List', function (this: Suite) { const assetListPage = new AssetListPage(driver); await headerNavbar.clickSwitchNetworkDropDown(); await selectNetworkDialog.selectNetworkName(NETWORK_NAME_MAINNET); - await assetListPage.waitUntilAssetListHasItems(2); + await assetListPage.waitUntilAssetListHasItems(3); await driver.clickElement('.multichain-token-list-item'); const coinOverviewElement = await driver.findElement( '[data-testid="coin-overview-buy"]', @@ -97,7 +98,7 @@ describe('Multichain Asset List', function (this: Suite) { }); it('switches networks when clicking on send for a token on another network', async function () { await withFixtures( - buildFixtures(this.test?.fullTitle() as string), + buildFixtures(this.test?.fullTitle() as string, 137), async ({ driver, ganacheServer, @@ -112,10 +113,10 @@ describe('Multichain Asset List', function (this: Suite) { await headerNavbar.clickSwitchNetworkDropDown(); await selectNetworkDialog.selectNetworkName(NETWORK_NAME_MAINNET); const sendPage = new SendTokenPage(driver); - await assetListPage.waitUntilAssetListHasItems(2); + await assetListPage.waitUntilAssetListHasItems(4); await assetListPage.clickOnAsset('TST'); await driver.clickElement('[data-testid="eth-overview-send"]'); - await sendPage.check_networkChange(LOCALHOST); + await sendPage.check_networkChange(POLYGON_NAME_MAINNET); await sendPage.check_pageIsLoaded(); await sendPage.fillRecipient( '0x2f318C334780961FB129D2a6c30D0763d9a5C970', @@ -132,7 +133,7 @@ describe('Multichain Asset List', function (this: Suite) { }); it('switches networks when clicking on swap for a token on another network', async function () { await withFixtures( - buildFixtures(this.test?.fullTitle() as string), + buildFixtures(this.test?.fullTitle() as string, 137), async ({ driver, ganacheServer, @@ -146,14 +147,14 @@ describe('Multichain Asset List', function (this: Suite) { const assetListPage = new AssetListPage(driver); await headerNavbar.clickSwitchNetworkDropDown(); await selectNetworkDialog.selectNetworkName(NETWORK_NAME_MAINNET); - await assetListPage.waitUntilAssetListHasItems(2); + await assetListPage.waitUntilAssetListHasItems(4); await assetListPage.clickOnAsset('TST'); await driver.clickElement('.mm-box > button:nth-of-type(3)'); const toastTextElement = await driver.findElement('.toast-text'); const toastText = await toastTextElement.getText(); assert.equal( toastText, - `You're now using ${LOCALHOST}`, + `You're now using ${POLYGON_NAME_MAINNET}`, 'Toast text is correct', ); }, @@ -175,7 +176,7 @@ describe('Multichain Asset List', function (this: Suite) { const selectNetworkDialog = new SelectNetwork(driver); await headerNavbar.clickSwitchNetworkDropDown(); await selectNetworkDialog.selectNetworkName(LINEA_NAME_MAINNET); - await assetListPage.waitUntilAssetListHasItems(2); + await assetListPage.waitUntilAssetListHasItems(3); await assetListPage.clickOnAsset('Ethereum'); @@ -187,7 +188,7 @@ describe('Multichain Asset List', function (this: Suite) { const toastText = await toastTextElement.getText(); assert.equal( toastText, - `You're now using ${LOCALHOST}`, + `You're now using Ethereum Mainnet`, 'Toast text is correct', ); const balanceMessageElement = await driver.findElement(