-
Notifications
You must be signed in to change notification settings - Fork 177
test(e2e): market-orders specs #7975
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
Open
shoom3301
wants to merge
56
commits into
feat/e2e-playwright-3
Choose a base branch
from
e2e/market-orders
base: feat/e2e-playwright-3
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 54 commits
Commits
Show all changes
56 commits
Select commit
Hold shift + click to select a range
7ecbda7
refactor: use setupTestConditions in tests
shoom3301 93fddb7
chore: add account activities locator
shoom3301 9ee9c1e
refactor: decompose mockSwapFulfillment
shoom3301 3c7a128
refactor: use types from sdk
shoom3301 c39705b
test: e2e [MO-06]
shoom3301 c4298c1
docs: add E2E SPEC SKILL
shoom3301 feb8fd4
docs: add E2E SCENARIO SKILL
shoom3301 4f712cf
chore: clean up
shoom3301 62021d2
test: e2e [LO-02]
shoom3301 4d91d20
test: e2e [MO-07]
shoom3301 75c59ee
test: e2e [MO-07] snackbar
shoom3301 5cad625
refactor: approve test
shoom3301 dcbf4cb
chore: add test
shoom3301 cdc302f
test: e2e [MO-09]
shoom3301 da5150e
test: e2e [MO-10]
shoom3301 ab0bd16
refactor: align market-orders tests to doc
shoom3301 f82fbd0
test: e2e [MO-03]
shoom3301 93acbf2
test: e2e [MO-08]
shoom3301 1e223f3
test: e2e [MO-11]
shoom3301 a4f8245
test: e2e [MO-22]
shoom3301 8cd093f
test: e2e [MO-30]
shoom3301 72db874
test: e2e [MO-42]
shoom3301 42eb059
test: e2e [MO-45]
shoom3301 e61b3a1
test: e2e [MO-46]
shoom3301 252b363
test: e2e [MO-54]
shoom3301 bb62509
refactor: simplify e2e tests
shoom3301 5f83da6
test: e2e MO-61
shoom3301 e3121c0
test: e2e MO-70 MO-71
shoom3301 62fd48a
chore: clean up code
shoom3301 4b19a9f
chore: mark as smoke
shoom3301 a04ff59
chore: fix test
shoom3301 547708c
chore: fix test
shoom3301 2dfc961
Merge branch 'feat/e2e-playwright-3' of https://github.com/cowprotoco…
shoom3301 c92fe9c
chore: update bundle sizes [automatic]
cowswap-release-sync[bot] 28b73a3
chore: fix test
shoom3301 262e569
Merge remote-tracking branch 'origin/e2e/market-orders' into e2e/mark…
shoom3301 ca5b801
chore: fix test
shoom3301 252d0c7
feat(e2e): speed up updaters
shoom3301 eea34b8
test: e2e MO-61
shoom3301 ef92a74
test: e2e MO-14
shoom3301 199a9ab
test: e2e MO-47
shoom3301 4ce63d4
Merge branch 'feat/e2e-playwright-3' of https://github.com/cowprotoco…
shoom3301 dd355fc
Merge branch 'feat/e2e-playwright-3' of https://github.com/cowprotoco…
shoom3301 d18d76e
chore: fix lock
shoom3301 75bc9aa
chore: make tests stable
shoom3301 89a21e5
chore: update tests id
shoom3301 0fc344e
chore: update comments
shoom3301 8fb9e01
test(e2e): improve rpc node mocks
shoom3301 fe6b0cb
refactor: simplify e2e mocks
shoom3301 cefa072
chore: fix locator
shoom3301 c623450
chore: fix allowance mock
shoom3301 4597958
Merge branch 'feat/e2e-playwright-3' into e2e/market-orders
elena-zh 5397421
test(e2e): add [CS-129] enable Hooks via settings toggle
elena-zh 6aab3ab
chore: remove test
shoom3301 30dff46
Merge branch 'feat/e2e-playwright-3' of https://github.com/cowprotoco…
shoom3301 83e4bf7
chore: make tests stable
shoom3301 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
| cd "$(dirname "$0")/.." | ||
| set -a | ||
| source .env | ||
| set +a | ||
| npx playwright test "$@" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| import type { BrowserContext, Route } from '@playwright/test' | ||
|
|
||
| interface JsonRpcEntry { | ||
| id: number | string | ||
| method: string | ||
| } | ||
|
|
||
| // An arbitrary-but-real mainnet block number, captured once — nothing in this suite asserts on the | ||
| // actual value, so a fixed one is enough to remove the real dependency entirely. | ||
| const HARDCODED_BLOCK_NUMBER = '0x188bc6f' | ||
|
|
||
| /** | ||
| * `eth_blockNumber` goes out as a single, standalone JSON-RPC call (no Multicall3 batching, same | ||
| * as `eth_getCode`) to whichever real RPC/Infura endpoint the app's own independent client picked. | ||
| * Traced with `logUnmockedRpcRequests`/`LOG_UNMOCKED_RPC=1`: same class of real, rate-limited | ||
| * dependency as `eth_getCode` (`installEthGetCode`) that 429s under `pnpm e2e`'s full parallel | ||
| * load. | ||
| */ | ||
| export function installEthBlockNumber(context: BrowserContext): void { | ||
| void context.route('**/*', async (route: Route) => { | ||
| const request = route.request() | ||
| if (request.method() !== 'POST') return route.fallback() | ||
|
|
||
| let body: JsonRpcEntry | JsonRpcEntry[] | ||
| try { | ||
| body = request.postDataJSON() as JsonRpcEntry | JsonRpcEntry[] | ||
| } catch { | ||
| return route.fallback() | ||
| } | ||
|
|
||
| const entries = Array.isArray(body) ? body : [body] | ||
| if (!entries.some((entry) => entry?.method === 'eth_blockNumber')) return route.fallback() | ||
|
|
||
| if (entries.every((entry) => entry?.method === 'eth_blockNumber')) { | ||
| const payload = entries.map((entry) => ({ jsonrpc: '2.0', id: entry.id, result: HARDCODED_BLOCK_NUMBER })) | ||
| return route.fulfill({ | ||
| status: 200, | ||
| contentType: 'application/json', | ||
| body: JSON.stringify(Array.isArray(body) ? payload : payload[0]), | ||
| }) | ||
| } | ||
|
|
||
| return fulfillFromUpstream(route, entries) | ||
| }) | ||
| } | ||
|
|
||
| /** | ||
| * A mixed batch alongside something else this mock doesn't own — patch only the `eth_blockNumber` | ||
| * slots and merge with the real response for the rest, with the same defensive try/catch as the | ||
| * allowances/SocketVerifier mocks so a flaky real upstream can't take the whole batch down. | ||
| */ | ||
| async function fulfillFromUpstream(route: Route, entries: JsonRpcEntry[]): Promise<void> { | ||
| try { | ||
| const upstream = await route.fetch() | ||
| const upstreamBody = (await upstream.json()) as JsonRpcEntry | JsonRpcEntry[] | ||
| const upstreamEntries = Array.isArray(upstreamBody) ? upstreamBody : [upstreamBody] | ||
| const byId = new Map(entries.map((entry) => [entry.id, entry])) | ||
|
|
||
| const payload = upstreamEntries.map((entry) => { | ||
| const original = byId.get((entry as JsonRpcEntry).id) | ||
| if (!original || original.method !== 'eth_blockNumber') return entry | ||
| return { jsonrpc: '2.0', id: original.id, result: HARDCODED_BLOCK_NUMBER } | ||
| }) | ||
| await route.fulfill({ | ||
| status: 200, | ||
| contentType: 'application/json', | ||
| body: JSON.stringify(Array.isArray(upstreamBody) ? payload : payload[0]), | ||
| }) | ||
| } catch { | ||
| await route.fallback() | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.