Browse Source

Variable website, date and time

Jose Olarte III 3 months ago
parent
commit
891d71814c
  1. 19
      test-playwright/25-create-project-x10.spec.ts

19
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

Loading…
Cancel
Save