mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-04-24 23:19:39 -05:00
Team: More E2E tests
This commit is contained in:
parent
bb2f844ec8
commit
64874497fb
|
|
@ -11,6 +11,7 @@ export function SubmitButton({
|
|||
children,
|
||||
state,
|
||||
_action,
|
||||
testId,
|
||||
...rest
|
||||
}: SubmitButtonProps) {
|
||||
const transition = useTransition();
|
||||
|
|
@ -24,7 +25,7 @@ export function SubmitButton({
|
|||
type="submit"
|
||||
name={_action ? "_action" : undefined}
|
||||
value={_action}
|
||||
data-testid="submit-button"
|
||||
data-testid={testId ?? "submit-button"}
|
||||
>
|
||||
{children}
|
||||
</Button>
|
||||
|
|
|
|||
|
|
@ -147,7 +147,11 @@ export default function EditTeamPage() {
|
|||
dialogHeading={t("team:deleteTeam.header", { teamName: team.name })}
|
||||
fields={[["_action", "DELETE"]]}
|
||||
>
|
||||
<Button className="ml-auto" variant="minimal-destructive">
|
||||
<Button
|
||||
className="ml-auto"
|
||||
variant="minimal-destructive"
|
||||
data-testid="delete-team-button"
|
||||
>
|
||||
{t("team:actionButtons.deleteTeam")}
|
||||
</Button>
|
||||
</FormWithConfirm>
|
||||
|
|
|
|||
|
|
@ -174,7 +174,9 @@ function InviteCodeSection() {
|
|||
<div>
|
||||
<h2 className="text-lg">{t("team:roster.inviteLink.header")}</h2>
|
||||
<div className="stack md">
|
||||
<div className="text-sm">{inviteLink}</div>
|
||||
<div className="text-sm" data-testid="invite-link">
|
||||
{inviteLink}
|
||||
</div>
|
||||
<Form method="post" className="stack horizontal md">
|
||||
<Button size="tiny" onClick={() => copyToClipboard(inviteLink)}>
|
||||
{t("common:actions.copyToClipboard")}
|
||||
|
|
@ -183,6 +185,7 @@ function InviteCodeSection() {
|
|||
variant="minimal-destructive"
|
||||
_action="RESET_INVITE_LINK"
|
||||
size="tiny"
|
||||
testId="reset-invite-link-button"
|
||||
>
|
||||
{t("common:actions.reset")}
|
||||
</SubmitButton>
|
||||
|
|
|
|||
|
|
@ -213,7 +213,11 @@ function ActionButtons() {
|
|||
dialogHeading={t("team:leaveTeam.header", { teamName: team.name })}
|
||||
deleteButtonText={t("team:actionButtons.leaveTeam.confirm")}
|
||||
>
|
||||
<Button size="tiny" variant="destructive">
|
||||
<Button
|
||||
size="tiny"
|
||||
variant="destructive"
|
||||
data-testid="leave-team-button"
|
||||
>
|
||||
{t("team:actionButtons.leaveTeam")}
|
||||
</Button>
|
||||
</FormWithConfirm>
|
||||
|
|
|
|||
|
|
@ -93,7 +93,47 @@ test.describe("Team page", () => {
|
|||
await isNotVisible(page.getByTestId("manage-roster-button"));
|
||||
});
|
||||
|
||||
// resets inviteCode, copies it to clipboard, joins team, leaves, joins again
|
||||
test("deletes team", async ({ page }) => {
|
||||
await seed(page);
|
||||
await impersonate(page, 1);
|
||||
|
||||
// deletes team
|
||||
await navigate({ page, url: TEAM_SEARCH_PAGE });
|
||||
const firstTeamName = page.getByTestId("team-0");
|
||||
await firstTeamName.click();
|
||||
|
||||
await page.getByTestId("edit-team-button").click();
|
||||
await page.getByTestId("delete-team-button").click();
|
||||
await modalClickConfirmButton(page);
|
||||
|
||||
await expect(page).toHaveURL(TEAM_SEARCH_PAGE);
|
||||
await expect(page.getByTestId("team-0")).not.toHaveText("Alliance Rogue");
|
||||
});
|
||||
|
||||
test("resets invite code, joins team, leaves, rejoins", async ({ page }) => {
|
||||
await seed(page);
|
||||
await impersonate(page, 1);
|
||||
await navigate({ page, url: teamPage("alliance-rogue") });
|
||||
|
||||
await page.getByTestId("manage-roster-button").click();
|
||||
|
||||
const oldInviteLink = await page.getByTestId("invite-link").innerText();
|
||||
|
||||
await page.getByTestId("reset-invite-link-button").click();
|
||||
|
||||
await expect(page.getByTestId("invite-link")).not.toHaveText(oldInviteLink);
|
||||
const newInviteLink = await page.getByTestId("invite-link").innerText();
|
||||
|
||||
await impersonate(page, 2);
|
||||
|
||||
await navigate({ page, url: newInviteLink });
|
||||
await submit(page);
|
||||
|
||||
await page.getByTestId("leave-team-button").click();
|
||||
await modalClickConfirmButton(page);
|
||||
|
||||
await navigate({ page, url: newInviteLink });
|
||||
await submit(page);
|
||||
|
||||
await page.getByTestId("leave-team-button").isVisible();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user