Skip to content

Commit

Permalink
🧪 Add legacy token conversion test
Browse files Browse the repository at this point in the history
  • Loading branch information
lukevella committed Nov 4, 2023
1 parent e658503 commit 1cf242d
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions apps/web/tests/legacy-token.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import test, { expect } from "@playwright/test";
import { sealData } from "iron-session";

/**
* This test checks that a legacy token can be used to sign in.
*/
test("should convert guest legacy token", async ({ browser }) => {
const context = await browser.newContext();
const guestLegacyToken = await sealData(
{
user: {
id: "user-1234",
isGuest: true,
},
},
{
password: process.env.SECRET_PASSWORD,
},
);
await context.addCookies([
{
name: "rallly-session",
value: guestLegacyToken,
httpOnly: true,
url: process.env.NEXT_PUBLIC_BASE_URL,
},
]);
const page = await context.newPage();
await page.goto("/polls");
await page.getByTestId("user-dropdown").click();
await expect(page.locator("text=user-1234")).toBeVisible();
});

1 comment on commit 1cf242d

@vercel
Copy link

@vercel vercel bot commented on 1cf242d Nov 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

app – ./

app-git-main-rallly.vercel.app
app-rallly.vercel.app
rallly-vert.vercel.app
app.rallly.co

Please sign in to comment.