Skip to content

Commit

Permalink
fix tests + add e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
M-Kusumgar committed Sep 7, 2023
1 parent 22e000e commit a0851d0
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
32 changes: 32 additions & 0 deletions app/static/tests/e2e/stochastic.etest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,38 @@ test.describe("stochastic app", () => {
await expectSummaryValues(page, 16, "extinct", 1001, "#cc0044");
});

test.only("traces are hidden if replicates are above maxReplicatesDisplay", async ({ page }) => {
await page.fill(":nth-match(#run-options input, 2)", "20");
await expect(await page.locator(".run-tab .action-required-msg")).toHaveText(
"Plot is out of date: number of replicates has changed. Run model to update.", {
timeout
}
);

await page.click("#run-btn");
await expect(await page.locator(".run-tab .action-required-msg")).toHaveText("");

const summary = ".wodin-plot-data-summary-series";
expect(await page.locator(summary).count()).toBe(44);

await page.fill(":nth-match(#run-options input, 2)", "21");
await expect(await page.locator(".run-tab .action-required-msg")).toHaveText(
"Plot is out of date: number of replicates has changed. Run model to update.", {
timeout
}
);

await page.click("#run-btn");
await expect(await page.locator(".run-tab .action-required-msg")).toHaveText("");

expect(await page.locator(summary).count()).toBe(4);

await expectSummaryValues(page, 1, "I_det", 1001, "#2e5cb8");
await expectSummaryValues(page, 2, "I (mean)", 1001, "#6ab74d");
await expectSummaryValues(page, 3, "S (mean)", 1001, "#ee9f33");
await expectSummaryValues(page, 4, "extinct", 1001, "#cc0044");
});

test("can run stochastic sensitivity", async ({ page }) => {
// Open Sensitivity tab
await page.click(":nth-match(.wodin-right .nav-tabs a, 3)");
Expand Down
8 changes: 7 additions & 1 deletion app/static/tests/unit/components/options/runOptions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,13 @@ describe("RunOptions", () => {
});

it("renders number of replicates correctly", () => {
const wrapper = getWrapper(0, { appType: `${AppType.Stochastic}` });
const wrapper = getWrapper(0, {
appType: `${AppType.Stochastic}`,
config: {
maxReplicatesDisplay: 50,
maxReplicatesRun: 1000
}
});
const noOfReplicates = wrapper.find("#number-of-replicates").findComponent(NumericInput);
expect(noOfReplicates.props("value")).toBe(10);
expect(noOfReplicates.props("minAllowed")).toBe(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ describe("RunPlot for stochastic", () => {
endTime: 99,
numberOfReplicates: 20,
resultDiscrete: mockResult
},
config: {
maxReplicatesDisplay: 50,
maxReplicatesRun: 1000
}
} as any
});
Expand Down

0 comments on commit a0851d0

Please sign in to comment.