Skip to content

Commit

Permalink
Switch to no-animation for all e2e endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
rob-gordon committed Jul 20, 2024
1 parent f792631 commit ba64d7f
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions app/e2e/logged-in.spec.ts
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
11 changes: 3 additions & 8 deletions app/e2e/not-logged-in.spec.ts
Original file line number Diff line number Diff line change
@@ -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 */
Expand Down Expand Up @@ -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
Expand Down
15 changes: 10 additions & 5 deletions app/e2e/pro.spec.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -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 })
Expand All @@ -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" });
Expand Down Expand Up @@ -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" });
Expand Down
4 changes: 2 additions & 2 deletions app/e2e/sign-up.spec.ts
Original file line number Diff line number Diff line change
@@ -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 = "";
Expand All @@ -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 () => {
Expand Down
2 changes: 1 addition & 1 deletion app/e2e/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit ba64d7f

Please sign in to comment.