mirror of
https://github.com/lukevella/rallly.git
synced 2025-08-06 09:59:00 +02:00
Add test
This commit is contained in:
parent
3c959eba2b
commit
30f6d0d447
4 changed files with 13 additions and 9 deletions
|
@ -1,6 +1,5 @@
|
|||
import { expect, test } from "@playwright/test";
|
||||
import { prisma } from "@rallly/database";
|
||||
import { nanoid } from "@rallly/utils/nanoid";
|
||||
|
||||
import { encode } from "./helpers/next-auth-v4";
|
||||
|
||||
|
@ -12,8 +11,8 @@ test.describe.serial(() => {
|
|||
data: {
|
||||
id: "legacy-guest-poll",
|
||||
title: "Test Poll",
|
||||
adminUrlId: nanoid(),
|
||||
participantUrlId: nanoid(),
|
||||
adminUrlId: "admin-url-id",
|
||||
participantUrlId: "participant-url-id",
|
||||
guestId: legacyGuestId,
|
||||
},
|
||||
});
|
||||
|
@ -28,7 +27,7 @@ test.describe.serial(() => {
|
|||
|
||||
test("should see poll on login page", async ({ page }) => {
|
||||
const context = page.context();
|
||||
const token = await encode({
|
||||
const legacyToken = await encode({
|
||||
token: {
|
||||
sub: legacyGuestId,
|
||||
},
|
||||
|
@ -39,15 +38,19 @@ test.describe.serial(() => {
|
|||
await context.addCookies([
|
||||
{
|
||||
name: "next-auth.session-token",
|
||||
value: token,
|
||||
value: legacyToken,
|
||||
httpOnly: true,
|
||||
expires: Date.now() / 1000 + 60 * 60 * 24 * 7,
|
||||
secure: false,
|
||||
sameSite: "Lax",
|
||||
path: "/",
|
||||
domain: "localhost",
|
||||
path: "/",
|
||||
},
|
||||
]);
|
||||
await page.goto("/login");
|
||||
|
||||
await page.goto("/");
|
||||
|
||||
// Check if the poll title exists in the page content
|
||||
await expect(page.getByText("Test Poll")).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue