Skip to content

Commit

Permalink
e2e test for reload from sessions page
Browse files Browse the repository at this point in the history
  • Loading branch information
EmmaLRussell committed Nov 8, 2023
1 parent 97cba33 commit 9fe0db9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
18 changes: 14 additions & 4 deletions app/static/tests/e2e/sessions.etest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ const expectNewFitCode = async (page: Page) => {
await expect(await page.innerText(editorSelector)).toContain("# JUST CHANGE A COMMENT");
};

const expectReloadedSession = async (page: Page) => {
await page.click(":nth-match(.wodin-left .nav-tabs a, 2)"); // select code tab
await expectNewFitCode(page);
await expect(await page.locator("#sessions-menu")).toHaveText("Session: session to reload");
};

test.describe("Sessions tests", () => {
const { timeout } = PlaywrightConfig;

Expand Down Expand Up @@ -312,10 +318,14 @@ test.describe("Sessions tests", () => {
await loadAppPage(page);
await expect(await page.locator("#session-initialise-modal .modal")).toBeVisible({ timeout });
await page.click("#reload-session");
await page.click(":nth-match(.wodin-left .nav-tabs a, 2)"); // select code tab
await expectNewFitCode(page);
await expect(await page.locator("#sessions-menu")).toHaveText("Session: session to reload");
await expectReloadedSession(page);

// navigate to sessions page - should also be able to reload from there
await page.goto(`${appUrl}/sessions`);
await page.waitForTimeout(saveSessionTimeout);
await page.click("#reload-session");
await expectReloadedSession(page);

await browser.close();
});
});
});
8 changes: 5 additions & 3 deletions app/static/tests/unit/serialiser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
mockModelFitState,
mockModelState, mockMultiSensitivityState,
mockRunState,
mockSensitivityState, mockVersionsState
mockSensitivityState, mockSessionsState, mockVersionsState
} from "../mocks";
import { defaultState as defaultGraphSettingsState } from "../../src/app/store/graphSettings/graphSettings";
import { Language } from "../../src/app/types/languageTypes";
Expand Down Expand Up @@ -332,14 +332,15 @@ describe("serialise", () => {
showDuplicateSessions: false
};

const sessionsState = {
const sessionsState = mockSessionsState({
sessionsMetadata: []
};
});

const basicState: BasicState = {
sessionId: "1234",
sessionLabel: null,
config: null,
loadSessionId: null,
appName: "test app",
baseUrl: null,
appsPath: null,
Expand Down Expand Up @@ -369,6 +370,7 @@ describe("serialise", () => {
sessionId: "5678",
sessionLabel: null,
config: null,
loadSessionId: null,
appName: "test fit app",
baseUrl: null,
appsPath: null,
Expand Down

0 comments on commit 9fe0db9

Please sign in to comment.