File tree Expand file tree Collapse file tree 3 files changed +40
-0
lines changed Expand file tree Collapse file tree 3 files changed +40
-0
lines changed Original file line number Diff line number Diff line change 1+ describe ( 'Navigation' , ( ) => {
2+ it ( 'should navigate to the about page' , ( ) => {
3+ // Start from the index page
4+ cy . visit ( 'http://localhost:3000/' )
5+
6+ // Find a link with an href attribute containing "about" and click it
7+ cy . get ( 'a[href*="about"]' ) . click ( )
8+
9+ // The new url should include "/about"
10+ cy . url ( ) . should ( 'include' , '/about' )
11+
12+ // The new page should contain an h1 with "About page"
13+ cy . get ( 'h1' ) . contains ( 'About Page' )
14+ } )
15+ } )
Original file line number Diff line number Diff line change 1+ import styles from '../styles/Home.module.css'
2+ import Link from 'next/link'
3+
4+ export default function About ( ) {
5+ return (
6+ < div className = { styles . container } >
7+ < main className = { styles . main } >
8+ < h1 > About Page</ h1 >
9+ < p className = { styles . description } >
10+ < Link href = "/" >
11+ < a > ← Go Back</ a >
12+ </ Link >
13+ </ p >
14+ </ main >
15+ </ div >
16+ )
17+ }
Original file line number Diff line number Diff line change 11import Head from 'next/head'
22import Image from 'next/image'
3+ import Link from 'next/link'
34import styles from '../styles/Home.module.css'
45
56export default function Home ( ) {
@@ -22,6 +23,13 @@ export default function Home() {
2223 </ p >
2324
2425 < div className = { styles . grid } >
26+ < Link href = "/about" >
27+ < a className = { styles . card } >
28+ < h2 > About Page →</ h2 >
29+ < p > Cypress will test if this link is working.</ p >
30+ </ a >
31+ </ Link >
32+
2533 < a href = "https://nextjs.org/docs" className = { styles . card } >
2634 < h2 > Documentation →</ h2 >
2735 < p > Find in-depth information about Next.js features and API.</ p >
You can’t perform that action at this time.
0 commit comments