mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-05-09 04:02:40 -05:00
Fix e2e tests
This commit is contained in:
parent
0fae5e920f
commit
961e8cb690
|
|
@ -126,6 +126,7 @@ export function MatchActionTab({
|
|||
]);
|
||||
}
|
||||
}}
|
||||
isDisabled={isSubmitting}
|
||||
aria-label={t("q:match.action.selectWinner")}
|
||||
className={styles.selectionRow}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user