Skip to content

Commit

Permalink
chore: add csp wait
Browse files Browse the repository at this point in the history
  • Loading branch information
JBR90 committed Dec 17, 2024
1 parent ebe31a9 commit 3fb672f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions apps/nextjs/tests-e2e/tests/chat-performance.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { expect, test, type Page } from "@playwright/test";
import { test as base } from "@playwright/test";

import { TEST_BASE_URL } from "../config/config";
import { prepareUser } from "../helpers/auth";
import { cspSafeWaitForFunction } from "../helpers/auth/clerkHelpers";
import { bypassVercelProtection } from "../helpers/vercel";
import { isFinished } from "./aila-chat/helpers";

Expand Down Expand Up @@ -70,17 +70,21 @@ test.describe("Component renders during lesson chat", () => {
// window.process.env.NEXT_PUBLIC_ENABLE_RENDER_SCAN = "true";
// }

await page.waitForTimeout(5000);

console.log("Checking injected flag...");
const renderScanEnabled = await page.evaluate(
() => window.NEXT_PUBLIC_ENABLE_RENDER_SCAN,
);
console.log("Render Scan Enabled:", renderScanEnabled); // Debug check

await page.waitForFunction(
await cspSafeWaitForFunction(
page,
() =>
window.reactScanLessonPlanDisplay &&
typeof window.reactScanLessonPlanDisplay.renderCount === "number",
);

const textbox = page.getByTestId("chat-input");
const message = "Create a KS1 lesson on the end of Roman Britain";
const initialRenderAmount: number = await page.evaluate(
Expand Down

0 comments on commit 3fb672f

Please sign in to comment.