diff --git a/app/components/Draggable.tsx b/app/components/Draggable.tsx index e1b7f4e455..6cf4275630 100644 --- a/app/components/Draggable.tsx +++ b/app/components/Draggable.tsx @@ -7,11 +7,13 @@ export function Draggable({ disabled, liClassName, children, + testId, }: { id: number; disabled: boolean; liClassName: string; children: React.ReactNode; + testId?: string; }) { const { attributes, listeners, setNodeRef, transform, transition } = useSortable({ id, disabled }); @@ -26,6 +28,7 @@ export function Draggable({ className={liClassName} style={style} ref={setNodeRef} + data-testid={testId} {...listeners} {...attributes} > diff --git a/app/features/tournament/components/TeamWithRoster.tsx b/app/features/tournament/components/TeamWithRoster.tsx index 64998e8c36..4bc592e35b 100644 --- a/app/features/tournament/components/TeamWithRoster.tsx +++ b/app/features/tournament/components/TeamWithRoster.tsx @@ -43,6 +43,7 @@ export function TeamWithRoster({ {team.name} diff --git a/app/features/tournament/routes/to.$id.seeds.tsx b/app/features/tournament/routes/to.$id.seeds.tsx index 13cad65de3..aebb86d792 100644 --- a/app/features/tournament/routes/to.$id.seeds.tsx +++ b/app/features/tournament/routes/to.$id.seeds.tsx @@ -233,6 +233,7 @@ export default function TournamentSeedsPage() { {t("tournament:tabs.brackets")} - + {t("tournament:tabs.teams", { count: tournament.ctx.teams.length })} {!tournament.everyBracketOver && tournament.subsFeatureEnabled && ( diff --git a/e2e/tournament.spec.ts b/e2e/tournament.spec.ts index 055ca6f66a..d0b87fdd40 100644 --- a/e2e/tournament.spec.ts +++ b/e2e/tournament.spec.ts @@ -213,4 +213,28 @@ test.describe("Tournament", () => { data = await fetchTournamentLoaderData(); expect(data.tournament.ctx.teams.find((t) => t.id === 1)).toBeFalsy(); }); + + test("adjusts seeds", async ({ page }) => { + await seed(page); + await impersonate(page); + + await navigate({ + page, + url: `${tournamentPage(1)}/seeds`, + }); + + await page.getByTestId("seed-team-1").hover(); + await page.mouse.down(); + // i think the drag & drop library might actually be a bit buggy + // so we have to do it in steps like this to allow for testing + await page.mouse.move(0, 500, { steps: 10 }); + await page.mouse.up(); + + await submit(page); + + await page.getByTestId("teams-tab").click(); + await expect(page.getByTestId("team-name").first()).not.toHaveText( + "Chimera", + ); + }); });