Skip to content

Conversation

@kernelwhisperer
Copy link
Contributor

@kernelwhisperer kernelwhisperer commented Jan 5, 2026

Summary

Fixes e2e test flakiness.
Builts on top of #6751

To Test

⚠️ To run the tests. Make sure you add the required environment variables to
your root .env.local file with:

  • CYPRESS_INTEGRATION_TEST_PRIVATE_KEY=<your-private-key>: Private key
  • CYPRESS_INTEGRATION_TESTS_ALCHEMY_KEY=<your-alchemy-key>: Alchemy key

To launch it with our development server (so you have live-reloading):

# Terminal 1
yarn start
# Terminal 2
yarn e2e

If we want to use the Cypress UI, with the production build:

# Terminal 1
npx nx run cowswap-frontend:serve-static --port 3000
# Terminal 2
yarn e2e:open

Summary by CodeRabbit

  • Tests

    • Improved E2E reliability: increased timeouts, added small/large timeout constants, refined mocks/waits, stabilized signer/address handling, and streamlined token selection flows.
    • Suppressed a noisy ResizeObserver uncaught exception.
  • Chores

    • Updated E2E support utilities and CI to surface a new integration-test key and use it in test runs.
  • Documentation

    • Updated README and env examples with new integration-test key guidance and placeholders; removed deprecated keys from runtime env.

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel
Copy link

vercel bot commented Jan 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
cowfi Ready Ready Preview Jan 8, 2026 5:34pm
explorer-dev Ready Ready Preview Jan 8, 2026 5:34pm
swap-dev Ready Ready Preview Jan 8, 2026 5:34pm
widget-configurator Ready Ready Preview Jan 8, 2026 5:34pm
2 Skipped Deployments
Project Deployment Review Updated (UTC)
cosmos Ignored Ignored Jan 8, 2026 5:34pm
sdk-tools Ignored Ignored Preview Jan 8, 2026 5:34pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 5, 2026

Walkthrough

Added Infura E2E env support and README updates, increased Cypress timeouts and introduced SMALL_TIMEOUT/LARGE_TIMEOUT, refactored token-selection and test helpers, standardized timeouts and signer caching across tests, suppressed a ResizeObserver exception, and updated CI to pass the Infura key.

Changes

Cohort / File(s) Summary
Environment & CI
\.env\.local\.example, \.env, .github/workflows/ci.yml, README.md
Add Infura E2E env placeholders to example, remove E2E keys from .env, CI exposes CYPRESS_INTEGRATION_TESTS_INFURA_KEY, and README updated to prefer Infura when both keys exist.
Cypress config & timeout constants
apps/cowswap-frontend-e2e/cypress.config.ts, apps/cowswap-frontend-e2e/src/config.ts
Increase global Cypress timeouts (defaultCommandTimeout & pageLoadTimeout → 25000) and add SMALL_TIMEOUT (10_000) and LARGE_TIMEOUT (20_000) exports.
E2E tests (timeouts, signer caching, assertions, flows)
apps/cowswap-frontend-e2e/src/e2e/*.test.ts
(fiat-amounts.test.ts, limit-orders.test.ts, lists.test.ts, search.test.ts, swap.test.ts, swapMod.test.ts)
Replace hard-coded timeouts with SMALL_TIMEOUT/LARGE_TIMEOUT; switch some assertions to .should() style; cache signer address in onBeforeLoad for native-balance mocks; adjust swap banner/WETH interactions; mock USD price request in fiat test.
Support helpers & hooks
apps/cowswap-frontend-e2e/src/support/commands.ts, apps/cowswap-frontend-e2e/src/support/e2e.ts, apps/cowswap-frontend-e2e/src/support/ethereum.ts
Refactor token selection to search-and-select flow with explicit selectors and timeouts; add uncaught exception handler to ignore ResizeObserver loop warnings; extend provider URL fallback to use INTEGRATION_TESTS_INFURA_KEY if Alchemy not provided.

Sequence Diagram(s)

(omitted — changes are test infra, helpers, and configuration without new multi-component runtime control flow)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • alfetopito
  • shoom3301

Poem

🐇 I hopped through envs and test-timeouts wide,

I searched for tokens, then clicked with pride.
I cached the signer so flows run smooth,
Quieted ResizeObserver’s gruff hoof.
🥕 E2E carrots—ready for the ride.

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'chore: restore e2e tests' directly matches the main objective of fixing e2e test flakiness and restoring test functionality, making it clear and specific to the changeset.
Description check ✅ Passed The description covers the main objective (fixes e2e test flakiness), provides test prerequisites and detailed run instructions, but lacks a 'Background' section and misses some implementation details that would help reviewers understand why these changes fix flakiness.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @README.md:
- Around line 119-121: Change the inconsistent environment variable name in the
E2E test docs: replace the incorrect INTEGRATION_TESTS_ALCHEMY_KEY with
CYPRESS_INTEGRATION_TESTS_ALCHEMY_KEY so all three listed vars share the
CYPRESS_ prefix (matching the documented yarn e2e usage and the other entries
CYPRESS_INTEGRATION_TEST_PRIVATE_KEY and CYPRESS_INTEGRATION_TESTS_INFURA_KEY).
🧹 Nitpick comments (1)
.env.local.example (1)

7-16: Consider addressing dotenv-linter formatting suggestions.

The static analysis tool flagged a couple of minor formatting issues:

  • Line 7 has an extra blank line
  • Keys on lines 15-16 could be alphabetically ordered before the PRIVATE_KEY on line 14

These are purely stylistic and don't affect functionality.

📝 Proposed formatting cleanup
 REACT_APP_TG_DEV_BYPASS=true
-

 
 #######################################
 # End To End Test
 #######################################
 # ⚠️ Required for E2E tests to run
 
 # Cypress Integration Tests
-CYPRESS_INTEGRATION_TEST_PRIVATE_KEY=
 CYPRESS_INTEGRATION_TESTS_ALCHEMY_KEY=
 CYPRESS_INTEGRATION_TESTS_INFURA_KEY=
+CYPRESS_INTEGRATION_TEST_PRIVATE_KEY=
📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ee493a7 and 5912691.

📒 Files selected for processing (5)
  • .env.local.example
  • .github/workflows/ci.yml
  • README.md
  • apps/cowswap-frontend-e2e/src/support/e2e.ts
  • apps/cowswap-frontend-e2e/src/support/ethereum.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/cowswap-frontend-e2e/src/support/e2e.ts
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: cowdan
Repo: cowprotocol/cowswap PR: 6034
File: apps/cowswap-frontend-e2e/src/e2e/fiat-amounts.test.ts:44-47
Timestamp: 2025-07-28T16:26:08.051Z
Learning: In the cowswap codebase, using trivial placeholder tests like `it('should be true', () => { expect(true).to.be.true })` in e2e test files is an intentional pattern when disabling broken tests to keep CI green while maintaining build efficiency.
📚 Learning: 2025-09-25T08:48:53.495Z
Learnt from: shoom3301
Repo: cowprotocol/cowswap PR: 6299
File: apps/cowswap-frontend/src/entities/bridgeProvider/useBridgeSupportedNetworks.test.tsx:58-60
Timestamp: 2025-09-25T08:48:53.495Z
Learning: In the cowswap-frontend codebase, when writing SWR tests, the team prefers maximum test isolation by using `provider: () => new Map()` in SWRConfig wrappers, even if it recreates cache on every render, to ensure tests don't share any state.

Applied to files:

  • apps/cowswap-frontend-e2e/src/support/ethereum.ts
🪛 dotenv-linter (4.0.0)
.env.local.example

[warning] 7-7: [ExtraBlankLine] Extra blank line detected

(ExtraBlankLine)


[warning] 15-15: [UnorderedKey] The CYPRESS_INTEGRATION_TESTS_ALCHEMY_KEY key should go before the CYPRESS_INTEGRATION_TEST_PRIVATE_KEY key

(UnorderedKey)


[warning] 16-16: [UnorderedKey] The CYPRESS_INTEGRATION_TESTS_INFURA_KEY key should go before the CYPRESS_INTEGRATION_TEST_PRIVATE_KEY key

(UnorderedKey)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Cypress
  • GitHub Check: Setup
🔇 Additional comments (3)
.github/workflows/ci.yml (1)

204-204: LGTM! Infura key properly added as fallback.

The new environment variable follows the same pattern as the Alchemy key and is correctly passed from GitHub secrets to the Cypress test environment.

apps/cowswap-frontend-e2e/src/support/ethereum.ts (2)

14-25: LGTM! Infura fallback properly implemented.

The provider URL resolution now correctly falls back through: NETWORK_URL → Alchemy → Infura → undefined. The logic correctly prioritizes Alchemy over Infura as documented in the README.


29-29: LGTM! Assertion message updated.

The error message now includes the Infura key variable, which will help with debugging provider configuration issues.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (3)
.env.local.example (1)

7-7: Address dotenv-linter warnings for formatting consistency.

Static analysis flagged two minor issues:

  1. Line 7: Extra blank line (consider removing one of the two blank lines separating sections)
  2. Lines 15–16: Keys out of alphabetical order (ALCHEMY_KEY and INFURA_KEY should come before PRIVATE_KEY)

These are lint warnings and won't affect functionality, but aligning with linter expectations keeps the file consistent.

🔧 Proposed fix (optional)
  # Enable Telegram development bypass mode
  # When enabled, Telegram verification is bypassed and uses a mock user (@devuser)
  REACT_APP_TG_DEV_BYPASS=true
-

-
  #######################################
  # End To End Test
  #######################################
  # ⚠️ Required for E2E tests to run

  # Cypress Integration Tests
-CYPRESS_INTEGRATION_TEST_PRIVATE_KEY=
-CYPRESS_INTEGRATION_TESTS_ALCHEMY_KEY=
-CYPRESS_INTEGRATION_TESTS_INFURA_KEY=
+CYPRESS_INTEGRATION_TESTS_ALCHEMY_KEY=
+CYPRESS_INTEGRATION_TESTS_INFURA_KEY=
+CYPRESS_INTEGRATION_TEST_PRIVATE_KEY=

Also applies to: 15-16

apps/cowswap-frontend-e2e/src/support/commands.ts (2)

99-104: Standardize timeout with LARGE_TIMEOUT constant.

The hard-coded 20_000 timeout should use the LARGE_TIMEOUT constant introduced in apps/cowswap-frontend-e2e/src/config.ts for consistency with the timeout standardization effort across other e2e tests.

♻️ Proposed refactor

Import the timeout constant at the top of the file:

+import { LARGE_TIMEOUT } from '../config'

Then update the function:

 function _clickOnToken(inputOrOutput: string) {
   const buttonSelector = `#${inputOrOutput}-currency-input .open-currency-select-button`
 
-  cy.get(buttonSelector, { timeout: 20_000 }).should('not.be.disabled')
+  cy.get(buttonSelector, { timeout: LARGE_TIMEOUT }).should('not.be.disabled')
   cy.get(buttonSelector).click()
 }

108-116: Standardize timeout and document force click necessity.

Two observations:

  1. The hard-coded 20_000 timeout should use LARGE_TIMEOUT for consistency.
  2. The force: true option bypasses Cypress's actionability checks. If this is necessary due to virtualization or overlays in the token list, consider adding a comment explaining why natural clicks fail.
♻️ Proposed refactor
 function _selectTokenFromSelector(tokenAddress: string, inputOrOutput: string) {
   const tokenSelector = `#token-search-results div[data-address="${tokenAddress.toLowerCase()}"]`
   const searchSelector = '#token-search-input'
 
-  cy.get(searchSelector, { timeout: 20_000 }).should('be.visible').clear().type(tokenAddress)
-  cy.get(tokenSelector, { timeout: 20_000 }).should('be.visible').click({ force: true })
+  cy.get(searchSelector, { timeout: LARGE_TIMEOUT }).should('be.visible').clear().type(tokenAddress)
+  // force: true required due to virtualized token list rendering
+  cy.get(tokenSelector, { timeout: LARGE_TIMEOUT }).should('be.visible').click({ force: true })
 
   cy.get(`#${inputOrOutput}-currency-input .token-amount-input`).should('be.visible')
 }
📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9f845a6 and 83b7f7f.

📒 Files selected for processing (15)
  • .env
  • .env.local.example
  • .github/workflows/ci.yml
  • README.md
  • apps/cowswap-frontend-e2e/cypress.config.ts
  • apps/cowswap-frontend-e2e/src/config.ts
  • apps/cowswap-frontend-e2e/src/e2e/fiat-amounts.test.ts
  • apps/cowswap-frontend-e2e/src/e2e/limit-orders.test.ts
  • apps/cowswap-frontend-e2e/src/e2e/lists.test.ts
  • apps/cowswap-frontend-e2e/src/e2e/search.test.ts
  • apps/cowswap-frontend-e2e/src/e2e/swap.test.ts
  • apps/cowswap-frontend-e2e/src/e2e/swapMod.test.ts
  • apps/cowswap-frontend-e2e/src/support/commands.ts
  • apps/cowswap-frontend-e2e/src/support/e2e.ts
  • apps/cowswap-frontend-e2e/src/support/ethereum.ts
💤 Files with no reviewable changes (1)
  • .env
🚧 Files skipped from review as they are similar to previous changes (10)
  • apps/cowswap-frontend-e2e/cypress.config.ts
  • apps/cowswap-frontend-e2e/src/e2e/search.test.ts
  • apps/cowswap-frontend-e2e/src/e2e/fiat-amounts.test.ts
  • apps/cowswap-frontend-e2e/src/e2e/limit-orders.test.ts
  • apps/cowswap-frontend-e2e/src/config.ts
  • .github/workflows/ci.yml
  • README.md
  • apps/cowswap-frontend-e2e/src/e2e/lists.test.ts
  • apps/cowswap-frontend-e2e/src/support/ethereum.ts
  • apps/cowswap-frontend-e2e/src/support/e2e.ts
🧰 Additional context used
🧠 Learnings (13)
📚 Learning: 2025-07-28T16:26:08.051Z
Learnt from: cowdan
Repo: cowprotocol/cowswap PR: 6034
File: apps/cowswap-frontend-e2e/src/e2e/fiat-amounts.test.ts:44-47
Timestamp: 2025-07-28T16:26:08.051Z
Learning: In the cowswap codebase, using trivial placeholder tests like `it('should be true', () => { expect(true).to.be.true })` in e2e test files is an intentional pattern when disabling broken tests to keep CI green while maintaining build efficiency.

Applied to files:

  • apps/cowswap-frontend-e2e/src/e2e/swapMod.test.ts
  • apps/cowswap-frontend-e2e/src/e2e/swap.test.ts
📚 Learning: 2025-02-20T15:59:33.749Z
Learnt from: shoom3301
Repo: cowprotocol/cowswap PR: 5443
File: apps/cowswap-frontend/src/modules/swap/containers/ConfirmSwapModalSetup/index.tsx:71-71
Timestamp: 2025-02-20T15:59:33.749Z
Learning: The swap module in apps/cowswap-frontend/src/modules/swap/ is marked for deletion in PR #5444 as part of the swap widget unification effort.

Applied to files:

  • apps/cowswap-frontend-e2e/src/e2e/swapMod.test.ts
📚 Learning: 2025-10-10T20:28:16.565Z
Learnt from: fairlighteth
Repo: cowprotocol/cowswap PR: 6347
File: apps/cowswap-frontend/src/modules/trade/pure/TradeConfirmation/index.tsx:49-49
Timestamp: 2025-10-10T20:28:16.565Z
Learning: In apps/cowswap-frontend/src/modules/trade, TradeConfirmation follows a two-layer architecture: TradeConfirmationView (pure/stateless) in pure/TradeConfirmation/index.tsx renders the UI, while TradeConfirmation (container) in containers/TradeConfirmation/index.tsx wraps it to freeze props during pending trades (via useStableTradeConfirmationProps), wire in signing state (useSigningStep), and inject trade confirmation state (useTradeConfirmState). Consuming modules should import the container TradeConfirmation from 'modules/trade' to preserve this stateful behavior.
<!-- [add_learning]
When reviewing component refactoring in apps/cowswap-frontend/src/modules/trade, recognize the pattern where a pure view component (e.g., TradeConfirmationView) is separated from a stateful container (e.g., TradeConfirmation) that wraps it. The container adds runtime state management (prop stabilization, signing state, etc.) while the view remains testable and composable. Do not flag usages that import th...

Applied to files:

  • apps/cowswap-frontend-e2e/src/e2e/swapMod.test.ts
  • apps/cowswap-frontend-e2e/src/e2e/swap.test.ts
📚 Learning: 2025-10-13T19:41:31.440Z
Learnt from: limitofzero
Repo: cowprotocol/cowswap PR: 6351
File: apps/cowswap-frontend/src/modules/erc20Approve/containers/TradeApproveModal/useTradeApproveCallback.ts:87-121
Timestamp: 2025-10-13T19:41:31.440Z
Learning: In apps/cowswap-frontend/src/modules/erc20Approve, useApproveCallback returns Promise<TransactionResponse | undefined> and is distinct from useApproveCurrency, which can return Promise<TransactionReceipt | SafeMultisigTransactionResponse>. When reviewing approval flows, verify which hook is actually being used before flagging Safe wallet concerns.

Applied to files:

  • apps/cowswap-frontend-e2e/src/e2e/swapMod.test.ts
  • apps/cowswap-frontend-e2e/src/e2e/swap.test.ts
📚 Learning: 2025-09-25T08:49:32.256Z
Learnt from: shoom3301
Repo: cowprotocol/cowswap PR: 6299
File: apps/cowswap-frontend/src/entities/bridgeProvider/useBridgeSupportedNetworks.test.tsx:62-67
Timestamp: 2025-09-25T08:49:32.256Z
Learning: In the cowswap-frontend codebase, when testing hooks that use multiple bridge providers, both providers are always properly mocked as complete jest.Mocked<BridgeProvider<BridgeQuoteResult>> objects with all required methods stubbed, ensuring no undefined returns that could break the hook logic.

Applied to files:

  • apps/cowswap-frontend-e2e/src/e2e/swapMod.test.ts
  • apps/cowswap-frontend-e2e/src/e2e/swap.test.ts
📚 Learning: 2025-05-26T12:39:29.009Z
Learnt from: cowdan
Repo: cowprotocol/cowswap PR: 5715
File: libs/common-const/src/tokens.ts:539-555
Timestamp: 2025-05-26T12:39:29.009Z
Learning: The team accepts using NATIVE_CURRENCY_ADDRESS as a temporary placeholder for COW token contract addresses on new networks (Polygon, Avalanche) until actual COW contracts are deployed.

Applied to files:

  • apps/cowswap-frontend-e2e/src/e2e/swapMod.test.ts
📚 Learning: 2025-09-19T11:38:59.206Z
Learnt from: fairlighteth
Repo: cowprotocol/cowswap PR: 6232
File: apps/cowswap-frontend/src/modules/tokensList/pure/ChainsSelector/index.tsx:199-200
Timestamp: 2025-09-19T11:38:59.206Z
Learning: The makeBuildClickEvent function in apps/cowswap-frontend/src/modules/tokensList/pure/ChainsSelector/index.tsx takes five parameters: defaultChainId, contextLabel, mode, isSwapMode, and chainsCount. The chainsCount parameter is used to determine the CrossChain flag in analytics events.

Applied to files:

  • apps/cowswap-frontend-e2e/src/support/commands.ts
📚 Learning: 2025-08-08T13:55:17.528Z
Learnt from: shoom3301
Repo: cowprotocol/cowswap PR: 6125
File: libs/tokens/src/state/tokens/allTokensAtom.ts:78-78
Timestamp: 2025-08-08T13:55:17.528Z
Learning: In libs/tokens/src/state/tokens/allTokensAtom.ts (TypeScript/Jotai), the team prefers to wait for token lists to initialize (listsStatesListAtom non-empty) before returning tokens. No fallback to favorites/user-added/native tokens should be used when listsStatesList is empty.

Applied to files:

  • apps/cowswap-frontend-e2e/src/support/commands.ts
📚 Learning: 2025-08-08T13:56:18.009Z
Learnt from: shoom3301
Repo: cowprotocol/cowswap PR: 6125
File: libs/tokens/src/updaters/TokensListsUpdater/index.tsx:29-31
Timestamp: 2025-08-08T13:56:18.009Z
Learning: In libs/tokens/src/updaters/TokensListsUpdater/index.tsx, the project’s current Jotai version requires using `unstable_getOnInit` (not `getOnInit`) in atomWithStorage options; keep `{ unstable_getOnInit: true }` until Jotai is upgraded.

Applied to files:

  • apps/cowswap-frontend-e2e/src/support/commands.ts
📚 Learning: 2025-08-21T08:13:23.325Z
Learnt from: alfetopito
Repo: cowprotocol/cowswap PR: 6170
File: apps/cowswap-frontend/src/modules/twap/services/cancelTwapOrderTxs.ts:73-86
Timestamp: 2025-08-21T08:13:23.325Z
Learning: On zkSync chains, the standard ethers.js gas estimation approach using `{ from: address }` overrides doesn't work. The `.connect(FAKE_OWNER)` pattern with a plain address string is used instead, even though this seems unconventional compared to standard ethers.js usage where connect() expects a signer.

Applied to files:

  • apps/cowswap-frontend-e2e/src/e2e/swap.test.ts
📚 Learning: 2025-05-28T16:50:12.273Z
Learnt from: fairlighteth
Repo: cowprotocol/cowswap PR: 5768
File: apps/cow-fi/components/LearnPageComponent.tsx:184-185
Timestamp: 2025-05-28T16:50:12.273Z
Learning: In apps/cow-fi/components/LearnPageComponent.tsx, the user prefers to keep the inconsistent link behavior where featured articles always open in new tabs (target="_blank") while media coverage links conditionally open in new tabs based on the linkExternal flag. This inconsistency should not be flagged as an issue in future reviews.

Applied to files:

  • apps/cowswap-frontend-e2e/src/e2e/swap.test.ts
📚 Learning: 2025-07-24T16:42:53.154Z
Learnt from: cowdan
Repo: cowprotocol/cowswap PR: 6009
File: apps/cowswap-frontend/src/modules/tradeWidgetAddons/containers/HighFeeWarning/HighFeeWarningTooltipContent.tsx:23-33
Timestamp: 2025-07-24T16:42:53.154Z
Learning: In apps/cowswap-frontend/src/modules/tradeWidgetAddons/containers/HighFeeWarning/HighFeeWarningTooltipContent.tsx, the use of toFixed(2) for percentage formatting in tooltip content is intentional and differs from the banner message formatting that uses toSignificant(2, undefined, Rounding.ROUND_DOWN). This formatting difference serves different UX purposes and should not be flagged as inconsistent.

Applied to files:

  • apps/cowswap-frontend-e2e/src/e2e/swap.test.ts
📚 Learning: 2025-08-21T08:13:23.325Z
Learnt from: alfetopito
Repo: cowprotocol/cowswap PR: 6170
File: apps/cowswap-frontend/src/modules/twap/services/cancelTwapOrderTxs.ts:73-86
Timestamp: 2025-08-21T08:13:23.325Z
Learning: In ethers.js, when estimating gas costs on zkSync chains, using `{ from: address }` as an override parameter doesn't work as expected. The `.connect()` method with an address string is the correct approach for setting the caller for gas estimation on zkSync, even though it may seem unconventional.

Applied to files:

  • apps/cowswap-frontend-e2e/src/e2e/swap.test.ts
🧬 Code graph analysis (2)
apps/cowswap-frontend-e2e/src/e2e/swapMod.test.ts (2)
apps/cowswap-frontend-e2e/src/support/mocks/mockSendCall.ts (2)
  • mockSendCall (141-152)
  • handleNativeBalance (137-139)
apps/cowswap-frontend-e2e/src/config.ts (1)
  • SMALL_TIMEOUT (1-1)
apps/cowswap-frontend-e2e/src/e2e/swap.test.ts (1)
apps/cowswap-frontend-e2e/src/support/mocks/mockSendCall.ts (2)
  • mockSendCall (141-152)
  • handleNativeBalance (137-139)
🪛 dotenv-linter (4.0.0)
.env.local.example

[warning] 7-7: [ExtraBlankLine] Extra blank line detected

(ExtraBlankLine)


[warning] 15-15: [UnorderedKey] The CYPRESS_INTEGRATION_TESTS_ALCHEMY_KEY key should go before the CYPRESS_INTEGRATION_TEST_PRIVATE_KEY key

(UnorderedKey)


[warning] 16-16: [UnorderedKey] The CYPRESS_INTEGRATION_TESTS_INFURA_KEY key should go before the CYPRESS_INTEGRATION_TEST_PRIVATE_KEY key

(UnorderedKey)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Cypress
  • GitHub Check: Setup
🔇 Additional comments (4)
.env.local.example (1)

7-16: E2E test configuration section looks good.

The addition of the "End To End Test" section with Cypress integration keys is appropriate for the PR objective and well-documented with clear headers and comments.

apps/cowswap-frontend-e2e/src/e2e/swap.test.ts (2)

60-81: LGTM! Efficient address caching pattern.

Fetching the signer address once in onBeforeLoad and reusing it in handleNativeBalance is more efficient than calling await win.ethereum.signer.getAddress() inline multiple times. The async callback is properly supported by Cypress.


84-110: LGTM! Robust banner interaction and consistent address caching.

The changes improve test reliability:

  1. Address caching pattern is consistent with the previous test
  2. Text-based banner selection (lines 105-108) is more resilient than relying solely on IDs, as it validates the user-visible content
apps/cowswap-frontend-e2e/src/e2e/swapMod.test.ts (1)

1-1: LGTM! Timeout standardization and address caching.

The changes improve test reliability and maintainability:

  1. SMALL_TIMEOUT constant (line 1, 96) standardizes timeout values across e2e tests
  2. Address caching pattern (lines 82, 86) is consistent with swap.test.ts, avoiding repeated async calls during test setup

Also applies to: 79-97

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants