From e41545ea3b05258e5af26f2c710e873c96f8a756 Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Fri, 7 Aug 2026 21:30:47 +0300 Subject: [PATCH] Fix SendouQ preview buttons showing --- app/features/sendouq/components/GroupCard.tsx | 24 +++++++---- e2e/pages/sendouq/sendouq-looking-page.ts | 11 ++++- e2e/sendouq.spec.ts | 40 +++++++++++++++++++ 3 files changed, 66 insertions(+), 9 deletions(-) diff --git a/app/features/sendouq/components/GroupCard.tsx b/app/features/sendouq/components/GroupCard.tsx index 7856d49be..5ce9d16f1 100644 --- a/app/features/sendouq/components/GroupCard.tsx +++ b/app/features/sendouq/components/GroupCard.tsx @@ -92,6 +92,9 @@ export function GroupCard({ ? resolveFutureMatchModes(ownGroup, group) : null; + // while previewing the queue the viewer has no group of their own to act with + const actionToShow = ownGroup ? action : undefined; + return ( ) : null} - {action || suggestable || trail ? ( + {actionToShow || suggestable || trail ? (
- {action ? ( + {actionToShow ? ( - {action === "MATCH_UP" || action === "MATCH_UP_RECHALLENGE" + {actionToShow === "MATCH_UP" || + actionToShow === "MATCH_UP_RECHALLENGE" ? t("q:looking.groups.actions.startMatch") - : action === "LIKE" && !group.members + : actionToShow === "LIKE" && !group.members ? t("q:looking.groups.actions.challenge") - : action === "LIKE" + : actionToShow === "LIKE" ? t("q:looking.groups.actions.invite") - : action === "GROUP_UP" + : actionToShow === "GROUP_UP" ? t("q:looking.groups.actions.groupUp") : t("q:looking.groups.actions.undo")} diff --git a/e2e/pages/sendouq/sendouq-looking-page.ts b/e2e/pages/sendouq/sendouq-looking-page.ts index aa3b88ee7..23cffa65c 100644 --- a/e2e/pages/sendouq/sendouq-looking-page.ts +++ b/e2e/pages/sendouq/sendouq-looking-page.ts @@ -1,5 +1,8 @@ import type { Page } from "@playwright/test"; -import { SENDOUQ_LOOKING_PAGE } from "~/utils/urls"; +import { + SENDOUQ_LOOKING_PAGE, + SENDOUQ_LOOKING_PREVIEW_PAGE, +} from "~/utils/urls"; import { navigate, submit } from "../../helpers/playwright"; import { GroupCard } from "./group-card"; @@ -12,6 +15,7 @@ export class SendouQLookingPage { this.locators = { groupCards: page.getByTestId("sendouq-group-card"), undoButtons: page.getByRole("button", { name: "Undo" }), + actionButtons: page.getByTestId("group-card-action-button"), suggestButtons: page.getByTestId("group-card-suggest-button"), }; } @@ -20,6 +24,11 @@ export class SendouQLookingPage { await navigate({ page: this.page, url: SENDOUQ_LOOKING_PAGE }); } + /** Opens the supporter only view of the queue, without being in it. */ + async gotoPreview() { + await navigate({ page: this.page, url: SENDOUQ_LOOKING_PREVIEW_PAGE }); + } + /** The own group's card, always the first one on the page. */ get ownGroupCard() { return this.groupCard(0); diff --git a/e2e/sendouq.spec.ts b/e2e/sendouq.spec.ts index 7b88d8f8b..4be5126e8 100644 --- a/e2e/sendouq.spec.ts +++ b/e2e/sendouq.spec.ts @@ -192,6 +192,46 @@ test.describe("SendouQ", () => { await isNotVisible(looking.locators.suggestButtons); }); + test("Previewing the queue shows the groups without any way to act on them", async ({ + page, + factories, + }) => { + const supporter = await factories.UserFactory.create(null, { + patronTier: 2, + }); + const [soloQueuer] = await factories.UserFactory.createMany(1); + const fullGroupMembers = + await factories.UserFactory.createMany(FULL_GROUP_SIZE); + await factories.SQGroupFactory.create({ memberUserIds: [soloQueuer.id] }); + await factories.SQGroupFactory.create({ + memberUserIds: fullGroupMembers.map((member) => member.id), + }); + + await impersonate(page, supporter.id); + + const looking = new SendouQLookingPage(page); + await looking.gotoPreview(); + + await expect(looking.locators.groupCards).toHaveCount(2); + // without a group of their own there is nothing to invite, challenge or suggest with + await isNotVisible(looking.locators.actionButtons); + await isNotVisible(looking.locators.suggestButtons); + }); + + test("Previewing the queue is only for supporters", async ({ + page, + factories, + }) => { + const [user] = await factories.UserFactory.createMany(1); + + await impersonate(page, user.id); + + const looking = new SendouQLookingPage(page); + await looking.gotoPreview(); + + await expect(page).toHaveURL(SENDOUQ_PAGE); + }); + test("Ready check flow - both groups confirm and the match starts", async ({ page, factories,