fix: isolate tests — each test only operates on its own resources
- milestone.spec.ts: use unique prefix 'Milestone Test Project', target project card by name, clean up (delete) project after verification - project-editor.spec.ts: use unique prefix 'ProjEditor Test', target project card by name instead of first .project-card match This prevents cross-test interference where project-editor would accidentally delete the project created by the milestone test.
This commit is contained in:
@@ -44,7 +44,7 @@ test.describe('Project Editor', () => {
|
||||
|
||||
console.log('✅ Logged in');
|
||||
|
||||
// Step 2: Create Project
|
||||
// Step 2: Create Project (unique name for this test)
|
||||
console.log('📁 Creating project...');
|
||||
// Click Projects in sidebar
|
||||
await page.click('a:has-text("📁 Projects")');
|
||||
@@ -60,8 +60,8 @@ test.describe('Project Editor', () => {
|
||||
// Wait for the form to appear (look for the project name input)
|
||||
await page.waitForSelector('input[placeholder="Project name"]', { timeout: 10000 });
|
||||
|
||||
// Fill project form
|
||||
const projectName = 'Test Project ' + Date.now();
|
||||
// Fill project form with a unique, identifiable name
|
||||
const projectName = 'ProjEditor Test ' + Date.now();
|
||||
console.log('Creating project with name:', projectName);
|
||||
await page.fill('input[placeholder="Project name"]', projectName);
|
||||
await page.fill('input[placeholder="Description (optional)"]', 'Project for E2E testing');
|
||||
@@ -72,23 +72,14 @@ test.describe('Project Editor', () => {
|
||||
// Wait a bit for submission
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
// Check if there are any errors in console
|
||||
const errors = await page.evaluate(() => {
|
||||
return window.__errors || [];
|
||||
});
|
||||
if (errors.length > 0) {
|
||||
console.log('Console errors:', errors);
|
||||
}
|
||||
|
||||
// Wait for project to be created (and appear in the grid) - check for any project card
|
||||
await page.waitForSelector('.project-card', { timeout: 10000 });
|
||||
// Wait for our specific project card to appear
|
||||
await page.waitForSelector(`.project-card:has-text("${projectName}")`, { timeout: 10000 });
|
||||
console.log('✅ Project created');
|
||||
|
||||
// Step 3: Delete the created project
|
||||
// Step 3: Delete the created project — click OUR project card by name
|
||||
console.log('🗑️ Deleting project...');
|
||||
|
||||
// Click on the project card to open it
|
||||
await page.click('.project-card');
|
||||
await page.click(`.project-card:has-text("${projectName}")`);
|
||||
await page.waitForLoadState('networkidle');
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
@@ -98,7 +89,7 @@ test.describe('Project Editor', () => {
|
||||
console.log('Delete button visible:', deleteBtnVisible);
|
||||
|
||||
if (deleteBtnVisible) {
|
||||
// Set up prompt handler for the confirmation dialog - use dialog.defaultValue() to get the project name pattern
|
||||
// Set up prompt handler for the confirmation dialog
|
||||
page.on('dialog', async dialog => {
|
||||
console.log('Dialog message:', dialog.message());
|
||||
// Extract project name from the message - format: "Type the project name "XXX" to confirm deletion:"
|
||||
|
||||
Reference in New Issue
Block a user