1
+ import { test , expect } from '@playwright/test' ;
2
+
3
+ test . describe ( 'Projects Section' , ( ) => {
4
+ test ( 'should display projects listing' , async ( { page } ) => {
5
+ // Navigate to projects index
6
+ await page . goto ( '/projects' ) ;
7
+
8
+ // Verify the projects index page URL
9
+ await expect ( page ) . toHaveURL ( '/projects' ) ;
10
+ } ) ;
11
+
12
+ test ( 'should navigate to project detail page' , async ( { page } ) => {
13
+ // We'll test with a known project ID
14
+ // Since this is a demo app, we can use 'react-router' as the ID
15
+ const projectId = 'react-router' ;
16
+
17
+ // Go directly to the project page
18
+ await page . goto ( `/projects/${ projectId } ` ) ;
19
+
20
+ // Verify we're on the correct page
21
+ await expect ( page ) . toHaveURL ( `/projects/${ projectId } ` ) ;
22
+
23
+ // Check project name is displayed
24
+ const projectName = page . locator ( 'h1' ) . first ( ) ;
25
+ await expect ( projectName ) . toBeVisible ( ) ;
26
+
27
+ // Check edit and settings links
28
+ const editLink = page . locator ( 'a[href="edit"]' ) ;
29
+ await expect ( editLink ) . toBeVisible ( ) ;
30
+
31
+ const settingsLink = page . locator ( 'a[href="settings"]' ) ;
32
+ await expect ( settingsLink ) . toBeVisible ( ) ;
33
+
34
+ // Check progress section
35
+ const progressSection = page . locator ( '.card:has-text("Progress")' ) ;
36
+ await expect ( progressSection ) . toBeVisible ( ) ;
37
+
38
+ // Check team section
39
+ const teamSection = page . locator ( '.card:has-text("Team")' ) ;
40
+ await expect ( teamSection ) . toBeVisible ( ) ;
41
+
42
+ // Check activity section
43
+ const activitySection = page . locator ( '.card:has-text("Recent Activity")' ) ;
44
+ await expect ( activitySection ) . toBeVisible ( ) ;
45
+ } ) ;
46
+
47
+ test ( 'should navigate to project edit page' , async ( { page } ) => {
48
+ const projectId = 'react-router' ;
49
+
50
+ // Go to the project detail page
51
+ await page . goto ( `/projects/${ projectId } ` ) ;
52
+
53
+ // Click the edit link
54
+ const editLink = page . locator ( 'a:has-text("Edit")' ) ;
55
+ await editLink . click ( ) ;
56
+
57
+ // Verify we're on the edit page
58
+ await expect ( page ) . toHaveURL ( `/projects/${ projectId } /edit` ) ;
59
+ } ) ;
60
+
61
+ test ( 'should navigate to project settings page' , async ( { page } ) => {
62
+ const projectId = 'react-router' ;
63
+
64
+ // Go to the project detail page
65
+ await page . goto ( `/projects/${ projectId } ` ) ;
66
+
67
+ // Click the settings link
68
+ const settingsLink = page . locator ( 'a:has-text("Settings")' ) ;
69
+ await settingsLink . click ( ) ;
70
+
71
+ // Verify we're on the settings page
72
+ await expect ( page ) . toHaveURL ( `/projects/${ projectId } /settings` ) ;
73
+ } ) ;
74
+ } ) ;
0 commit comments