From 1ac1df686b92d31592a5ab80e554121e8368bab7 Mon Sep 17 00:00:00 2001 From: maymanaf Date: Mon, 2 Dec 2024 16:59:30 +0100 Subject: [PATCH] front: fix e2e date check for study Signed-off-by: maymanaf --- front/tests/003-study-management.spec.ts | 4 ++-- front/tests/utils/index.ts | 12 +++++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/front/tests/003-study-management.spec.ts b/front/tests/003-study-management.spec.ts index 97d857a1dfb..7965377adbe 100644 --- a/front/tests/003-study-management.spec.ts +++ b/front/tests/003-study-management.spec.ts @@ -37,7 +37,7 @@ test.describe('Validate the Study creation workflow', () => { const translations = OSRDLanguage === 'English' ? enTranslations : frTranslations; const studyName = `${studyData.name} ${uuidv4()}`; // Unique study name const todayDateISO = new Date().toISOString().split('T')[0]; // Get today's date in ISO format - const expectedDate = formatDateToDayMonthYear(todayDateISO); + const expectedDate = formatDateToDayMonthYear(todayDateISO, OSRDLanguage); // Create a new study using the study page model await studyPage.createStudy({ name: studyName, @@ -79,7 +79,7 @@ test.describe('Validate the Study creation workflow', () => { await page.goto(`/operational-studies/projects/${project.id}/studies/${study.id}`); const translations = OSRDLanguage === 'English' ? enTranslations : frTranslations; const tomorrowDateISO = new Date(Date.now() + 86400000).toISOString().split('T')[0]; // Get tomorrow's date in ISO format - const expectedDate = formatDateToDayMonthYear(tomorrowDateISO); + const expectedDate = formatDateToDayMonthYear(tomorrowDateISO, OSRDLanguage); // Update the study with new values await studyPage.updateStudy({ name: `${study.name} (updated)`, diff --git a/front/tests/utils/index.ts b/front/tests/utils/index.ts index 32562436040..b1c036aca2b 100644 --- a/front/tests/utils/index.ts +++ b/front/tests/utils/index.ts @@ -92,20 +92,18 @@ export async function clickWithDelay(element: Locator, delay = 500): Promise match.toLowerCase()); + return formattedDate.replace('.', ''); } /** * Waits until the infrastructure state becomes 'CACHED' before proceeding to the next step.