From d5dc8c18ec99d30fe7b8c45df6f06c11bd1f4780 Mon Sep 17 00:00:00 2001 From: EmmaLRussell Date: Fri, 3 Nov 2023 12:58:03 +0000 Subject: [PATCH] fix code e2e test --- app/static/tests/e2e/code.etest.ts | 4 +++- app/static/tests/e2e/sessions.etest.ts | 3 +-- app/static/tests/e2e/utils.ts | 2 ++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/static/tests/e2e/code.etest.ts b/app/static/tests/e2e/code.etest.ts index 15e5741ae..141819f94 100644 --- a/app/static/tests/e2e/code.etest.ts +++ b/app/static/tests/e2e/code.etest.ts @@ -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) @@ -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); @@ -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"); }); diff --git a/app/static/tests/e2e/sessions.etest.ts b/app/static/tests/e2e/sessions.etest.ts index 6fe334f25..624c2c391 100644 --- a/app/static/tests/e2e/sessions.etest.ts +++ b/app/static/tests/e2e/sessions.etest.ts @@ -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(); diff --git a/app/static/tests/e2e/utils.ts b/app/static/tests/e2e/utils.ts index fa2728309..5b176fc74 100644 --- a/app/static/tests/e2e/utils.ts +++ b/app/static/tests/e2e/utils.ts @@ -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