Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[e2e] intercept and mock e2e swaps calls #1754

Merged
merged 34 commits into from
Jan 17, 2025
Merged

Conversation

greg-schrammel
Copy link
Contributor

@greg-schrammel greg-schrammel commented Nov 1, 2024

Fixes BX-1599

This PR sets up mocking for swaps.

Changes:

  • Gregs wrote a script (mockFetch.ts) to intercept calls to our swaps endpoint and then return hashed responses stored in e2e/mocks/swap_quotes.
  • Anvil is set to be pinned to the block the quotes are originally from: 20923142
  • All of these are depending on the mockFetch being setup in the swaps root src/entries/popup/index.ts

Copy link

socket-security bot commented Nov 13, 2024

No dependency changes detected. Learn more about Socket for GitHub ↗︎

👍 No dependency changes detected in pull request

e2e/serial/send/2_shortcuts-sendFlow.test.ts Outdated Show resolved Hide resolved
e2e/serial/send/2_shortcuts-sendFlow.test.ts Show resolved Hide resolved
e2e/serial/swap/2_swapFlow2.test.ts Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
scripts/unit-tests.sh Outdated Show resolved Hide resolved
src/core/raps/actions/crosschainSwap.test.ts Outdated Show resolved Hide resolved
@BrodyHughes BrodyHughes requested a review from derHowie November 21, 2024 20:03
Copy link
Member

@BrodyHughes BrodyHughes left a comment

Choose a reason for hiding this comment

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

Biased approve

@BrodyHughes BrodyHughes changed the title Greg mock swap e2e test intercept and mock e2e swaps calls Nov 21, 2024
@BrodyHughes BrodyHughes mentioned this pull request Nov 22, 2024
e2e/fetchResponses.ts Outdated Show resolved Hide resolved
Copy link
Member

@brunobar79 brunobar79 left a comment

Choose a reason for hiding this comment

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

Overall looks good. I do have once concern that I'd live to see resolved or at least to have a plan before we decide to merge this.

Once this lands we're making all the tests 100% depending on hardhat chain id.
This takes away from the next goal which is to be able to run swaps e2e on l2.

Ideally hardhat should have the same chain id as the chain that is being forked, which makes everything else easier: not having to change test ids, not having to touch unit tests and keeping the ground work for supporting multichain mocked e2e in the future.

Can we try to do that?

Copy link

linear bot commented Dec 4, 2024

Added back the chainIds to the testIds, and also removed the reliance on chainId `1337` (hardhat) from unit tests. this was a step back to the larger goal of e2e L2 support
e2e/fetchResponses.ts Show resolved Hide resolved
e2e/mocks/mock_swap_quotes_urls.json Show resolved Hide resolved
src/core/raps/actions/unlock.ts Show resolved Hide resolved
src/entries/popup/index.ts Outdated Show resolved Hide resolved
Copy link

linear bot commented Dec 19, 2024

@brunobar79
Copy link
Member

@BrodyHughes I can approve this once all the conflicts and comments are addressed

@BrodyHughes
Copy link
Member

@BrodyHughes I can approve this once all the conflicts and comments are addressed

should be g2g

@DanielSinclair
Copy link
Collaborator

@brunobar79 When you have a second to re-review

@BrodyHughes BrodyHughes changed the title intercept and mock e2e swaps calls [e2e] intercept and mock e2e swaps calls Jan 14, 2025
@BrodyHughes BrodyHughes self-assigned this Jan 14, 2025
Copy link
Collaborator

@DanielSinclair DanielSinclair left a comment

Choose a reason for hiding this comment

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

Tests passing

Copy link
Collaborator

Choose a reason for hiding this comment

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

@BrodyHughes Is this error expected?

@DanielSinclair DanielSinclair merged commit 3dda47a into master Jan 17, 2025
14 checks passed
@DanielSinclair DanielSinclair deleted the greg-mock-swap-e2e branch January 17, 2025 23:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants