diff --git a/app/e2e/logged-in.spec.ts b/app/e2e/logged-in.spec.ts index 38fd89a6..5fbe6dec 100644 --- a/app/e2e/logged-in.spec.ts +++ b/app/e2e/logged-in.spec.ts @@ -1,9 +1,9 @@ import { test, expect } from "@playwright/test"; -import { BASE_URL, TESTING_EMAIL, TESTING_PASSWORD } from "./utils"; +import { TESTING_EMAIL, TESTING_PASSWORD, goToPath } from "./utils"; /* Log In */ test.beforeEach(async ({ page }) => { - await page.goto(BASE_URL); + await goToPath(page); await page.getByRole("link", { name: "Log In" }).click(); await page.getByTestId("sign-in-email").click(); await page.getByTestId("sign-in-email").fill(TESTING_EMAIL); diff --git a/app/e2e/not-logged-in.spec.ts b/app/e2e/not-logged-in.spec.ts index 6b6e184a..4e6acd44 100644 --- a/app/e2e/not-logged-in.spec.ts +++ b/app/e2e/not-logged-in.spec.ts @@ -1,13 +1,8 @@ import { test, expect } from "@playwright/test"; -import { BASE_URL, changeEditorText } from "./utils"; - -// Add this constant for the no-animation URL -const NO_ANIMATION_URL = `${BASE_URL}?skipAnimation=true`; +import { changeEditorText, goToPath } from "./utils"; test.beforeEach(async ({ page }) => { - // Update the beforeEach hook to use the NO_ANIMATION_URL - console.log(`Going to ${NO_ANIMATION_URL}`); - await page.goto(NO_ANIMATION_URL); + await goToPath(page); }); /* Everything the user can do when not logged in */ @@ -124,7 +119,7 @@ test("cannot do things when not logged in", async ({ page }) => { test("Cannot load a file", async ({ page }) => { // Update this test to use NO_ANIMATION_URL - await page.goto(NO_ANIMATION_URL); + await goToPath(page); await page.getByTestId("load-file-button").click(); await page.getByRole("button", { name: "Learn More" }).click(); // expect to be at /pricing diff --git a/app/e2e/pro.spec.ts b/app/e2e/pro.spec.ts index 44393fab..7e16cc69 100644 --- a/app/e2e/pro.spec.ts +++ b/app/e2e/pro.spec.ts @@ -1,5 +1,10 @@ import { test, expect, Page } from "@playwright/test"; -import { BASE_URL, TESTING_EMAIL_PRO, TESTING_PASS_PRO } from "./utils"; +import { + BASE_URL, + TESTING_EMAIL_PRO, + TESTING_PASS_PRO, + goToPath, +} from "./utils"; import path from "path"; let page: Page; @@ -12,7 +17,7 @@ test.skip(({ browserName }) => browserName !== "chromium", "Chrome Only"); /* Log In */ test.beforeAll(async ({ browser }) => { page = await browser.newPage(); - await page.goto(BASE_URL); + await goToPath(page); await page.getByRole("link", { name: "Log In" }).click(); await page.getByTestId("sign-in-email").click(); await page.getByTestId("sign-in-email").fill(TESTING_EMAIL_PRO); @@ -74,7 +79,7 @@ test("Publish Chart & Clone from Public", async () => { }); test("Open Chart From Charts Page", async () => { - await page.goto(BASE_URL); + await goToPath(page); await page.getByRole("link", { name: "Charts" }).click(); await page .getByRole("link", { name: /to publish.*/gi }) @@ -94,7 +99,7 @@ test("Download SVG", async () => { }); test("Go to Sandbox. Save Sandbox Chart", async () => { - await page.goto(BASE_URL); + await goToPath(page); // wait for the test-id "pro-link" to disappear await page.getByTestId("pro-link").waitFor({ state: "detached" }); @@ -174,7 +179,7 @@ test("Create chart from imported data", async () => { }); test("Can load a file", async () => { - await page.goto(BASE_URL); + await goToPath(page); // wait for the test-id "pro-link" to disappear await page.getByTestId("pro-link").waitFor({ state: "detached" }); diff --git a/app/e2e/sign-up.spec.ts b/app/e2e/sign-up.spec.ts index 5c52a14c..055a2cb4 100644 --- a/app/e2e/sign-up.spec.ts +++ b/app/e2e/sign-up.spec.ts @@ -1,7 +1,7 @@ import { expect, Page, test } from "@playwright/test"; import jsdom from "jsdom"; -import { BASE_URL, getTempEmail, getTempEmailMessage } from "./utils"; +import { BASE_URL, getTempEmail, getTempEmailMessage, goToPath } from "./utils"; let page: Page; let email = ""; @@ -16,7 +16,7 @@ test.skip(); test.beforeAll(async ({ browser }) => { page = await browser.newPage(); - await page.goto(BASE_URL); + await goToPath(page); }); test.afterAll(async () => { diff --git a/app/e2e/utils.ts b/app/e2e/utils.ts index bf317ff5..871b9989 100644 --- a/app/e2e/utils.ts +++ b/app/e2e/utils.ts @@ -17,7 +17,7 @@ export const BASE_URL = process.env.E2E_START_URL ?? "http://localhost:3000"; const EMAIL_DOMAINS_LIST: string[] = []; export async function goToPath(page: Page, path = "") { - await page.goto(`${BASE_URL}/${path}`); + await page.goto(`${BASE_URL}${path ? `/${path}` : ""}?skipAnimation=true`); } export async function goToTab(page: Page, tabName: string) {