mirror of
https://github.com/lukevella/rallly.git
synced 2025-06-06 04:31:50 +02:00
parent
fc08d1b922
commit
4918aaef71
2 changed files with 25 additions and 7 deletions
|
@ -1,3 +1,5 @@
|
|||
const port = process.env.PORT || 3000;
|
||||
|
||||
const getVercelUrl = () => {
|
||||
return process.env.NEXT_PUBLIC_VERCEL_URL
|
||||
? `https://${process.env.NEXT_PUBLIC_VERCEL_URL}`
|
||||
|
@ -5,9 +7,9 @@ const getVercelUrl = () => {
|
|||
};
|
||||
|
||||
export function absoluteUrl(path = "") {
|
||||
return `${
|
||||
const baseUrl =
|
||||
process.env.NEXT_PUBLIC_BASE_URL ??
|
||||
getVercelUrl() ??
|
||||
"http://localhost:3000"
|
||||
}${path}`;
|
||||
`http://localhost:${port}`;
|
||||
return `${baseUrl}${path}`;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { expect, test } from "@playwright/test";
|
||||
import { load } from "cheerio";
|
||||
import smtpTester from "smtp-tester";
|
||||
|
||||
test.describe.serial(() => {
|
||||
|
@ -45,6 +46,16 @@ test.describe.serial(() => {
|
|||
|
||||
await page.click('text="Create poll"');
|
||||
|
||||
const title = page.getByTestId("poll-title");
|
||||
|
||||
await title.waitFor();
|
||||
|
||||
await expect(title).toHaveText("Monthly Meetup");
|
||||
|
||||
pollUrl = page.url();
|
||||
});
|
||||
|
||||
test("verify poll", async ({ page, baseURL }) => {
|
||||
const { email } = await mailServer.captureOne("john.doe@email.com", {
|
||||
wait: 5000,
|
||||
});
|
||||
|
@ -53,13 +64,18 @@ test.describe.serial(() => {
|
|||
"Rallly: Monthly Meetup - Verify your email address",
|
||||
);
|
||||
|
||||
const title = page.getByTestId("poll-title");
|
||||
const $ = load(email.html);
|
||||
const verifyLink = $("#verifyEmailUrl").attr("href");
|
||||
|
||||
await title.waitFor();
|
||||
expect(verifyLink).toContain(baseURL);
|
||||
|
||||
pollUrl = page.url();
|
||||
if (!verifyLink) {
|
||||
throw new Error("Could not get verification link from email");
|
||||
}
|
||||
|
||||
await expect(title).toHaveText("Monthly Meetup");
|
||||
await page.goto(verifyLink);
|
||||
|
||||
await expect(page.getByTestId("poll-title")).toHaveText("Monthly Meetup");
|
||||
});
|
||||
|
||||
// delete the poll we just created
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue