Fix e2e tests

This commit is contained in:
Kalle 2026-05-04 18:04:06 +03:00
parent 0fae5e920f
commit 961e8cb690
3 changed files with 17 additions and 0 deletions

View File

@ -126,6 +126,7 @@ export function MatchActionTab({
]);
}
}}
isDisabled={isSubmitting}
aria-label={t("q:match.action.selectWinner")}
className={styles.selectionRow}
>

View File

@ -92,6 +92,14 @@ export const reportResult = async (
) => {
for (let i = 0; i < mapsToReport; i++) {
const isFinal = setEnds && i === mapsToReport - 1;
// Wait for the action panel to settle before clicking. waitForPOSTResponse
// only waits for the POST itself; the loader revalidation that swaps in
// the next map's component runs after, so a previous winner can still be
// `data-selected="true"` here. Clicking too early hits the about-to-unmount
// label and the selection is lost on remount.
await expect(
page.locator('[data-testid^="winner-radio-"][data-selected="true"]'),
).toHaveCount(0);
await page.getByTestId(`winner-radio-${winner}`).click();
if (isFinal) {
await page.getByTestId("report-score-button").click();

View File

@ -236,6 +236,14 @@ async function reportMapWinner(page: Page, winner: "ALPHA" | "BRAVO") {
async function selectMapWinner(page: Page, winner: "ALPHA" | "BRAVO") {
const teamName = winner === "ALPHA" ? "Group Alpha" : "Group Bravo";
// Wait for the action panel to settle before clicking. waitForPOSTResponse
// only waits for the POST itself; the loader revalidation that swaps in the
// next map's component runs after, so a previous winner can still be
// `data-selected="true"` here. Clicking too early hits the about-to-unmount
// label and the selection is lost on remount.
await expect(
page.locator('[data-testid^="winner-radio-"][data-selected="true"]'),
).toHaveCount(0);
// react-aria's Radio renders a hidden input behind a span overlay; click the
// wrapping label so the press handler fires and updates winnerId.
await page.locator(`label:has(input[aria-label="${teamName}"])`).click();