From 1e181e0358e69e2c8910f96109e52355a741f3f3 Mon Sep 17 00:00:00 2001 From: brdy <41711440+BrodyHughes@users.noreply.github.com> Date: Fri, 25 Oct 2024 01:05:44 -0500 Subject: [PATCH] e2e swap fixes, bump chromedriver (#1745) Co-authored-by: Daniel Sinclair --- .github/actions/chromeTestsSetup/action.yml | 2 +- e2e/serial/swap/1_swapFlow1.test.ts | 88 ++++++++++++++------- lavamoat/build-webpack/policy.json | 50 +++++------- package.json | 4 +- yarn.lock | 8 +- 5 files changed, 84 insertions(+), 68 deletions(-) diff --git a/.github/actions/chromeTestsSetup/action.yml b/.github/actions/chromeTestsSetup/action.yml index d51e39a8eb..03f9faa5a9 100644 --- a/.github/actions/chromeTestsSetup/action.yml +++ b/.github/actions/chromeTestsSetup/action.yml @@ -12,4 +12,4 @@ runs: gh-access-token: ${{ inputs.gh-access-token }} - name: Install chrome shell: 'bash' - run: npx @puppeteer/browsers install chrome@128 + run: npx @puppeteer/browsers install chrome@130 diff --git a/e2e/serial/swap/1_swapFlow1.test.ts b/e2e/serial/swap/1_swapFlow1.test.ts index 668a15e1d1..e74a2cc6a6 100644 --- a/e2e/serial/swap/1_swapFlow1.test.ts +++ b/e2e/serial/swap/1_swapFlow1.test.ts @@ -108,6 +108,11 @@ it('should be able to connect to hardhat', async () => { const button = await findElementByText(driver, 'Disconnect from Hardhat'); expect(button).toBeTruthy(); await findElementByTestIdAndClick({ id: 'navbar-button-with-back', driver }); + + // sometimes hardhat balances take time to display. + // If we go straight to swap and they aren't updated, + // the swap gets auto-populated with the wrong token. + await delay(10_000); }); it('should be able to go to swap flow', async () => { @@ -591,6 +596,7 @@ it('should be able to filter assets to buy by network', async () => { driver, text: 'op', }); + await delayTime('medium'); await findElementByTestIdAndClick({ id: `${SWAP_VARIABLES.OP_OPTIMISM_ID}-favorites-token-to-buy-row`, driver, @@ -613,6 +619,7 @@ it('should be able to filter assets to buy by network', async () => { driver, text: 'pol', }); + await delayTime('medium'); await findElementByTestIdAndClick({ id: `${SWAP_VARIABLES.POL_POLYGON_ID}-favorites-token-to-buy-row`, driver, @@ -635,10 +642,23 @@ it('should be able to filter assets to buy by network', async () => { driver, text: 'gmx', }); - await findElementByTestIdAndClick({ - id: `${SWAP_VARIABLES.GMX_ARBITRUM_ID}-verified-token-to-buy-row`, - driver, - }); + await delayTime('medium'); + + // this token is occassionally included in 'popular in rainbow.' + // tokens are only set to appear in one section at a time, so if + // it is in that section, the test will fail without this try / catch. + try { + await findElementByTestIdAndClick({ + id: `${SWAP_VARIABLES.GMX_ARBITRUM_ID}-verified-token-to-buy-row`, + driver, + }); + } catch { + await findElementByTestIdAndClick({ + id: `${SWAP_VARIABLES.GMX_ARBITRUM_ID}-popular-token-to-buy-row-active-element-item`, + driver, + }); + } + // BNB await findElementByTestIdAndClick({ id: `${SWAP_VARIABLES.GMX_ARBITRUM_ID}-token-to-buy-token-input-remove`, @@ -657,6 +677,7 @@ it('should be able to filter assets to buy by network', async () => { driver, text: 'uni', }); + await delayTime('medium'); await findElementByTestIdAndClick({ id: `${SWAP_VARIABLES.UNI_BNB_ID}-verified-token-to-buy-row`, driver, @@ -709,10 +730,21 @@ it('should be able to see no route explainer', async () => { text: 'gmx', }); await delayTime('long'); - await findElementByTestIdAndClick({ - id: `${SWAP_VARIABLES.GMX_ARBITRUM_ID}-verified-token-to-buy-row`, - driver, - }); + + // this token is occassionally included in 'popular in rainbow.' + // tokens are only set to appear in one section at a time, so if + // it is in that section, the test will fail without this try / catch. + try { + await findElementByTestIdAndClick({ + id: `${SWAP_VARIABLES.GMX_ARBITRUM_ID}-verified-token-to-buy-row`, + driver, + }); + } catch { + await findElementByTestIdAndClick({ + id: `${SWAP_VARIABLES.GMX_ARBITRUM_ID}-popular-token-to-buy-row-active-element-item`, + driver, + }); + } await typeOnTextInput({ id: `${SWAP_VARIABLES.OP_OPTIMISM_ID}-token-to-sell-swap-token-input-swap-input-mask`, driver, @@ -764,27 +796,25 @@ it('should be able to find exact match on other networks', async () => { id: `switch-network-item-${ChainId.polygon}`, driver, }); - // UNCOMMENT ONCE #1732 GETS MERGED - - // await typeOnTextInput({ - // id: 'token-to-buy-search-token-input', - // driver, - // text: 'optimism', - // }); - // const onOtherNetworksSections = await findElementByTestId({ - // id: 'other_networks-token-to-buy-section', - // driver, - // }); - // expect(onOtherNetworksSections).toBeTruthy(); - - // await findElementByTestIdAndClick({ - // id: `${SWAP_VARIABLES.OP_OPTIMISM_ID}-other_networks-token-to-buy-row`, - // driver, - // }); - // await findElementByTestIdAndClick({ - // id: `${SWAP_VARIABLES.OP_OPTIMISM_ID}-token-to-buy-token-input-remove`, - // driver, - // }); + await typeOnTextInput({ + id: 'token-to-buy-search-token-input', + driver, + text: 'optimism', + }); + const onOtherNetworksSections = await findElementByTestId({ + id: 'other_networks-token-to-buy-section', + driver, + }); + expect(onOtherNetworksSections).toBeTruthy(); + + await findElementByTestIdAndClick({ + id: `${SWAP_VARIABLES.OP_OPTIMISM_ID}-other_networks-token-to-buy-row`, + driver, + }); + await findElementByTestIdAndClick({ + id: `${SWAP_VARIABLES.OP_OPTIMISM_ID}-token-to-buy-token-input-remove`, + driver, + }); await findElementByTestIdAndClick({ id: 'token-to-buy-search-token-input', driver, diff --git a/lavamoat/build-webpack/policy.json b/lavamoat/build-webpack/policy.json index 19440ec708..7db10498a1 100644 --- a/lavamoat/build-webpack/policy.json +++ b/lavamoat/build-webpack/policy.json @@ -614,10 +614,10 @@ "eslint-config-rainbow>eslint-import-resolver-babel-module>@babel/core>@babel/helper-module-transforms>@babel/helper-module-imports": true, "eslint-config-rainbow>eslint-import-resolver-babel-module>@babel/core>@babel/helper-module-transforms>@babel/helper-simple-access": true, "eslint-config-rainbow>eslint-import-resolver-babel-module>@babel/core>@babel/helper-module-transforms>@babel/helper-split-export-declaration": true, + "eslint-config-rainbow>eslint-import-resolver-babel-module>@babel/core>@babel/helper-module-transforms>@babel/helper-validator-identifier": true, "eslint-config-rainbow>eslint-import-resolver-babel-module>@babel/core>@babel/template": true, "jest>@jest/core>jest-snapshot>@babel/traverse": true, - "jest>@jest/core>jest-snapshot>@babel/types": true, - "jest>@jest/core>jest-snapshot>@babel/types>@babel/helper-validator-identifier": true + "jest>@jest/core>jest-snapshot>@babel/types": true } }, "eslint-config-rainbow>eslint-import-resolver-babel-module>@babel/core>@babel/helper-module-transforms>@babel/helper-module-imports": { @@ -1141,9 +1141,16 @@ "console.warn": true, "process.emitWarning": true }, + "packages": { + "jest>@jest/core>jest-snapshot>@babel/traverse>@babel/code-frame>@babel/highlight": true, + "jest>@jest/core>jest-snapshot>@babel/traverse>@babel/code-frame>chalk": true + } + }, + "jest>@jest/core>jest-snapshot>@babel/traverse>@babel/code-frame>@babel/highlight": { "packages": { "jest>@jest/core>jest-snapshot>@babel/traverse>@babel/code-frame>chalk": true, - "lavamoat>@babel/highlight": true + "jest>@jest/core>jest-snapshot>@babel/traverse>@babel/types>@babel/helper-validator-identifier": true, + "react>loose-envify>js-tokens": true } }, "jest>@jest/core>jest-snapshot>@babel/traverse>@babel/code-frame>chalk": { @@ -1217,34 +1224,6 @@ "lavamoat>lavamoat-core>@babel/types>to-fast-properties": true } }, - "lavamoat>@babel/highlight": { - "packages": { - "lavamoat>@babel/highlight>@babel/helper-validator-identifier": true, - "lavamoat>@babel/highlight>chalk": true, - "react>loose-envify>js-tokens": true - } - }, - "lavamoat>@babel/highlight>chalk": { - "globals": { - "process.env.TERM": true, - "process.platform": true - }, - "packages": { - "lavamoat>@babel/highlight>chalk>ansi-styles": true, - "lavamoat>@babel/highlight>chalk>escape-string-regexp": true, - "supports-color": true - } - }, - "lavamoat>@babel/highlight>chalk>ansi-styles": { - "packages": { - "lavamoat>@babel/highlight>chalk>ansi-styles>color-convert": true - } - }, - "lavamoat>@babel/highlight>chalk>ansi-styles>color-convert": { - "packages": { - "lavamoat>@babel/highlight>chalk>ansi-styles>color-convert>color-name": true - } - }, "lavamoat>lavamoat-tofu>@babel/traverse>@babel/helper-function-name": { "packages": { "lavamoat>lavamoat-tofu>@babel/traverse>@babel/helper-function-name>@babel/template": true, @@ -1264,10 +1243,17 @@ "process.emitWarning": true }, "packages": { - "lavamoat>@babel/highlight": true, + "lavamoat>lavamoat-tofu>@babel/traverse>@babel/helper-function-name>@babel/template>@babel/code-frame>@babel/highlight": true, "lavamoat>lavamoat-tofu>@babel/traverse>@babel/helper-function-name>@babel/template>@babel/code-frame>chalk": true } }, + "lavamoat>lavamoat-tofu>@babel/traverse>@babel/helper-function-name>@babel/template>@babel/code-frame>@babel/highlight": { + "packages": { + "lavamoat>lavamoat-tofu>@babel/traverse>@babel/helper-function-name>@babel/template>@babel/code-frame>chalk": true, + "lavamoat>lavamoat-tofu>@babel/traverse>@babel/helper-function-name>@babel/types>@babel/helper-validator-identifier": true, + "react>loose-envify>js-tokens": true + } + }, "lavamoat>lavamoat-tofu>@babel/traverse>@babel/helper-function-name>@babel/template>@babel/code-frame>chalk": { "globals": { "process.env.TERM": true, diff --git a/package.json b/package.json index bccf4d8374..1be7663db2 100644 --- a/package.json +++ b/package.json @@ -192,7 +192,7 @@ "audit-ci": "6.3.0", "browserify": "17.0.0", "chalk": "5.3.0", - "chromedriver": "128.0.3", + "chromedriver": "130", "circular-dependency-plugin": "5.2.2", "copy-webpack-plugin": "11.0.0", "css-loader": "6.7.1", @@ -337,4 +337,4 @@ "wagmi>@wagmi/connectors>@metamask/sdk>eciesjs>secp256k1": false } } -} \ No newline at end of file +} diff --git a/yarn.lock b/yarn.lock index 3b2e80f20f..c1daf553e4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7234,10 +7234,10 @@ chrome-trace-event@^1.0.2: resolved "https://registry.yarnpkg.com/chrome-trace-event/-/chrome-trace-event-1.0.3.tgz#1015eced4741e15d06664a957dbbf50d041e26ac" integrity sha512-p3KULyQg4S7NIHixdwbGX+nFHkoBiA4YQmyWtjb8XngSKV124nJmRysgAeujbUVb15vh+RvFUfCPqU7rXk+hZg== -chromedriver@128.0.3: - version "128.0.3" - resolved "https://registry.yarnpkg.com/chromedriver/-/chromedriver-128.0.3.tgz#7c2cd2d160f269e78f40840ee7a043dac3687148" - integrity sha512-Xn/bknOpGlY9tKinwS/hVWeNblSeZvbbJbF8XZ73X1jeWfAFPRXx3fMLdNNz8DqruDbx3cKEJ5wR3mnst6G3iw== +chromedriver@130: + version "130.0.1" + resolved "https://registry.yarnpkg.com/chromedriver/-/chromedriver-130.0.1.tgz#24fd5b2c9c9df4ebfc5d28c94eca8658915fbe15" + integrity sha512-JH+OxDZ7gVv02r9oXwj4mQ8JCtj62g0fCD1LMUUYdB/4mPxn/E2ys+1IzXItoE7vXM9fGVc9R1akvXLqwwuSww== dependencies: "@testim/chrome-version" "^1.1.4" axios "^1.7.4"