test: fixed flakiness on claim position test#26059
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
| 'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1', | ||
| 'eip155:999', | ||
| ], | ||
| partialSupport: { balances: ['eip155:42220', 'eip155:43114'] }, |
There was a problem hiding this comment.
Duplicate v2 supportedNetworks mocks with conflicting response formats
High Severity
Changing the first urlEndpoint from v1/supportedNetworks to v2/supportedNetworks creates a duplicate entry. The pre-existing v2 mock at line 1265 still uses the old numeric format ([1, 137, ...]), while the newly updated entry at line 1244 uses the new CAIP string format (['eip155:1', ...]). Which response the mock system returns depends on match ordering, making test behavior unpredictable. The old v2 entry (or the new one) needs to be removed or updated so there's a single, consistent mock for the v2 endpoint.
Additional Locations (1)
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
Tag Selection Rationale:
The supportedNetworks API mock change could theoretically affect other tests, but since it's updating to match a new API version (v2 with CAIP-2 format), it should be compatible with the app code that expects this format. Performance Test Selection: |
|





Description
PR summary: Predict claim E2E – stability and geoblock mocking
1. Flaky claim button tap (predict-claim-positions.spec.ts)
Problem: tapClaimButton() sometimes failed because the button wasn’t on screen.
Cause: Race condition. The test only waited for PredictionsTabContainer. The claim button is rendered only after the positions API (with winnings) returns and Redux has wonPositions. The tap could run before the button was visible.
Change: Wait explicitly for the claim button before tapping:
Assertions.expectElementToBeVisible(WalletView.claimButton, { description: '...' }) before WalletView.tapClaimButton().
2. “Unavailable in your region” modal in some runs
Problem: In some runs the test hit the “Unavailable in your region” modal and failed.
The default mock is applied in the generic /proxy handler (via _events). Test-specific mocks (e.g. POLYMARKET_COMPLETE_MOCKS) are registered first as explicit mockttp rules. By adding the geoblock mock there we ensure that when the geoblock request hits the mock server it is handled by a dedicated, high-priority rule for that test, instead of depending on the generic handler’s order or matching. That reduces flakiness when the modal appeared in some runs. The response is still the same: we reuse POLYMARKET_GEOBLOCK_ELIGIBLE from the defaults so there’s a single source of truth.
Changelog
CHANGELOG entry:
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Low Risk
Changes are limited to E2E test mocks and assertions to reduce flakiness; no production logic is modified.
Overview
Improves stability of the Predict claim-positions smoke test by waiting explicitly for the
claimButtonto render before tapping, avoiding a race with positions loading.Refactors Polymarket geoblock mocking to a shared
POLYMARKET_GEOBLOCK_ELIGIBLEconstant and registers an explicit eligible-region geoblock rule inPOLYMARKET_COMPLETE_MOCKSso test-specific rules reliably prevent the “Unavailable in your region” modal.Updates the Accounts API mock for
supportedNetworksto hit thev2endpoint and return CAIP-2 style network identifiers (including Solana) for full/partial support.Written by Cursor Bugbot for commit 432d287. This will update automatically on new commits. Configure here.