Debug failing test

This commit is contained in:
Hariom Balhara 2022-03-12 08:56:38 +05:30
parent 04293a25ca
commit 77f3c0cb50
5 changed files with 7 additions and 3 deletions

View File

@ -18,6 +18,7 @@ if (!process.env.NEXT_PUBLIC_APP_URL) {
process.env.NEXT_PUBLIC_APP_URL = process.env.BASE_URL;
}
process.env.NEXT_PUBLIC_BASE_URL = process.env.BASE_URL;
console.warn("VARS", process.env.PLAYWRIGHT_SECRET);
if (!process.env.EMAIL_FROM) {
console.warn(

View File

@ -63,14 +63,16 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
};
await sendPasswordResetEmail(passwordEmail);
console.log("FORGOT PASSWORD", process.env.PLAYWRIGHT_SECRET);
/** So we can test the password reset flow on CI */
if (
process.env.PLAYWRIGHT_SECRET &&
req.headers["x-playwright-secret"] === process.env.PLAYWRIGHT_SECRET
) {
console.log("MATCH PLAYWRIGHT_SECRET", process.env.PLAYWRIGHT_SECRET);
return res.status(201).json({ message: "Reset Requested", resetLink });
}
console.log("NOMATCH PLAYWRIGHT_SECRET", process.env.PLAYWRIGHT_SECRET);
return res.status(201).json({ message: "Reset Requested" });
} catch (reason) {

View File

@ -1,7 +1,8 @@
import { expect, test } from "@playwright/test";
test("Can reset forgotten password", async ({ browser }) => {
test.only("Can reset forgotten password", async ({ browser }) => {
// Create a new incognito browser context
console.log("PLAYWRIGHT", process.env.PLAYWRIGHT_SECRET);
const context = await browser.newContext({
extraHTTPHeaders: {
// Only needed for bypassing emails while testing

0
packages/prisma/zod/webhook.ts Normal file → Executable file
View File

View File

@ -18,7 +18,7 @@ const outputDir = path.join(__dirname, "..", "..", "test-results");
const testDir = path.join(__dirname, "..", "..", "apps/web/playwright");
const config: PlaywrightTestConfig = {
forbidOnly: !!process.env.CI,
forbidOnly: false,
timeout: 60_000,
reporter: [
[process.env.CI ? "github" : "list"],