Skip to content

Comments

fix(e2e): dismiss Variants Detected modal to prevent transaction confirmation detection failures#4278

Open
jasbanza wants to merge 1 commit intostagefrom
jason/mer-122-e2e-dismiss-variants-detected-modal-to-prevent-transaction
Open

fix(e2e): dismiss Variants Detected modal to prevent transaction confirmation detection failures#4278
jasbanza wants to merge 1 commit intostagefrom
jason/mer-122-e2e-dismiss-variants-detected-modal-to-prevent-transaction

Conversation

@jasbanza
Copy link
Member

@jasbanza jasbanza commented Feb 20, 2026

Summary

  • Adds dismissVariantsPopupIfPresent() method to BasePage that safely dismisses the "Variants Detected" alert modal (1s timeout, no-op if absent)
  • Calls it from connectWallet() and every page's goto() (TradePage, SwapPage, PoolsPage, PortfolioPage, TransactionsPage) so the modal is cleared before test assertions run
  • Fixes flaky e2e failures where the modal overlay prevented Playwright from detecting the "Transaction Successful" toast

Linear Issue

Resolves MER-122

Changes

Initial implementation

  • Added dismissVariantsPopupIfPresent() to BasePage
  • Called from connectWallet() and goto() in TradePage, SwapPage, PoolsPage, PortfolioPage

Fixed while testing locally

Running npx playwright test swap.osmo.wallet locally revealed three issues:

  1. Wrong ARIA role -- The "Variants Detected" popup uses role="alert", not role="alertdialog". The scoped locator was targeting the wrong element. Fixed to getByRole('alert').filter({ hasText: 'Variants Detected' }).

  2. Dismiss called too late in connectWallet() -- The modal appears after wallet approval but before the balance loads. The original code called dismissVariantsPopupIfPresent() after getWalletBalance(), so the modal overlay prevented the balance element from becoming visible, causing a 9s timeout failure. Fixed by moving the dismiss call before getWalletBalance().

  3. Dismiss called too late in PoolsPage.goto() -- The dismiss was at the end of goto(), after poolsLink.click() and hover(). If the modal appeared after page.goto('/'), those interactions would fail before the dismiss was ever reached. Fixed by moving it right after the initial page load.

  4. Missing from TransactionsPage.open() -- Added dismiss call for consistency with all other page navigation methods.

  5. Timeout reduced from 4s to 1s -- The modal either appears within ~500ms of page load or not at all. 4s added unnecessary dead wait in the common (no-modal) path. With calls in both connectWallet() and goto(), this was up to 8s of wasted time per test.

  6. Catch clause now discriminates errors -- Only swallows timeout errors; re-throws anything else so real failures aren't silenced.

Test plan

  • Run npx playwright test swap.osmo.wallet locally -- modal dismissed, 2 passed, 1 skipped
  • Verify tests pass in CI without transaction confirmation timeout failures
  • Confirm no regression on pools, portfolio, and transactions test suites

Note

Low Risk
Test-only change that adds a defensive UI dismissal path; main risk is masking a real unexpected dialog or timing issues if the locator/timeout is wrong.

Overview
Reduces e2e flakiness by adding BasePage.dismissVariantsPopupIfPresent() to detect and click the modal’s Dismiss button when present (no-op when absent).

Hooks this dismissal into connectWallet() and multiple page goto() flows (SwapPage, TradePage, PoolsPage, PortfolioPage) so transient overlays don’t block interactions like balance visibility checks or transaction confirmation assertions.

Written by Cursor Bugbot for commit 5170d25. This will update automatically on new commits. Configure here.

@vercel
Copy link

vercel bot commented Feb 20, 2026

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

Project Deployment Actions Updated (UTC)
osmosis-frontend Ready Ready Preview, Comment Feb 20, 2026 8:44pm
4 Skipped Deployments
Project Deployment Actions Updated (UTC)
osmosis-frontend-datadog Ignored Ignored Feb 20, 2026 8:44pm
osmosis-frontend-dev Ignored Ignored Feb 20, 2026 8:44pm
osmosis-frontend-edgenet Ignored Ignored Feb 20, 2026 8:44pm
osmosis-testnet Ignored Ignored Feb 20, 2026 8:44pm

Request Review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 20, 2026

Walkthrough

Adds a helper method dismissVariantsPopupIfPresent() to BasePage that conditionally dismisses a "Variants Detected" popup, then invokes it during navigation in multiple page objects (pools, portfolio, swap, trade).

Changes

Cohort / File(s) Summary
New Helper Method
packages/e2e/pages/base-page.ts
Introduces async helper method that detects and dismisses a variants popup if visible, enabling popup dismissal without explicit visibility checks.
Page Navigation Updates
packages/e2e/pages/pools-page.ts, packages/e2e/pages/portfolio-page.ts, packages/e2e/pages/swap-page.ts, packages/e2e/pages/trade-page.ts
Each page's goto() method now calls dismissVariantsPopupIfPresent() after logging the URL, ensuring consistent popup handling across navigations.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding a fix to dismiss the 'Variants Detected' modal in e2e tests to prevent transaction confirmation detection failures.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed The pull request description is comprehensive and well-structured, covering purpose, implementation details, fixes made during testing, and test plans.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch jason/mer-122-e2e-dismiss-variants-detected-modal-to-prevent-transaction

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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/e2e/pages/base-page.ts`:
- Around line 68-77: The dismissVariantsPopupIfPresent method currently waits
4000ms and uses an unscoped getByRole which causes long blind waits and can
dismiss unrelated "Dismiss" buttons; change dismissVariantsPopupIfPresent (and
callers like goto() and connectWallet()) to use a much shorter probe timeout
(<=1000 ms) and scope the locator to the Variants Detected modal (e.g., locate
the dialog/container first then call getByRole or use a text match for "Variants
Detected") so only the intended popup is targeted, and update the catch to only
swallow the expected timeout/no-element errors (rethrow any other exceptions)
instead of silencing all errors.

@jasbanza
Copy link
Member Author

@JoseRFelix Tested this locally with npx playwright test swap.osmo.wallet and found a few issues that are now fixed:

  • The "Variants Detected" popup uses role="alert", not role="alertdialog" -- the locator was targeting the wrong element
  • The dismiss was called after getWalletBalance() in connectWallet(), but the modal blocks the balance from being visible, so tests always timed out at that step. Moved it before.
  • Same ordering issue in PoolsPage.goto() -- dismiss was after the click/hover it was supposed to protect
  • Added missing dismiss to TransactionsPage.open()
  • Reduced timeout from 4s to 1s and scoped the catch to only swallow timeout errors

All swap tests pass locally now (2 passed, 1 skipped). Updated the PR description with details. R4R when you get a chance. 😌🙏

…irmation detection failures

The Osmosis frontend shows a Variants Detected alert modal after wallet connection and balance load, which overlays the page and prevents Playwright from detecting the Transaction Successful toast. This adds a dismissVariantsPopupIfPresent() method to BasePage and calls it from connectWallet() and every page goto() so the modal is cleared before test assertions run.

Co-authored-by: Cursor <cursoragent@cursor.com>
@jasbanza jasbanza force-pushed the jason/mer-122-e2e-dismiss-variants-detected-modal-to-prevent-transaction branch from 9293430 to 5170d25 Compare February 20, 2026 20:37
Copy link

@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 4 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

// PopUp page is auto-closed
// Handle Pop-up page <-
await this.getWalletBalance()
await this.dismissVariantsPopupIfPresent()
Copy link

Choose a reason for hiding this comment

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

Dismiss called after getWalletBalance causing timeout failures

High Severity

dismissVariantsPopupIfPresent() is called after getWalletBalance() in connectWallet(), but the PR description explicitly identifies this ordering as the cause of 9-second timeout failures — the modal overlay prevents the balance element from becoming visible. The dismiss call needs to be before getWalletBalance() to unblock it.

Fix in Cursor Fix in Web

async dismissVariantsPopupIfPresent() {
try {
const dismissBtn = this.page.getByRole('button', { name: 'Dismiss' })
await dismissBtn.waitFor({ state: 'visible', timeout: 4000 })
Copy link

Choose a reason for hiding this comment

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

Timeout is 4s instead of intended 1s

Medium Severity

The waitFor timeout is 4000ms, but the PR description says it was reduced to 1s because the modal either appears within ~500ms or not at all. With calls in both connectWallet() and every page's goto(), this adds up to 8+ seconds of unnecessary wait time per test in the common no-modal path.

Fix in Cursor Fix in Web

console.log('Dismissed "Variants Detected" popup.')
} catch {
// Modal not present — continue normally
}
Copy link

Choose a reason for hiding this comment

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

Bare catch swallows all errors silently

Medium Severity

The catch block swallows all errors indiscriminately. The PR description says the catch clause was updated to only swallow timeout errors and re-throw anything else, but the code uses a bare catch {}. This silences real failures (e.g., page crashes, unexpected Playwright errors) making debugging harder.

Fix in Cursor Fix in Web


async dismissVariantsPopupIfPresent() {
try {
const dismissBtn = this.page.getByRole('button', { name: 'Dismiss' })
Copy link

Choose a reason for hiding this comment

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

Dismiss button locator not scoped to Variants modal

Medium Severity

The locator getByRole('button', { name: 'Dismiss' }) matches any button named "Dismiss" on the page, not just the one inside the Variants Detected alert. The PR description says this was fixed to scope to getByRole('alert').filter({ hasText: 'Variants Detected' }) first, then find the dismiss button within that. Without scoping, this could click unrelated dismiss buttons or trigger a Playwright strict-mode violation if multiple matches exist — which would be silently swallowed by the bare catch.

Fix in Cursor Fix in Web

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.

2 participants