From ba64d7fa24f323abecf5ed0bd7c8a780c6be13f0 Mon Sep 17 00:00:00 2001 From: Rob Gordon Date: Sat, 20 Jul 2024 17:13:23 -0400 Subject: [PATCH] Switch to no-animation for all e2e endpoints --- app/e2e/logged-in.spec.ts | 4 ++-- app/e2e/not-logged-in.spec.ts | 11 +++-------- app/e2e/pro.spec.ts | 15 ++++++++++----- app/e2e/sign-up.spec.ts | 4 ++-- app/e2e/utils.ts | 2 +- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/app/e2e/logged-in.spec.ts b/app/e2e/logged-in.spec.ts index 38fd89a65..5fbe6dec9 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 6b6e184a2..4e6acd44e 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 44393fab7..7e16cc699 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 5c52a14cd..055a2cb4a 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 bf317ff59..871b99892 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) {