@@ -5,7 +5,7 @@ interface SidebarLink {
55
66describe ( "Link Tests" , ( ) => {
77 beforeEach ( ( ) => {
8- cy . visit ( "http://localhost:3000 " ) ;
8+ cy . visit ( "/ " ) ;
99 } ) ;
1010
1111 describe ( "Navigation Links" , ( ) => {
@@ -22,27 +22,24 @@ describe("Link Tests", () => {
2222 } ) ;
2323
2424 it ( "should have working footer links" , ( ) => {
25- // Test Learn section links
26- cy . contains ( "Quick Start" ) . click ( ) ;
27- cy . url ( ) . should ( "include" , "/docs" ) ;
28- cy . go ( "back" ) ;
29-
30- cy . contains ( "Getting Started With CLI" ) . click ( ) ;
31- cy . url ( ) . should ( "include" , "/docs/doc-cli-install-quick-start" ) ;
32- cy . go ( "back" ) ;
33-
34- // Test Decorate section links
35- cy . contains ( "Color" ) . click ( ) ;
36- cy . url ( ) . should ( "include" , "/docs/doc-color" ) ;
37- cy . go ( "back" ) ;
25+ const footerLinks : SidebarLink [ ] = [
26+ { text : "Quick Start" , url : "/docs" } ,
27+ { text : "Getting Started With CLI" , url : "/docs/doc-cli-install-quick-start" } ,
28+ { text : "Color" , url : "/docs/doc-color" } ,
29+ { text : "Border" , url : "/docs/doc-border-design" } ,
30+ { text : "Alignment" , url : "/docs/doc-alignment" } ,
31+ ] ;
3832
39- cy . contains ( "Border" ) . click ( ) ;
40- cy . url ( ) . should ( "include" , "/docs/doc-border-design" ) ;
41- cy . go ( "back" ) ;
33+ footerLinks . forEach ( ( link : SidebarLink ) => {
34+ cy . visit ( "/" ) ;
35+ cy . get ( "footer" )
36+ . contains ( "a" , link . text )
37+ . should ( "have.attr" , "href" )
38+ . and ( "include" , link . url ) ;
4239
43- cy . contains ( "Alignment" ) . click ( ) ;
44- cy . url ( ) . should ( "include" , "/docs/doc-alignment" ) ;
45- cy . go ( "back" ) ;
40+ cy . get ( "footer" ) . contains ( "a" , link . text ) . click ( ) ;
41+ cy . url ( ) . should ( "include" , link . url ) ;
42+ } ) ;
4643 } ) ;
4744
4845 it ( "should have working external links in footer" , ( ) => {
@@ -90,7 +87,7 @@ describe("Link Tests", () => {
9087 ] ;
9188
9289 sidebarLinks . forEach ( ( link : SidebarLink ) => {
93- cy . contains ( link . text ) . click ( ) ;
90+ cy . get ( ".theme-doc-sidebar-container" ) . contains ( "a" , link . text ) . click ( ) ;
9491 cy . url ( ) . should ( "include" , link . url ) ;
9592 // Verify page content is loaded
9693 cy . get ( "main" ) . should ( "exist" ) ;
@@ -120,4 +117,4 @@ describe("Link Tests", () => {
120117 . should ( "have.attr" , "rel" , "noopener noreferrer" ) ;
121118 } ) ;
122119 } ) ;
123- } ) ;
120+ } ) ;
0 commit comments