From 63fc45488a4c02bc33676359bc84f8bef1bd082f Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Wed, 14 Jan 2026 22:00:39 +0000 Subject: [PATCH] test(e2e): click first visible interactive element Avoid failing on mobile-only hidden buttons in desktop viewport. Co-authored-by: dennis --- e2e/hydration.spec.ts | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/e2e/hydration.spec.ts b/e2e/hydration.spec.ts index cba05f0..7e82bac 100644 --- a/e2e/hydration.spec.ts +++ b/e2e/hydration.spec.ts @@ -119,13 +119,20 @@ test.describe('Hydration Tests', () => { const buttonCount = await buttons.count(); if (buttonCount > 0) { - const firstButton = buttons.first(); - await expect(firstButton).toBeVisible(); - - // Try clicking (should not throw) - await firstButton.click().catch(() => { - // Some buttons might be disabled, that's OK - }); + // Find a visible interactive element (desktop hides some mobile-only buttons) + let clicked = false; + for (let i = 0; i < Math.min(buttonCount, 25); i++) { + const candidate = buttons.nth(i); + // eslint-disable-next-line no-await-in-loop + if (await candidate.isVisible()) { + await candidate.click().catch(() => { + // Some buttons might be disabled or covered, that's OK + }); + clicked = true; + break; + } + } + expect(clicked).toBe(true); } }); });