Skip to content

test: fixed flakiness on claim position test#26059

Merged
javiergarciavera merged 7 commits intomainfrom
MMQA-fix-flakiness-test
Feb 13, 2026
Merged

test: fixed flakiness on claim position test#26059
javiergarciavera merged 7 commits intomainfrom
MMQA-fix-flakiness-test

Conversation

@javiergarciavera
Copy link
Copy Markdown
Contributor

@javiergarciavera javiergarciavera commented Feb 13, 2026

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

Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]

Screenshots/Recordings

Before

After

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

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 claimButton to render before tapping, avoiding a race with positions loading.

Refactors Polymarket geoblock mocking to a shared POLYMARKET_GEOBLOCK_ELIGIBLE constant and registers an explicit eligible-region geoblock rule in POLYMARKET_COMPLETE_MOCKS so test-specific rules reliably prevent the “Unavailable in your region” modal.

Updates the Accounts API mock for supportedNetworks to hit the v2 endpoint 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.

@javiergarciavera javiergarciavera requested review from a team as code owners February 13, 2026 10:23
@github-actions
Copy link
Copy Markdown
Contributor

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.

@metamaskbot metamaskbot added the team-qa QA team label Feb 13, 2026
@javiergarciavera javiergarciavera added the no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed label Feb 13, 2026
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1',
'eip155:999',
],
partialSupport: { balances: ['eip155:42220', 'eip155:43114'] },
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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)

Fix in Cursor Fix in Web

@github-actions
Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokePredictions, SmokeWalletPlatform, SmokeConfirmations
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: medium
  • AI Confidence: 85%
click to see 🤖 AI reasoning details

E2E Test Selection:
The PR contains 4 changed files, all within the test infrastructure (tests/ directory):

  1. tests/api-mocking/mock-responses/defaults/accounts.ts: Updates the supportedNetworks API mock from v1 to v2 format, changing chain IDs from numeric (e.g., 1) to CAIP-2 format (e.g., eip155:1). This is a test infrastructure update to match a new API version.

  2. tests/api-mocking/mock-responses/defaults/polymarket-apis.ts: Refactors the geoblock mock to be a reusable constant (POLYMARKET_GEOBLOCK_ELIGIBLE) with explicit country code (Portugal).

  3. tests/api-mocking/mock-responses/polymarket/polymarket-mocks.ts: Adds POLYMARKET_GEO_ELIGIBLE_MOCKS function and integrates it into POLYMARKET_COMPLETE_MOCKS to ensure proper mock ordering for geoblock responses.

  4. tests/smoke/predict/predict-claim-positions.spec.ts: Adds an assertion to wait for the Claim button to be visible before tapping it - a test stability improvement.

Tag Selection Rationale:

  • SmokePredictions: Primary tag - the changes directly modify Predictions test infrastructure (polymarket mocks) and a Predictions test spec file (predict-claim-positions.spec.ts).
  • SmokeWalletPlatform: Per tag guidance, Predictions is a section inside the Trending tab, so changes to Predictions views affect this tag.
  • SmokeConfirmations: Per tag guidance, when selecting SmokePredictions, also select SmokeConfirmations as Add Funds deposits are on-chain transactions.

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:
No performance tests needed. All changes are within the test infrastructure (tests/ directory) - no app code is modified that could impact app performance. The changes update API mocks and improve test stability, which do not affect UI rendering, data loading, or app startup performance.

View GitHub Actions results

@sonarqubecloud
Copy link
Copy Markdown

@javiergarciavera javiergarciavera added this pull request to the merge queue Feb 13, 2026
Merged via the queue into main with commit 0eba571 Feb 13, 2026
95 checks passed
@javiergarciavera javiergarciavera deleted the MMQA-fix-flakiness-test branch February 13, 2026 15:24
@github-actions github-actions bot locked and limited conversation to collaborators Feb 13, 2026
@metamaskbot metamaskbot added the release-7.67.0 Issue or pull request that will be included in release 7.67.0 label Feb 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed release-7.67.0 Issue or pull request that will be included in release 7.67.0 size-S team-qa QA team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants