From 891d71814cdd9a7201f2fe0d632b4b4110035a69 Mon Sep 17 00:00:00 2001 From: Jose Olarte III Date: Fri, 30 Aug 2024 16:56:37 +0800 Subject: [PATCH] Variable website, date and time --- test-playwright/25-create-project-x10.spec.ts | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/test-playwright/25-create-project-x10.spec.ts b/test-playwright/25-create-project-x10.spec.ts index 19dc090ef..89b29f93a 100644 --- a/test-playwright/25-create-project-x10.spec.ts +++ b/test-playwright/25-create-project-x10.spec.ts @@ -7,6 +7,7 @@ test('Create 10 new projects', async ({ page }) => { // Standard texts const standardTitle = "Idea "; const standardDescription = "Description of Idea "; + const standardWebsite = 'https://example.com'; // Title and description arrays const finalTitles = []; @@ -23,6 +24,18 @@ test('Create 10 new projects', async ({ page }) => { finalDescriptions.push(loopDescription); } + // Set date + const today = new Date(); + const oneMonthAhead = new Date(today.setDate(today.getDate() + 30)); + const standardDate = oneMonthAhead.toISOString().split('T')[0]; + + // Set time + const now = new Date(); + const futureTime = new Date(now.setHours(now.getHours() + 1)); + const standardHour = futureTime.getHours().toString().padStart(2, '0'); + const standardMinute = futureTime.getMinutes().toString().padStart(2, '0'); + const standardTime = `${standardHour}:${standardMinute}`; + // Import user 00 await importUser(page, '00'); @@ -33,9 +46,9 @@ test('Create 10 new projects', async ({ page }) => { await page.getByRole('button').click(); await page.getByPlaceholder('Idea Name').fill(finalTitles[i]); // Add random suffix await page.getByPlaceholder('Description').fill(finalDescriptions[i]); - await page.getByPlaceholder('Website').fill('https://example.com'); - await page.getByPlaceholder('Start Date').fill('2025-12-01'); - await page.getByPlaceholder('Start Time').fill('12:00'); + await page.getByPlaceholder('Website').fill(standardWebsite); + await page.getByPlaceholder('Start Date').fill(standardDate); + await page.getByPlaceholder('Start Time').fill(standardTime); await page.getByRole('button', { name: 'Save Project' }).click(); // Check texts