@@ -3,6 +3,9 @@ import { test, expect } from './fixtures';
33test . describe ( 'DevBoxPro Project Lifecycle' , ( ) => {
44
55 test ( 'Creates a new project successfully' , async ( { page } ) => {
6+ test . setTimeout ( 60000 ) ;
7+ const uniqueProjectName = `e2e-test-${ Date . now ( ) } ` ;
8+
69 // Go to Projects page
710 await page . click ( 'a:has-text("Projects")' ) ;
811 await expect ( page . locator ( 'h1:has-text("Projects")' ) . or ( page . locator ( 'h2:has-text("Projects")' ) ) ) . toBeVisible ( ) ;
@@ -15,14 +18,16 @@ test.describe('DevBoxPro Project Lifecycle', () => {
1518
1619 // Step 1: Project Type
1720 // We need to wait for the next button to be enabled before clicking
21+ // Select Custom PHP to avoid running installation scripts (like composer) during tests
22+ await page . click ( 'text="Custom PHP"' ) ;
1823 const nextButton = page . getByRole ( 'button' , { name : 'Next' } ) ;
1924 await expect ( nextButton ) . toBeEnabled ( ) ;
2025 await nextButton . click ( ) ;
2126
2227 // Step 2: Details
2328 // Wait for step 2 to render
2429 await expect ( page . getByRole ( 'heading' , { name : 'Project Details' } ) . or ( page . locator ( 'text=Project Details' ) ) ) . toBeVisible ( ) ;
25- await page . fill ( 'input[type="text"] >> nth=0' , 'e2e-test-project' ) ;
30+ await page . fill ( 'input[type="text"] >> nth=0' , uniqueProjectName ) ;
2631
2732 // Ensure path updates
2833 await page . click ( 'input[type="text"] >> nth=1' ) ;
@@ -46,16 +51,24 @@ test.describe('DevBoxPro Project Lifecycle', () => {
4651 await expect ( submitButton ) . toBeEnabled ( ) ;
4752 await submitButton . click ( ) ;
4853
49- // Should return to Projects list and show the new project
54+ // Custom projects don't have installation progress, so it redirects straight to Project details page
55+ await expect ( page . locator ( `h1:has-text("${ uniqueProjectName } ")` ) . or ( page . locator ( `h2:has-text("${ uniqueProjectName } ")` ) ) ) . toBeVisible ( { timeout : 10000 } ) ;
56+
57+ // Check that project status is running or stopped (can be stopped initially)
58+ const statusBadge = page . locator ( '.status-stopped, .status-running' ) . first ( ) ;
59+ await expect ( statusBadge ) . toBeVisible ( { timeout : 10000 } ) ;
60+
61+ // Navigate back to project list to ensure it's there
62+ await page . click ( 'a:has-text("Projects")' ) ;
5063 await expect ( page . locator ( 'h1:has-text("Projects")' ) . or ( page . locator ( 'h2:has-text("Projects")' ) ) ) . toBeVisible ( ) ;
51- await expect ( page . locator ( ' text=e2e-test-project' ) ) . toBeVisible ( ) ;
64+ await expect ( page . locator ( ` text=${ uniqueProjectName } ` ) . first ( ) ) . toBeVisible ( ) ;
5265
5366 // Start project from the card
54- const projectCard = page . locator ( '.card' , { hasText : 'e2e-test-project' } ) . first ( ) ;
55- const startBtn = projectCard . locator ( 'button[title="Start project"] ' ) . or ( projectCard . locator ( 'button:has(.status-stopped)' ) ) ; // Wait what is the start button selector?
56- // Let's look at ProjectTableRow or just use Project Detail view to be safer
57- await page . click ( 'text=e2e-test-project' ) ;
58- await expect ( page . locator ( 'h1:has-text("e2e-test-project")' ) . or ( page . locator ( 'h2:has-text("e2e-test-project")' ) ) ) . toBeVisible ( ) ;
67+ const projectCard = page . locator ( '.card' , { hasText : uniqueProjectName } ) . first ( ) ;
68+ const startBtn = projectCard . locator ( 'button.btn-success ' ) . first ( ) ;
69+
70+ // Ensure the button is visible and enabled
71+ await expect ( startBtn ) . toBeVisible ( ) ;
5972
6073 // Wait a bit for status to load
6174 await page . waitForTimeout ( 1000 ) ;
@@ -81,7 +94,7 @@ test.describe('DevBoxPro Project Lifecycle', () => {
8194 await expect ( page . locator ( 'h1:has-text("Projects")' ) . or ( page . locator ( 'h2:has-text("Projects")' ) ) ) . toBeVisible ( ) ;
8295
8396 // Delete project using the card menu
84- const card = page . locator ( '.card' , { hasText : 'e2e-test-project' } ) . first ( ) ;
97+ const card = page . locator ( '.card' , { hasText : uniqueProjectName } ) . first ( ) ;
8598
8699 // Click the "More options" menu button
87100 // Since we don't have a reliable aria-label, we can click the button inside the relative container next to "View Details"
@@ -104,6 +117,6 @@ test.describe('DevBoxPro Project Lifecycle', () => {
104117 await confirmDeleteBtn . click ( ) ;
105118
106119 // Project should be gone
107- await expect ( page . locator ( 'text=e2e-test-project' ) ) . not . toBeVisible ( { timeout : 10000 } ) ;
120+ await expect ( page . locator ( '.card' , { hasText : uniqueProjectName } ) ) . toHaveCount ( 0 ) ;
108121 } ) ;
109122} ) ;
0 commit comments