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+ // Verify the Projects link in nav is active
12+ const projectsLink = page . locator ( 'a.nav-link[href="/projects"]' ) ;
13+ await expect ( projectsLink ) . toBeVisible ( ) ;
14+ await expect ( projectsLink ) . toHaveAttribute ( 'aria-current' , 'page' ) ;
15+ } ) ;
16+
17+ test ( 'should navigate to project detail page' , async ( { page } ) => {
18+ const projectId = 'react-router' ;
19+
20+ // Go directly to the project page
21+ await page . goto ( `/projects/${ projectId } ` ) ;
22+
23+ // Verify we're on the correct page
24+ await expect ( page ) . toHaveURL ( `/projects/${ projectId } ` ) ;
25+
26+ // Check project name is displayed
27+ const projectName = page . locator ( 'h1' ) . first ( ) ;
28+ await expect ( projectName ) . toBeVisible ( ) ;
29+
30+ // Check edit and settings links in the navigation
31+ const editLink = page . locator ( `a[href="/projects/${ projectId } /edit"]` ) ;
32+ await expect ( editLink ) . toBeVisible ( ) ;
33+
34+ const settingsLink = page . locator ( `a[href="/projects/${ projectId } /settings"]` ) ;
35+ await expect ( settingsLink ) . toBeVisible ( ) ;
36+
37+ // Check sections
38+ const sections = page . locator ( '.card h2' ) . filter ( {
39+ hasText : / P r o g r e s s | T e a m | R e c e n t A c t i v i t y /
40+ } ) ;
41+ await expect ( sections ) . toHaveCount ( 3 ) ;
42+ } ) ;
43+
44+ test ( 'should navigate to project edit page' , async ( { page } ) => {
45+ const projectId = 'react-router' ;
46+
47+ // Go to the project detail page
48+ await page . goto ( `/projects/${ projectId } ` ) ;
49+
50+ // Click the edit link
51+ const editLink = page . locator ( `a[href="/projects/${ projectId } /edit"]` ) ;
52+ await editLink . click ( ) ;
53+
54+ // Verify we're on the edit page
55+ await expect ( page ) . toHaveURL ( `/projects/${ projectId } /edit` ) ;
56+ } ) ;
57+
58+ test ( 'should navigate to project settings page' , async ( { page } ) => {
59+ const projectId = 'react-router' ;
60+
61+ // Go to the project detail page
62+ await page . goto ( `/projects/${ projectId } ` ) ;
63+
64+ // Click the settings link
65+ const settingsLink = page . locator ( `a[href="/projects/${ projectId } /settings"]` ) ;
66+ await settingsLink . click ( ) ;
67+
68+ // Verify we're on the settings page
69+ await expect ( page ) . toHaveURL ( `/projects/${ projectId } /settings` ) ;
70+ } ) ;
71+ } ) ;
0 commit comments