From bda7c21b5547391b5ef8ff9635bb04c6dd4915c9 Mon Sep 17 00:00:00 2001 From: EmmaLRussell Date: Thu, 24 Aug 2023 17:00:11 +0100 Subject: [PATCH 01/17] configure user value variation type --- .../components/options/EditParamSettings.vue | 39 +++++++++++++++---- .../components/options/SensitivityOptions.vue | 13 +++++-- .../src/app/store/sensitivity/sensitivity.ts | 3 +- app/static/src/app/store/sensitivity/state.ts | 6 ++- 4 files changed, 48 insertions(+), 13 deletions(-) diff --git a/app/static/src/app/components/options/EditParamSettings.vue b/app/static/src/app/components/options/EditParamSettings.vue index aa243e233..772c1bfad 100644 --- a/app/static/src/app/components/options/EditParamSettings.vue +++ b/app/static/src/app/components/options/EditParamSettings.vue @@ -49,7 +49,7 @@ @update="(n) => settingsInternal.variationPercentage = n"> - -
+
@@ -198,7 +198,6 @@ export default defineComponent({ const close = () => { emit("close"); }; const updateSettings = () => { - console.log("updating settings") store.commit(`sensitivity/${SensitivityMutation.SetParamSettings}`, { ...settingsInternal }); close(); }; diff --git a/app/static/tests/unit/components/options/editParamSettings.test.ts b/app/static/tests/unit/components/options/editParamSettings.test.ts index 8b9f3d598..052cf3e8b 100644 --- a/app/static/tests/unit/components/options/editParamSettings.test.ts +++ b/app/static/tests/unit/components/options/editParamSettings.test.ts @@ -123,9 +123,10 @@ describe("EditParamSettings", () => { const paramSelect = wrapper.find("#edit-param-to-vary select"); expect((paramSelect.element as HTMLSelectElement).value).toBe("B"); const paramOptions = paramSelect.findAll("option"); - expect(paramOptions.length).toBe(2); + expect(paramOptions.length).toBe(3); expect(paramOptions.at(0)!.text()).toBe("A"); expect(paramOptions.at(1)!.text()).toBe("B"); + expect(paramOptions.at(2)!.text()).toBe("C"); expect(wrapper.find("#edit-scale-type label").text()).toBe("Scale type"); const scaleSelect = wrapper.find("#edit-scale-type select"); @@ -139,9 +140,10 @@ describe("EditParamSettings", () => { const varSelect = wrapper.find("#edit-variation-type select"); expect((varSelect.element as HTMLSelectElement).value).toBe(SensitivityVariationType.Percentage); const varOptions = varSelect.findAll("option"); - expect(varOptions.length).toBe(2); + expect(varOptions.length).toBe(3); expect(varOptions.at(0)!.text()).toBe(SensitivityVariationType.Percentage); expect(varOptions.at(1)!.text()).toBe(SensitivityVariationType.Range); + expect(varOptions.at(2)!.text()).toBe(SensitivityVariationType.User); expect(wrapper.find("#edit-percent label").text()).toBe("Variation (%)"); expect(wrapper.find("#edit-percent").findComponent(NumericInput).props("value")).toBe(10); @@ -253,7 +255,8 @@ describe("EditParamSettings", () => { variationPercentage: 15, rangeFrom: 1, rangeTo: 3, - numberOfRuns: 11 + numberOfRuns: 11, + userValues: [] }); }); diff --git a/app/static/tests/unit/serialiser.test.ts b/app/static/tests/unit/serialiser.test.ts index 4d089c0fa..6a84b59f1 100644 --- a/app/static/tests/unit/serialiser.test.ts +++ b/app/static/tests/unit/serialiser.test.ts @@ -156,7 +156,8 @@ describe("serialise", () => { variationPercentage: 50, rangeFrom: 0, rangeTo: 1, - numberOfRuns: 5 + numberOfRuns: 5, + userValues: [] }, sensitivityUpdateRequired: { modelChanged: false, From f12f236d87f6b938e30f5536de1ae30c59373ce2 Mon Sep 17 00:00:00 2001 From: EmmaLRussell Date: Fri, 25 Aug 2023 00:35:51 +0100 Subject: [PATCH 08/17] lint --- app/static/src/app/utils.ts | 17 ++++++++--------- .../options/editParamSettings.test.ts | 6 +++--- .../unit/components/options/tagInput.test.ts | 2 +- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/app/static/src/app/utils.ts b/app/static/src/app/utils.ts index 4bd56128a..b7422df52 100644 --- a/app/static/src/app/utils.ts +++ b/app/static/src/app/utils.ts @@ -1,5 +1,5 @@ -import {uid} from "uid"; -import {Dict} from "./types/utilTypes"; +import { uid } from "uid"; +import { Dict } from "./types/utilTypes"; import { AdvancedOptions, AdvancedSettingsOdin, @@ -10,9 +10,10 @@ import { } from "./types/responseTypes"; import userMessages from "./userMessages"; import settings from "./settings"; -import {SensitivityParameterSettings, SensitivityScaleType, SensitivityVariationType} from "./store/sensitivity/state"; -import {AppState} from "./store/appState/state"; -import {AdvancedComponentType, AdvancedSettings, Tag} from "./store/run/state"; +import { SensitivityParameterSettings, SensitivityScaleType, SensitivityVariationType } + from "./store/sensitivity/state"; +import { AppState } from "./store/appState/state"; +import { AdvancedComponentType, AdvancedSettings, Tag } from "./store/run/state"; export const freezer = { /* eslint-disable @typescript-eslint/no-explicit-any */ @@ -184,8 +185,7 @@ export function generateBatchPars( let errorDetail = null; if (!paramSettings.parameterToVary) { errorDetail = "Parameter to vary is not set"; - } - else if (!rootState.model.odinRunnerOde || !paramValues) { + } else if (!rootState.model.odinRunnerOde || !paramValues) { errorDetail = "Model is not initialised"; } if (errorDetail) { @@ -205,9 +205,8 @@ export function generateBatchPars( batchPars, error: null }; - } else { - return generateBatchParsFromOdin(rootState, paramSettings, paramValues!); } + return generateBatchParsFromOdin(rootState, paramSettings, paramValues!); } export const newSessionId = (): string => uid(32); diff --git a/app/static/tests/unit/components/options/editParamSettings.test.ts b/app/static/tests/unit/components/options/editParamSettings.test.ts index 052cf3e8b..a53d96899 100644 --- a/app/static/tests/unit/components/options/editParamSettings.test.ts +++ b/app/static/tests/unit/components/options/editParamSettings.test.ts @@ -1,5 +1,6 @@ import Vuex from "vuex"; import { mount, VueWrapper } from "@vue/test-utils"; +import { nextTick } from "vue"; import { SensitivityParameterSettings, SensitivityScaleType, @@ -16,7 +17,6 @@ import SensitivityParamValues from "../../../../src/app/components/options/Sensi import { expectCloseNumericArray } from "../../../testUtils"; import TagInput from "../../../../src/app/components/options/TagInput.vue"; import ErrorInfo from "../../../../src/app/components/ErrorInfo.vue"; -import {nextTick} from "vue"; const mockTooltipDirective = jest.fn(); @@ -314,7 +314,7 @@ describe("EditParamSettings", () => { }); it("test set", () => { - const cleaned = [...new Set([1, 2, 1])].sort() - expect(cleaned).toStrictEqual([1, 2]) + const cleaned = [...new Set([1, 2, 1])].sort(); + expect(cleaned).toStrictEqual([1, 2]); }); }); diff --git a/app/static/tests/unit/components/options/tagInput.test.ts b/app/static/tests/unit/components/options/tagInput.test.ts index 7538eaa7a..a08205055 100644 --- a/app/static/tests/unit/components/options/tagInput.test.ts +++ b/app/static/tests/unit/components/options/tagInput.test.ts @@ -76,7 +76,7 @@ describe("Tag Input", () => { }); it("renders as expected when numeric only is true", () => { - const wrapper = getWrapper({ ...defaultProps, numericOnly: true}); + const wrapper = getWrapper({ ...defaultProps, numericOnly: true }); const tagsInput = wrapper.findComponent(VueTagsInput); // should filter out non-numeric tags expect(tagsInput.props("tags")).toStrictEqual(["1", "2"]); From 0783bee4e42524fb994da69e8564a473824d41c8 Mon Sep 17 00:00:00 2001 From: EmmaLRussell Date: Fri, 25 Aug 2023 00:44:25 +0100 Subject: [PATCH 09/17] getter test fix --- app/static/tests/unit/store/sensitivity/getters.test.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/static/tests/unit/store/sensitivity/getters.test.ts b/app/static/tests/unit/store/sensitivity/getters.test.ts index 2ee7a72b4..b22f6c2c2 100644 --- a/app/static/tests/unit/store/sensitivity/getters.test.ts +++ b/app/static/tests/unit/store/sensitivity/getters.test.ts @@ -10,7 +10,8 @@ describe("Sensitivity getters", () => { variationPercentage: 50, rangeFrom: 0, rangeTo: 0, - numberOfRuns: 3 + numberOfRuns: 3, + userValues: [] }; it("generates batchPars", () => { From 13ad200fc6a7bdec50fb96a71bf5c4700f13f656 Mon Sep 17 00:00:00 2001 From: EmmaLRussell Date: Fri, 25 Aug 2023 09:50:13 +0100 Subject: [PATCH 10/17] e2e test --- app/static/tests/e2e/sensitivity.etest.ts | 36 +++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/app/static/tests/e2e/sensitivity.etest.ts b/app/static/tests/e2e/sensitivity.etest.ts index 63fcc41c5..83a35d7e8 100644 --- a/app/static/tests/e2e/sensitivity.etest.ts +++ b/app/static/tests/e2e/sensitivity.etest.ts @@ -229,4 +229,40 @@ test.describe("Sensitivity tests", () => { await expectSummaryValues(page, 65, "I (Set 1)", 1000, "#cccc00", "dot", "0", "100", "0", "0"); await expectSummaryValues(page, 66, "R (Set 1)", 1000, "#cc0044", "dot", "0", "100", "0", "0"); }); + + test("can change sensitivity settings to User variation, and see values in Sensitivity plot", async ({ page }) => { + await page.click("#sensitivity-options .btn-primary"); + await expect(await page.locator("#edit-param .modal")).toBeVisible(); + const varSelect = await page.locator("#edit-variation-type select"); + await varSelect.selectOption("User"); + await expect(await page.innerText("#invalid-msg")) + .toBe("Invalid settings: Must include at least 2 traces in the batch"); + + const tagInput = await page.locator("#edit-values input"); + await tagInput.press("1"); + await tagInput.press(","); + await tagInput.press("2"); + await tagInput.press(","); + await tagInput.press("3"); + await tagInput.press(","); + + await page.waitForTimeout(100) + await expect(await page.locator("#invalid-msg").count()).toBe(0); + await expect(await page.locator(".modal .alert-success").count()).toBe(0); + + await page.click("#ok-settings"); + + // run and see traces summary + await page.click("#run-sens-btn"); + await expectSummaryValues(page, 1, "S (beta=1.000)", 1000, "#2e5cb8"); + await expectSummaryValues(page, 2, "I (beta=1.000)", 1000, "#cccc00"); + await expectSummaryValues(page, 3, "R (beta=1.000)", 1000, "#cc0044"); + await expectSummaryValues(page, 4, "S (beta=2.000)", 1000, "#2e5cb8"); + await expectSummaryValues(page, 5, "I (beta=2.000)", 1000, "#cccc00"); + await expectSummaryValues(page, 6, "R (beta=2.000)", 1000, "#cc0044"); + await expectSummaryValues(page, 7, "S (beta=3.000)", 1000, "#2e5cb8"); + await expectSummaryValues(page, 8, "I (beta=3.000)", 1000, "#cccc00"); + await expectSummaryValues(page, 9, "R (beta=3.000)", 1000, "#cc0044"); + + }); }); From 271eed2ae63f4e6795b391c8389f983657c31da8 Mon Sep 17 00:00:00 2001 From: EmmaLRussell Date: Fri, 25 Aug 2023 09:53:16 +0100 Subject: [PATCH 11/17] lint --- app/static/tests/e2e/sensitivity.etest.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/static/tests/e2e/sensitivity.etest.ts b/app/static/tests/e2e/sensitivity.etest.ts index 83a35d7e8..e80b7b6b3 100644 --- a/app/static/tests/e2e/sensitivity.etest.ts +++ b/app/static/tests/e2e/sensitivity.etest.ts @@ -246,7 +246,7 @@ test.describe("Sensitivity tests", () => { await tagInput.press("3"); await tagInput.press(","); - await page.waitForTimeout(100) + await page.waitForTimeout(100); await expect(await page.locator("#invalid-msg").count()).toBe(0); await expect(await page.locator(".modal .alert-success").count()).toBe(0); @@ -263,6 +263,5 @@ test.describe("Sensitivity tests", () => { await expectSummaryValues(page, 7, "S (beta=3.000)", 1000, "#2e5cb8"); await expectSummaryValues(page, 8, "I (beta=3.000)", 1000, "#cccc00"); await expectSummaryValues(page, 9, "R (beta=3.000)", 1000, "#cc0044"); - }); }); From 864cf95a9ac62eb58469e6dba4873c30231709c9 Mon Sep 17 00:00:00 2001 From: EmmaLRussell Date: Fri, 25 Aug 2023 10:32:51 +0100 Subject: [PATCH 12/17] rename User variation type to Custom --- .../components/options/EditParamSettings.vue | 20 +++++------ .../components/options/SensitivityOptions.vue | 10 +++--- .../src/app/store/sensitivity/sensitivity.ts | 2 +- app/static/src/app/store/sensitivity/state.ts | 4 +-- app/static/src/app/utils.ts | 4 +-- app/static/tests/e2e/sensitivity.etest.ts | 4 +-- app/static/tests/mocks.ts | 2 +- .../options/editParamSettings.test.ts | 34 +++++++++---------- .../options/sensitivityOptions.test.ts | 12 +++---- app/static/tests/unit/serialiser.test.ts | 2 +- app/static/tests/unit/utils.test.ts | 14 ++++---- 11 files changed, 54 insertions(+), 54 deletions(-) diff --git a/app/static/src/app/components/options/EditParamSettings.vue b/app/static/src/app/components/options/EditParamSettings.vue index 4f6bfa4be..83adac4c7 100644 --- a/app/static/src/app/components/options/EditParamSettings.vue +++ b/app/static/src/app/components/options/EditParamSettings.vue @@ -18,7 +18,7 @@
-
+
@@ -77,18 +77,18 @@
- -
  • +
  • Values: - {{ settings.userValues.join(", ") }} + {{ settings.customValues.join(", ") }}
  • -
  • +
  • Number of runs: {{ settings.numberOfRuns}}
  • - +
    diff --git a/app/static/src/app/store/sensitivity/sensitivity.ts b/app/static/src/app/store/sensitivity/sensitivity.ts index 2c28ad851..5adb5852c 100644 --- a/app/static/src/app/store/sensitivity/sensitivity.ts +++ b/app/static/src/app/store/sensitivity/sensitivity.ts @@ -18,7 +18,7 @@ export const defaultState: SensitivityState = { rangeFrom: 0, rangeTo: 0, numberOfRuns: 10, - userValues: [] + customValues: [] }, plotSettings: { plotType: SensitivityPlotType.TraceOverTime, diff --git a/app/static/src/app/store/sensitivity/state.ts b/app/static/src/app/store/sensitivity/state.ts index 04971154a..0c0fd224c 100644 --- a/app/static/src/app/store/sensitivity/state.ts +++ b/app/static/src/app/store/sensitivity/state.ts @@ -9,7 +9,7 @@ export enum SensitivityScaleType { export enum SensitivityVariationType { Percentage = "Percentage", Range = "Range", - User = "User" + Custom = "Custom" } export interface SensitivityParameterSettings { @@ -20,7 +20,7 @@ export interface SensitivityParameterSettings { rangeFrom: number, rangeTo: number, numberOfRuns: number, - userValues: number[] + customValues: number[] } export enum SensitivityPlotType { diff --git a/app/static/src/app/utils.ts b/app/static/src/app/utils.ts index b7422df52..f1714fd36 100644 --- a/app/static/src/app/utils.ts +++ b/app/static/src/app/utils.ts @@ -195,11 +195,11 @@ export function generateBatchPars( }; } - if (paramSettings.variationType === SensitivityVariationType.User) { + if (paramSettings.variationType === SensitivityVariationType.Custom) { const batchPars: BatchPars = { base: paramValues!, name: paramSettings.parameterToVary!, - values: paramSettings.userValues + values: paramSettings.customValues }; return { batchPars, diff --git a/app/static/tests/e2e/sensitivity.etest.ts b/app/static/tests/e2e/sensitivity.etest.ts index e80b7b6b3..fccdbee99 100644 --- a/app/static/tests/e2e/sensitivity.etest.ts +++ b/app/static/tests/e2e/sensitivity.etest.ts @@ -230,11 +230,11 @@ test.describe("Sensitivity tests", () => { await expectSummaryValues(page, 66, "R (Set 1)", 1000, "#cc0044", "dot", "0", "100", "0", "0"); }); - test("can change sensitivity settings to User variation, and see values in Sensitivity plot", async ({ page }) => { + test("can change sensitivity settings to Custom variation, and see values in plot", async ({ page }) => { await page.click("#sensitivity-options .btn-primary"); await expect(await page.locator("#edit-param .modal")).toBeVisible(); const varSelect = await page.locator("#edit-variation-type select"); - await varSelect.selectOption("User"); + await varSelect.selectOption("Custom"); await expect(await page.innerText("#invalid-msg")) .toBe("Invalid settings: Must include at least 2 traces in the batch"); diff --git a/app/static/tests/mocks.ts b/app/static/tests/mocks.ts index f2c5f0134..3afb6791d 100644 --- a/app/static/tests/mocks.ts +++ b/app/static/tests/mocks.ts @@ -158,7 +158,7 @@ export const mockSensitivityState = (state: Partial = {}): Sen rangeFrom: 0, rangeTo: 0, numberOfRuns: 10, - userValues: [] + customValues: [] }, plotSettings: { plotType: SensitivityPlotType.TraceOverTime, diff --git a/app/static/tests/unit/components/options/editParamSettings.test.ts b/app/static/tests/unit/components/options/editParamSettings.test.ts index a53d96899..de21b0353 100644 --- a/app/static/tests/unit/components/options/editParamSettings.test.ts +++ b/app/static/tests/unit/components/options/editParamSettings.test.ts @@ -29,7 +29,7 @@ describe("EditParamSettings", () => { rangeFrom: 0, rangeTo: 0, numberOfRuns: 5, - userValues: [] + customValues: [] }; const rangeSettings = { @@ -40,18 +40,18 @@ describe("EditParamSettings", () => { rangeFrom: 2, rangeTo: 6, numberOfRuns: 5, - userValues: [] + customValues: [] }; - const userSettings = { + const customSettings = { parameterToVary: "C", scaleType: SensitivityScaleType.Arithmetic, - variationType: SensitivityVariationType.User, + variationType: SensitivityVariationType.Custom, variationPercentage: 10, rangeFrom: 0, rangeTo: 0, numberOfRuns: 5, - userValues: [1, 2, 3] + customValues: [1, 2, 3] }; const mockRunner = { @@ -143,7 +143,7 @@ describe("EditParamSettings", () => { expect(varOptions.length).toBe(3); expect(varOptions.at(0)!.text()).toBe(SensitivityVariationType.Percentage); expect(varOptions.at(1)!.text()).toBe(SensitivityVariationType.Range); - expect(varOptions.at(2)!.text()).toBe(SensitivityVariationType.User); + expect(varOptions.at(2)!.text()).toBe(SensitivityVariationType.Custom); expect(wrapper.find("#edit-percent label").text()).toBe("Variation (%)"); expect(wrapper.find("#edit-percent").findComponent(NumericInput).props("value")).toBe(10); @@ -188,12 +188,12 @@ describe("EditParamSettings", () => { expect(wrapper.find("#invalid-msg").exists()).toBe(false); }); - it("renders as expected when variation type is User", async () => { - const wrapper = await getWrapper(userSettings); + it("renders as expected when variation type is Custom", async () => { + const wrapper = await getWrapper(customSettings); const paramSelect = wrapper.find("#edit-param-to-vary select"); expect((paramSelect.element as HTMLSelectElement).value).toBe("C"); const varSelect = wrapper.find("#edit-variation-type select"); - expect((varSelect.element as HTMLSelectElement).value).toBe(SensitivityVariationType.User); + expect((varSelect.element as HTMLSelectElement).value).toBe(SensitivityVariationType.Custom); const tagInput = wrapper.find("#edit-values").findComponent(TagInput); expect(tagInput.props().tags).toStrictEqual([1, 2, 3]); expect(tagInput.props().numericOnly).toBe(true); @@ -256,7 +256,7 @@ describe("EditParamSettings", () => { rangeFrom: 1, rangeTo: 3, numberOfRuns: 11, - userValues: [] + customValues: [] }); }); @@ -287,30 +287,30 @@ describe("EditParamSettings", () => { expect(rangeSpy.mock.calls[2][5]).toBe(3); }); - it("displays error when User variation type, and there are less than 2 values", async () => { + it("displays error when Custom variation type, and there are less than 2 values", async () => { const expectError = (wrapper: VueWrapper) => { expect(wrapper.findComponent(ErrorInfo).props().error).toStrictEqual({ error: "Invalid settings", detail: "Must include at least 2 traces in the batch" }); }; - expectError(await getWrapper({ ...userSettings, userValues: [] })); - expectError(await getWrapper({ ...userSettings, userValues: [1] })); + expectError(await getWrapper({ ...customSettings, customValues: [] })); + expectError(await getWrapper({ ...customSettings, customValues: [1] })); - const wrapper = await getWrapper({ ...userSettings, userValues: [1, 2] }); + const wrapper = await getWrapper({ ...customSettings, customValues: [1, 2] }); expect(wrapper.findComponent(ErrorInfo).exists()).toBe(false); }); it("updates values from TagInput, dedupes and sorts", async () => { const mockSetParamSettings = jest.fn(); - const wrapper = await getWrapper(userSettings, true, mockSetParamSettings); + const wrapper = await getWrapper(customSettings, true, mockSetParamSettings); wrapper.findComponent(TagInput).vm.$emit("update", [5, 1, 5, 0, -1, -2, 1]); const expectedValues = [-2, -1, 0, 1, 5]; await nextTick(); - expect((wrapper.vm as any).settingsInternal.userValues).toStrictEqual(expectedValues); + expect((wrapper.vm as any).settingsInternal.customValues).toStrictEqual(expectedValues); await wrapper.find("#ok-settings").trigger("click"); expect(mockSetParamSettings).toHaveBeenCalledTimes(1); const committed = mockSetParamSettings.mock.calls[0][1]; - expect(committed.userValues).toStrictEqual(expectedValues); + expect(committed.customValues).toStrictEqual(expectedValues); }); it("test set", () => { diff --git a/app/static/tests/unit/components/options/sensitivityOptions.test.ts b/app/static/tests/unit/components/options/sensitivityOptions.test.ts index 258a60e01..124f9b5df 100644 --- a/app/static/tests/unit/components/options/sensitivityOptions.test.ts +++ b/app/static/tests/unit/components/options/sensitivityOptions.test.ts @@ -61,7 +61,7 @@ describe("SensitivityOptions", () => { rangeFrom: 0, rangeTo: 0, numberOfRuns: 5, - userValues: [] + customValues: [] }; it("displays percentage variance as expected", () => { @@ -98,7 +98,7 @@ describe("SensitivityOptions", () => { rangeFrom: 1, rangeTo: 3, numberOfRuns: 5, - userValues: [] + customValues: [] }); const listItems = wrapper.findAll("ul li"); @@ -111,22 +111,22 @@ describe("SensitivityOptions", () => { expect(listItems.at(5)!.text()).toBe("Number of runs: 5"); }); - it("displays user-specified values as expected", () => { + it("displays custom values as expected", () => { const wrapper = getWrapper({ parameterToVary: "C", scaleType: SensitivityScaleType.Logarithmic, - variationType: SensitivityVariationType.User, + variationType: SensitivityVariationType.Custom, variationPercentage: 10, rangeFrom: 1, rangeTo: 3, numberOfRuns: 5, - userValues: [1, 2, 3] + customValues: [1, 2, 3] }); const listItems = wrapper.findAll("ul li"); expect(listItems.length).toBe(3); expect(listItems.at(0)!.text()).toBe("Parameter: C"); - expect(listItems.at(1)!.text()).toBe("Variation Type: User"); + expect(listItems.at(1)!.text()).toBe("Variation Type: Custom"); expect(listItems.at(2)!.text()).toBe("Values: 1, 2, 3"); }); diff --git a/app/static/tests/unit/serialiser.test.ts b/app/static/tests/unit/serialiser.test.ts index 6a84b59f1..472d7a9f0 100644 --- a/app/static/tests/unit/serialiser.test.ts +++ b/app/static/tests/unit/serialiser.test.ts @@ -157,7 +157,7 @@ describe("serialise", () => { rangeFrom: 0, rangeTo: 1, numberOfRuns: 5, - userValues: [] + customValues: [] }, sensitivityUpdateRequired: { modelChanged: false, diff --git a/app/static/tests/unit/utils.test.ts b/app/static/tests/unit/utils.test.ts index 8bf876afb..edec27d85 100644 --- a/app/static/tests/unit/utils.test.ts +++ b/app/static/tests/unit/utils.test.ts @@ -331,7 +331,7 @@ describe("generateBatchPars", () => { rangeFrom: 0, rangeTo: 0, numberOfRuns: 5, - userValues: [] + customValues: [] }; const rangeSettings = { @@ -342,18 +342,18 @@ describe("generateBatchPars", () => { rangeFrom: 2, rangeTo: 6, numberOfRuns: 9, - userValues: [] + customValues: [] }; - const userSettings = { + const customSettings = { parameterToVary: "C", scaleType: SensitivityScaleType.Arithmetic, - variationType: SensitivityVariationType.User, + variationType: SensitivityVariationType.Custom, variationPercentage: 50, rangeFrom: 2, rangeTo: 6, numberOfRuns: 9, - userValues: [1, 2, 3] + customValues: [1, 2, 3] }; it("generates BatchPars for Percentage variation type", () => { @@ -386,8 +386,8 @@ describe("generateBatchPars", () => { expect(spyBatchParsRange.mock.calls[0][5]).toStrictEqual(6); }); - it("generates BatchPars for User variation type", () => { - const result = generateBatchPars(rootState, userSettings, parameterValues)!; + it("generates BatchPars for Custom variation type", () => { + const result = generateBatchPars(rootState, customSettings, parameterValues)!; expect(result.error).toBe(null); expect(result.batchPars!.name).toBe("C"); expect(result.batchPars!.base).toBe(parameterValues); From b783bb8922aefbfa614612ae9c8a88f53e8e8144 Mon Sep 17 00:00:00 2001 From: EmmaLRussell Date: Fri, 25 Aug 2023 10:46:04 +0100 Subject: [PATCH 13/17] test fix --- app/static/tests/unit/store/sensitivity/getters.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/static/tests/unit/store/sensitivity/getters.test.ts b/app/static/tests/unit/store/sensitivity/getters.test.ts index b22f6c2c2..6edc0af48 100644 --- a/app/static/tests/unit/store/sensitivity/getters.test.ts +++ b/app/static/tests/unit/store/sensitivity/getters.test.ts @@ -11,7 +11,7 @@ describe("Sensitivity getters", () => { rangeFrom: 0, rangeTo: 0, numberOfRuns: 3, - userValues: [] + customValues: [] }; it("generates batchPars", () => { From 4f6621fe4f9899486ca6f629859c22faa3106ea1 Mon Sep 17 00:00:00 2001 From: EmmaLRussell Date: Fri, 25 Aug 2023 11:55:43 +0100 Subject: [PATCH 14/17] Move scale type below variation type on editor and tab --- .../components/options/EditParamSettings.vue | 24 +++++++++---------- .../components/options/SensitivityOptions.vue | 2 +- app/static/tests/e2e/sensitivity.etest.ts | 8 +++---- .../options/sensitivityOptions.test.ts | 8 +++---- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/app/static/src/app/components/options/EditParamSettings.vue b/app/static/src/app/components/options/EditParamSettings.vue index 83adac4c7..3f0d6a1de 100644 --- a/app/static/src/app/components/options/EditParamSettings.vue +++ b/app/static/src/app/components/options/EditParamSettings.vue @@ -18,18 +18,6 @@ -
    -
    - -
    -
    - -
    -
    -
    -
    @@ -40,6 +28,18 @@
    +
    +
    + +
    +
    + +
    +
    +
    +
    diff --git a/app/static/src/app/components/options/SensitivityOptions.vue b/app/static/src/app/components/options/SensitivityOptions.vue index aab7878a9..d94a432fd 100644 --- a/app/static/src/app/components/options/SensitivityOptions.vue +++ b/app/static/src/app/components/options/SensitivityOptions.vue @@ -5,8 +5,8 @@
    • Parameter: {{settings.parameterToVary}}
    • -
    • Scale Type: {{ settings.scaleType }}
    • Variation Type: {{ settings.variationType }}
    • +
    • Scale Type: {{ settings.scaleType }}
    • Variation (%): {{ settings.variationPercentage }}
    • diff --git a/app/static/tests/e2e/sensitivity.etest.ts b/app/static/tests/e2e/sensitivity.etest.ts index fccdbee99..7d30731d0 100644 --- a/app/static/tests/e2e/sensitivity.etest.ts +++ b/app/static/tests/e2e/sensitivity.etest.ts @@ -16,8 +16,8 @@ test.describe("Sensitivity tests", () => { test("can edit Sensitivity options", async ({ page }) => { // Default settings are visible await expect(await page.innerText(":nth-match(#sensitivity-options li, 1)")).toBe("Parameter: beta"); - await expect(await page.innerText(":nth-match(#sensitivity-options li, 2)")).toBe("Scale Type: Arithmetic"); - await expect(await page.innerText(":nth-match(#sensitivity-options li, 3)")).toBe("Variation Type: Percentage"); + await expect(await page.innerText(":nth-match(#sensitivity-options li, 2)")).toBe("Variation Type: Percentage") + await expect(await page.innerText(":nth-match(#sensitivity-options li, 3)")).toBe("Scale Type: Arithmetic"); await expect(await page.innerText(":nth-match(#sensitivity-options li, 4)")).toBe("Variation (%): 10"); await expect(await page.innerText(":nth-match(#sensitivity-options li, 5)")).toBe("Number of runs: 10"); await expect(await page.innerText("#sensitivity-options .alert-success")) @@ -54,8 +54,8 @@ test.describe("Sensitivity tests", () => { // New settings are visible await expect(await page.innerText(":nth-match(#sensitivity-options li, 1)")).toBe("Parameter: sigma"); - await expect(await page.innerText(":nth-match(#sensitivity-options li, 2)")).toBe("Scale Type: Logarithmic"); - await expect(await page.innerText(":nth-match(#sensitivity-options li, 3)")).toBe("Variation Type: Range"); + await expect(await page.innerText(":nth-match(#sensitivity-options li, 2)")).toBe("Variation Type: Range"); + await expect(await page.innerText(":nth-match(#sensitivity-options li, 3)")).toBe("Scale Type: Logarithmic"); await expect(await page.innerText(":nth-match(#sensitivity-options li, 4)")).toBe("From: 1"); await expect(await page.innerText(":nth-match(#sensitivity-options li, 5)")).toBe("To: 5"); await expect(await page.innerText(":nth-match(#sensitivity-options li, 6)")).toBe("Number of runs: 12"); diff --git a/app/static/tests/unit/components/options/sensitivityOptions.test.ts b/app/static/tests/unit/components/options/sensitivityOptions.test.ts index 124f9b5df..ac15cc2ec 100644 --- a/app/static/tests/unit/components/options/sensitivityOptions.test.ts +++ b/app/static/tests/unit/components/options/sensitivityOptions.test.ts @@ -73,8 +73,8 @@ describe("SensitivityOptions", () => { const listItems = wrapper.findAll("ul li"); expect(listItems.length).toBe(5); expect(listItems.at(0)!.text()).toBe("Parameter: B"); - expect(listItems.at(1)!.text()).toBe("Scale Type: Arithmetic"); - expect(listItems.at(2)!.text()).toBe("Variation Type: Percentage"); + expect(listItems.at(1)!.text()).toBe("Variation Type: Percentage"); + expect(listItems.at(2)!.text()).toBe("Scale Type: Arithmetic"); expect(listItems.at(3)!.text()).toBe("Variation (%): 10"); expect(listItems.at(4)!.text()).toBe("Number of runs: 5"); @@ -104,8 +104,8 @@ describe("SensitivityOptions", () => { const listItems = wrapper.findAll("ul li"); expect(listItems.length).toBe(6); expect(listItems.at(0)!.text()).toBe("Parameter: B"); - expect(listItems.at(1)!.text()).toBe("Scale Type: Logarithmic"); - expect(listItems.at(2)!.text()).toBe("Variation Type: Range"); + expect(listItems.at(1)!.text()).toBe("Variation Type: Range"); + expect(listItems.at(2)!.text()).toBe("Scale Type: Logarithmic"); expect(listItems.at(3)!.text()).toBe("From: 1"); expect(listItems.at(4)!.text()).toBe("To: 3"); expect(listItems.at(5)!.text()).toBe("Number of runs: 5"); From 20f33bbae72c0ee406b972b0f25e604f16f9dadf Mon Sep 17 00:00:00 2001 From: EmmaLRussell Date: Fri, 25 Aug 2023 12:07:10 +0100 Subject: [PATCH 15/17] show central value --- .../components/options/EditParamSettings.vue | 49 +++++++++---------- app/static/tests/e2e/sensitivity.etest.ts | 2 + .../options/editParamSettings.test.ts | 1 + 3 files changed, 27 insertions(+), 25 deletions(-) diff --git a/app/static/src/app/components/options/EditParamSettings.vue b/app/static/src/app/components/options/EditParamSettings.vue index 3f0d6a1de..f6665c52b 100644 --- a/app/static/src/app/components/options/EditParamSettings.vue +++ b/app/static/src/app/components/options/EditParamSettings.vue @@ -49,34 +49,33 @@ @update="(n) => settingsInternal.variationPercentage = n">
    - +
    + {{ centralValue }} +
    + +
    +
    + +
    +
    + +
    +