Skip to content

Commit

Permalink
fix code e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
EmmaLRussell committed Nov 3, 2023
1 parent 591db54 commit d5dc8c1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion app/static/tests/e2e/code.etest.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect, test, Page } from "@playwright/test";
import PlaywrightConfig from "../../playwright.config";
import { writeCode } from "./utils";
import {saveSessionTimeout, writeCode} from "./utils";

export const newValidCode = `## Derivatives
deriv(y1) <- sigma * (y2 - y1)
Expand Down Expand Up @@ -219,6 +219,7 @@ test.describe("Code Tab tests", () => {
});

test("can reset code editor ", async ({ page }) => {
await page.waitForTimeout(saveSessionTimeout);
const defaultCode = await page.innerText(".wodin-left .wodin-content .editor-container");
const invalidCode = "faker\n";
await writeCode(page, invalidCode);
Expand All @@ -232,6 +233,7 @@ test.describe("Code Tab tests", () => {
await expect(await page.innerText(".wodin-left .wodin-content #code-status")).toContain("Code is not valid");
await page.click("#reset-btn");
await page.waitForResponse((response) => response.url().includes("/odin"));
await page.waitForTimeout(saveSessionTimeout);
expect(await page.innerText(".wodin-left .wodin-content .editor-container")).toBe(defaultCode);
await expect(await page.innerText(".wodin-left .wodin-content #code-status")).toContain("Code is valid");
});
Expand Down
3 changes: 1 addition & 2 deletions app/static/tests/e2e/sessions.etest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@ import {
realisticFitData,
startModelFit,
waitForModelFitCompletion, expectWodinPlotDataSummary,
expectCanRunMultiSensitivity
expectCanRunMultiSensitivity, saveSessionTimeout
} from "./utils";
import PlaywrightConfig from "../../playwright.config";

const appUrl = "/apps/day2";
const saveSessionTimeout = 3000;

const enterSessionLabel = async (page: Page, dialogId: string, newLabel: string) => {
await expect(await page.locator(`#${dialogId} #edit-session-label label`)).toBeVisible();
Expand Down
2 changes: 2 additions & 0 deletions app/static/tests/e2e/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { expect, Page, Locator } from "@playwright/test";

export const saveSessionTimeout = 3000;

export const newFitCode = `# JUST CHANGE A COMMENT
initial(S) <- N - I_0
initial(E) <- 0
Expand Down

0 comments on commit d5dc8c1

Please sign in to comment.