From c450d080aa0ec7be8d2d57ff3e66f04c3fae4f50 Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Sat, 26 Sep 2026 12:00:12 +0300 Subject: [PATCH] Fix E2E test flake --- e2e/pages/user/user-edit-profile-page.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/e2e/pages/user/user-edit-profile-page.ts b/e2e/pages/user/user-edit-profile-page.ts index 3cd202324..08c366055 100644 --- a/e2e/pages/user/user-edit-profile-page.ts +++ b/e2e/pages/user/user-edit-profile-page.ts @@ -1,7 +1,7 @@ import type { Page } from "@playwright/test"; import { userEditProfileBaseSchema } from "~/features/user-page/user-page-schemas"; import { userEditProfilePage } from "~/utils/urls"; -import { navigate, submit } from "../../helpers/playwright"; +import { expect, navigate, submit } from "../../helpers/playwright"; import { createFormHelpers } from "../../helpers/playwright-form"; /** `/u/:identifier/edit` */ @@ -23,8 +23,18 @@ export class UserEditProfilePage { async selectCountry(name: string) { await this.page.getByLabel("Country").click(); - await this.page.getByRole("combobox", { name: "Search" }).fill(name); - await this.page.getByRole("option", { name }).click(); + const search = this.page.getByRole("combobox", { name: "Search" }); + await search.fill(name); + + // not a click: the popover moves as the list filters and Playwright's retry scrolls the trigger off screen, hiding it + const optionId = await this.page + .getByRole("option", { name }) + .getAttribute("id"); + await expect(search).toHaveAttribute( + "aria-activedescendant", + optionId ?? "", + ); + await search.press("Enter"); } async deleteWeapon(name: string | RegExp) {