Compare commits
	
		
			15 Commits 
		
	
	
		
			46ebd95394
			...
			03a3964cbd
		
	
	| Author | SHA1 | Date | 
|---|---|---|
| 
							
							
								 | 
						03a3964cbd | 1 year ago | 
| 
							
							
								
								 | 
						acf04792be | 1 year ago | 
| 
							
							
								 | 
						3262f0ee64 | 1 year ago | 
| 
							
							
								 | 
						69473a826f | 1 year ago | 
| 
							
							
								 | 
						51eb45353e | 1 year ago | 
| 
							
							
								 | 
						b1875b5812 | 1 year ago | 
| 
							
							
								 | 
						bd27d8a10f | 1 year ago | 
| 
							
							
								 | 
						c076ce5b44 | 1 year ago | 
| 
							
							
								 | 
						915d51dc2f | 1 year ago | 
| 
							
							
								 | 
						b1d61251dc | 1 year ago | 
| 
							
							
								 | 
						a9aeeeb51e | 1 year ago | 
| 
							
							
								 | 
						d679d0c804 | 1 year ago | 
| 
							
							
								 | 
						c4a8026276 | 1 year ago | 
| 
							
							
								 | 
						10fad9c167 | 1 year ago | 
| 
							
							
								 | 
						084fb09971 | 1 year ago | 
				 4 changed files with 164 additions and 9 deletions
			
			
		@ -0,0 +1,45 @@ | 
				
			|||
import { test, expect } from '@playwright/test'; | 
				
			|||
import { importUser, createUniqueStringsArray } from './testUtils'; | 
				
			|||
 | 
				
			|||
test('Create 10 new projects', async ({ page }) => { | 
				
			|||
  const projectCount = 10; | 
				
			|||
 | 
				
			|||
  // Standard texts
 | 
				
			|||
  const standardTitle = "Idea "; | 
				
			|||
  const standardDescription = "Description of Idea "; | 
				
			|||
 | 
				
			|||
  // Title and description arrays
 | 
				
			|||
  const finalTitles = []; | 
				
			|||
  const finalDescriptions = []; | 
				
			|||
 | 
				
			|||
  // Create an array of unique strings
 | 
				
			|||
  const uniqueStrings = await createUniqueStringsArray(projectCount); | 
				
			|||
 | 
				
			|||
  // Populate arrays with titles and descriptions
 | 
				
			|||
  for (let i = 0; i < projectCount; i++) { | 
				
			|||
    let loopTitle = standardTitle + uniqueStrings[i]; | 
				
			|||
    finalTitles.push(loopTitle); | 
				
			|||
    let loopDescription = standardDescription + uniqueStrings[i]; | 
				
			|||
    finalDescriptions.push(loopDescription); | 
				
			|||
  } | 
				
			|||
 | 
				
			|||
  // Import user 00
 | 
				
			|||
  await importUser(page, '00'); | 
				
			|||
 | 
				
			|||
  // Create new projects
 | 
				
			|||
  for (let i = 0; i < projectCount; i++) { | 
				
			|||
    await page.goto('./projects'); | 
				
			|||
    await page.getByRole('link', { name: 'Projects', exact: true }).click(); | 
				
			|||
    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.getByRole('button', { name: 'Save Project' }).click(); | 
				
			|||
 | 
				
			|||
    // Check texts
 | 
				
			|||
    await expect(page.locator('h2')).toContainText(finalTitles[i]); | 
				
			|||
    await expect(page.locator('#Content')).toContainText(finalDescriptions[i]); | 
				
			|||
  } | 
				
			|||
}); | 
				
			|||
@ -0,0 +1,43 @@ | 
				
			|||
import { test, expect } from '@playwright/test'; | 
				
			|||
import { importUser, createUniqueStringsArray, createRandomNumbersArray  } from './testUtils'; | 
				
			|||
 | 
				
			|||
test('Record 10 new gifts', async ({ page }) => { | 
				
			|||
  const giftCount = 10; | 
				
			|||
 | 
				
			|||
  // Standard text
 | 
				
			|||
  const standardTitle = "Gift "; | 
				
			|||
 | 
				
			|||
  // Field value arrays
 | 
				
			|||
  const finalTitles = []; | 
				
			|||
  const finalNumbers = []; | 
				
			|||
 | 
				
			|||
  // Create arrays for field input
 | 
				
			|||
  const uniqueStrings = await createUniqueStringsArray(giftCount); | 
				
			|||
  const randomNumbers = await createRandomNumbersArray(giftCount); | 
				
			|||
 | 
				
			|||
  // Populate array with titles
 | 
				
			|||
  for (let i = 0; i < giftCount; i++) { | 
				
			|||
    let loopTitle = standardTitle + uniqueStrings[i]; | 
				
			|||
    finalTitles.push(loopTitle); | 
				
			|||
    let loopNumber = randomNumbers[i]; | 
				
			|||
    finalNumbers.push(loopNumber); | 
				
			|||
  } | 
				
			|||
 | 
				
			|||
  // Import user 00
 | 
				
			|||
  await importUser(page, '00'); | 
				
			|||
 | 
				
			|||
  // Record new gifts
 | 
				
			|||
  for (let i = 0; i < giftCount; i++) { | 
				
			|||
    // Record something given
 | 
				
			|||
    await page.goto('./'); | 
				
			|||
    await page.getByRole('heading', { name: 'Unnamed/Unknown' }).click(); | 
				
			|||
    await page.getByPlaceholder('What was given').fill(finalTitles[i]); | 
				
			|||
    await page.getByRole('spinbutton').fill(finalNumbers[i].toString()); | 
				
			|||
    await page.getByRole('button', { name: 'Sign & Send' }).click(); | 
				
			|||
    await expect(page.getByText('That gift was recorded.')).toBeVisible(); | 
				
			|||
 | 
				
			|||
    // Refresh home view and check gift
 | 
				
			|||
    await page.goto('./'); | 
				
			|||
    await expect(page.locator('li').filter({ hasText: finalTitles[i] })).toBeVisible(); | 
				
			|||
  } | 
				
			|||
}); | 
				
			|||
					Loading…
					
					
				
		Reference in new issue