diff --git a/frontend/tests/components/components/grouping/ContactGroupComponent.cy.ts b/frontend/tests/components/components/grouping/ContactGroupComponent.cy.ts
index 5ca6247e9c..06bc974d9a 100644
--- a/frontend/tests/components/components/grouping/ContactGroupComponent.cy.ts
+++ b/frontend/tests/components/components/grouping/ContactGroupComponent.cy.ts
@@ -335,10 +335,11 @@ describe("", () => {
});
});
- // Debugging issue on CI.
- cy.window().then((value) => cy.task("log", `window: ${value}`));
- cy.document().then((value) => cy.task("log", `document: ${value}`));
- cy.get("#firstName_1");
+ /*
+ In case the component is scrolled down, make sure to scroll up so the "First name" input is
+ visible, since the "safe focusing" would skip focusing it in that case.
+ */
+ cy.scrollTo("top");
cy.focused().should("have.id", "firstName_1");
cy.get(fieldSelector).shadow().find("input").clear(); // emits false
diff --git a/frontend/tests/unittests/components/forms/DateInputComponent.spec.ts b/frontend/tests/unittests/components/forms/DateInputComponent.spec.ts
index 4352e9d3e7..2c0266a981 100644
--- a/frontend/tests/unittests/components/forms/DateInputComponent.spec.ts
+++ b/frontend/tests/unittests/components/forms/DateInputComponent.spec.ts
@@ -1,11 +1,15 @@
-import { describe, it, expect, afterAll, vi } from "vitest";
-import { DOMWrapper, mount } from "@vue/test-utils";
+import { describe, it, expect, afterEach } from "vitest";
+import { DOMWrapper, mount, VueWrapper } from "@vue/test-utils";
import DateInputComponent from "@/components/forms/DateInputComponent/index.vue";
import { isMinimumYearsAgo } from "@/helpers/validators/GlobalValidators";
describe("Date Input Component", () => {
- afterAll(() => {
- vi.clearAllTimers();
+ let globalWrapper: VueWrapper;
+
+ afterEach(() => {
+ if (globalWrapper) {
+ globalWrapper.unmount();
+ }
});
const id = "my-date";
@@ -31,6 +35,7 @@ describe("Date Input Component", () => {
masked: () => {},
},
});
+ globalWrapper = wrapper;
expect(wrapper.find(`#${id}`).exists()).toBe(true);
});
@@ -47,7 +52,9 @@ describe("Date Input Component", () => {
directives: {
masked: () => {},
},
+ attachTo: document.body,
});
+ globalWrapper = wrapper;
const yearWrapper = wrapper.find(`#${id}Year`);
await setInputValue(yearWrapper, "2001");
@@ -69,7 +76,9 @@ describe("Date Input Component", () => {
directives: {
masked: () => {},
},
+ attachTo: document.body,
});
+ globalWrapper = wrapper;
await wrapper.find(`#${id}Year`).trigger("input");
await wrapper.find(`#${id}Year`).trigger("blur");
@@ -92,7 +101,9 @@ describe("Date Input Component", () => {
directives: {
masked: () => {},
},
+ attachTo: document.body,
});
+ globalWrapper = wrapper;
const currentYear = new Date().getFullYear();
const currentYearMinus5 = currentYear - 5;
@@ -121,7 +132,9 @@ describe("Date Input Component", () => {
directives: {
masked: () => {},
},
+ attachTo: document.body,
});
+ globalWrapper = wrapper;
const inputWrapper = wrapper.find(`#${id}Year`);
await setInputValue(inputWrapper, "1");
@@ -153,7 +166,9 @@ describe("Date Input Component", () => {
directives: {
masked: () => {},
},
+ attachTo: document.body,
});
+ globalWrapper = wrapper;
const inputWrapper = wrapper.find(`#${id}Year`);
await inputWrapper.trigger("input");