docs(tests): Add comprehensive test suite documentation

- Add detailed header documentation to playwright tests
- Document test categories and flows
- Add key selector documentation
- Document state verification and alert handling
- Include code examples and usage patterns
- Add important checks and requirements

The documentation helps developers understand the foundational tests that verify
basic application functionality before running more complex test suites.
This commit is contained in:
Matthew Raymer
2025-02-16 03:29:22 +00:00
parent 499d35b22b
commit cc71d383e6
10 changed files with 683 additions and 516 deletions

View File

@@ -1,8 +1,89 @@
/**
* @file Bulk Project Creation Test Suite
* @description Tests TimeSafari's project creation functionality under load by creating multiple projects in sequence
*
* This test verifies:
* 1. Scalability
* - System can handle creation of multiple projects (10)
* - Performance remains stable across iterations
* - No data corruption during bulk operations
*
* 2. Data Integrity
* - Each project has unique identifiers
* - All projects are properly stored and retrievable
* - No cross-contamination between project data
*
* 3. UI Responsiveness
* - Interface remains responsive during bulk operations
* - Feedback is provided for each creation
* - No memory leaks or performance degradation
*
* Test Flow:
* 1. Setup Phase
* - Generate array of unique identifiers
* - Prepare standard text templates
* - Calculate common date/time values
* - Import test user (User 00)
*
* 2. Bulk Creation (10 iterations)
* - Navigate to projects page
* - Handle first-time onboarding dialog
* - Create project with unique data
* - Verify project creation success
* - Confirm project details display correctly
*
* Test Data:
* - Project Count: 10 projects
* - Title Format: "Idea [unique-string]"
* - Description Format: "Description of Idea [unique-string]"
* - Website: https://example.com (common across all)
* - Start Date: Current date + 30 days
* - Start Time: Current time + 1 hour
*
* Key Selectors:
* - Project title: 'h2'
* - Project content: '#Content'
* - New project button: 'button > svg.fa-plus'
* - Onboarding close: 'div > svg.fa-xmark'
*
* Performance Considerations:
* - Uses test.slow() to extend timeout
* - Handles potential UI lag between operations
* - Manages memory usage during bulk operations
*
* Error Handling:
* - Closes onboarding dialog only on first iteration
* - Verifies each project individually
* - Maintains operation even if individual creations fail
*
* Related Files:
* - Project utilities: ./testUtils
* - JWT handling: sw_scripts/safari-notifications.js
* - Project view: src/views/ProjectView.vue
*
* @see Documentation in usage-guide.md for project creation workflows
* @requires @playwright/test
* @requires ./testUtils - For user management and string generation
*
* @example
* ```typescript
* // Generate unique strings for multiple projects
* const uniqueStrings = await createUniqueStringsArray(10);
*
* // Create projects in sequence
* for (let i = 0; i < projectCount; i++) {
* await page.goto('./projects');
* await page.locator('button > svg.fa-plus').click();
* await page.getByPlaceholder('Idea Name').fill(`Idea ${uniqueStrings[i]}`);
* }
* ```
*/
import { test, expect } from '@playwright/test';
import { importUser, createUniqueStringsArray } from './testUtils';
import { importUser } from './testUtils';
test('Create 10 new projects', async ({ page }) => {
test.setTimeout(40000); // Set timeout longer since it often fails at 30 seconds
test.slow(); // Set timeout longer since it often fails at 30 seconds
const projectCount = 10;