diff --git a/src/components/EditMonitorConditions.vue b/src/components/EditMonitorConditions.vue index 60f7c658..1827cfe2 100644 --- a/src/components/EditMonitorConditions.vue +++ b/src/components/EditMonitorConditions.vue @@ -73,12 +73,6 @@ export default { } }, - created() { - if (this.model.length === 0) { - this.addCondition(); - } - }, - methods: { getNewGroup() { return { diff --git a/test/e2e/specs/monitor-form.spec.js b/test/e2e/specs/monitor-form.spec.js index 7a84f3c9..b41f6ceb 100644 --- a/test/e2e/specs/monitor-form.spec.js +++ b/test/e2e/specs/monitor-form.spec.js @@ -28,16 +28,16 @@ test.describe("Monitor Form", () => { await selectMonitorType(page); await page.getByTestId("add-condition-button").click(); - expect(await page.getByTestId("condition").count()).toEqual(2); // 1 added by default + 1 explicitly added + expect(await page.getByTestId("condition").count()).toEqual(1); // 1 explicitly added await page.getByTestId("add-group-button").click(); expect(await page.getByTestId("condition-group").count()).toEqual(1); - expect(await page.getByTestId("condition").count()).toEqual(3); // 2 solo conditions + 1 condition in group + expect(await page.getByTestId("condition").count()).toEqual(2); // 1 solo conditions + 1 condition in group await screenshot(testInfo, page); await page.getByTestId("remove-condition").first().click(); - expect(await page.getByTestId("condition").count()).toEqual(2); // 1 solo condition + 1 condition in group + expect(await page.getByTestId("condition").count()).toEqual(1); // 0 solo condition + 1 condition in group await page.getByTestId("remove-condition-group").first().click(); expect(await page.getByTestId("condition-group").count()).toEqual(0); @@ -60,7 +60,10 @@ test.describe("Monitor Form", () => { await resolveTypeSelect.getByRole("option", { name: "NS" }).click(); await page.getByTestId("add-condition-button").click(); - expect(await page.getByTestId("condition").count()).toEqual(2); // 1 added by default + 1 explicitly added + expect(await page.getByTestId("condition").count()).toEqual(1); // 1 explicitly added + + await page.getByTestId("add-condition-button").click(); + expect(await page.getByTestId("condition").count()).toEqual(2); // 2 explicitly added await page.getByTestId("condition-value").nth(0).fill("a.iana-servers.net"); await page.getByTestId("condition-and-or").nth(0).selectOption("or"); @@ -89,7 +92,8 @@ test.describe("Monitor Form", () => { await resolveTypeSelect.click(); await resolveTypeSelect.getByRole("option", { name: "NS" }).click(); - expect(await page.getByTestId("condition").count()).toEqual(1); // 1 added by default + await page.getByTestId("add-condition-button").click(); + expect(await page.getByTestId("condition").count()).toEqual(1); // 1 explicitly added await page.getByTestId("condition-value").nth(0).fill("definitely-not.net");