@@ -11,7 +11,7 @@ This file is part of Network Pro.
1111 * @description Runs Playwright E2E tests with desktop and root route assertions.
1212 * @module tests/e2e
1313 * @author SunDevil311
14- * @updated 2025-05-29
14+ * @updated 2025-09-17
1515 */
1616
1717import { expect , test } from '@playwright/test' ;
@@ -22,28 +22,14 @@ import {
2222 setMobileView ,
2323} from './shared/helpers.js' ;
2424
25- // Root route should load successfully with the correct title
25+ // Root route should display nav bar and about link
2626test . describe ( 'Desktop Tests' , ( ) => {
27- test ( 'should load successfully with the correct title' , async ( {
28- page,
29- browserName,
30- } ) => {
31- if ( browserName === 'webkit' ) test . skip ( ) ;
32-
33- await setDesktopView ( page ) ;
34- await page . goto ( '/' ) ;
35- await page . waitForLoadState ( 'load' , { timeout : 60000 } ) ;
36- await expect ( page ) . toHaveTitle ( / S e c u r i t y , N e t w o r k i n g , P r i v a c y / , {
37- timeout : 60000 ,
38- } ) ;
39- } ) ;
40-
41- // Root route should display nav bar and about link
4227 test ( "should display the navigation bar and 'about' link" , async ( {
4328 page,
4429 } ) => {
4530 await setDesktopView ( page ) ;
4631 await page . goto ( '/' ) ;
32+ await page . waitForLoadState ( 'domcontentloaded' , { timeout : 60000 } ) ;
4733
4834 const nav = await getVisibleNav ( page ) ;
4935
@@ -56,8 +42,9 @@ test.describe('Desktop Tests', () => {
5642 test ( 'should display the footer correctly' , async ( { page } ) => {
5743 await setDesktopView ( page ) ;
5844 await page . goto ( '/' ) ;
45+ await page . waitForLoadState ( 'domcontentloaded' , { timeout : 60000 } ) ;
5946
60- const footer = page . locator ( 'footer' ) ;
47+ const footer = getFooter ( page ) ;
6148 await expect ( footer ) . toBeVisible ( ) ;
6249 } ) ;
6350
@@ -67,6 +54,7 @@ test.describe('Desktop Tests', () => {
6754 } ) => {
6855 await setDesktopView ( page ) ;
6956 await page . goto ( '/about' ) ;
57+ await page . waitForLoadState ( 'domcontentloaded' , { timeout : 60000 } ) ;
7058
7159 const footer = getFooter ( page ) ;
7260 await expect ( footer ) . toBeVisible ( ) ;
@@ -76,40 +64,29 @@ test.describe('Desktop Tests', () => {
7664 test ( "should ensure the 'about' link is clickable" , async ( { page } ) => {
7765 await setDesktopView ( page ) ;
7866 await page . goto ( '/' ) ;
67+ await page . waitForLoadState ( 'domcontentloaded' , { timeout : 60000 } ) ;
7968
8069 const nav = await getVisibleNav ( page ) ;
8170
8271 const aboutLink = nav . getByRole ( 'link' , { name : 'about' } ) ;
83- await expect ( aboutLink ) . toBeVisible ( { timeout : 60000 } ) ;
72+ await expect ( aboutLink ) . toBeVisible ( ) ;
8473 await aboutLink . click ( ) ;
8574
8675 await page . waitForURL ( '/about' , { timeout : 60000 } ) ;
8776 await expect ( page ) . toHaveURL ( / \/ a b o u t / ) ;
8877 } ) ;
8978} ) ; // End Desktop Tests
9079
91- // Root route should load successfully with the correct title ( mobile)
80+ // Root route should display headings properly on mobile
9281test . describe ( 'Mobile Tests' , ( ) => {
93- test ( 'should load successfully with the correct title on mobile' , async ( {
94- page,
95- browserName,
96- } ) => {
97- if ( browserName === 'webkit' ) test . skip ( ) ;
98-
99- await setMobileView ( page ) ;
100- await page . goto ( '/' ) ;
101- await page . waitForLoadState ( 'load' , { timeout : 60000 } ) ;
102- await expect ( page ) . toHaveTitle ( / S e c u r i t y , N e t w o r k i n g , P r i v a c y / , {
103- timeout : 60000 ,
104- } ) ;
105- } ) ;
106-
107- // Root route should display headings properly on mobile
10882 test ( 'should display main content correctly on mobile' , async ( { page } ) => {
10983 await setMobileView ( page ) ;
11084 await page . goto ( '/' ) ;
85+ await page . waitForLoadState ( 'domcontentloaded' , { timeout : 60000 } ) ;
11186
11287 const mainHeading = page . locator ( 'h1, h2' ) ;
11388 await expect ( mainHeading ) . toBeVisible ( ) ;
11489 } ) ;
11590} ) ;
91+
92+ // cspell:ignore domcontentloaded
0 commit comments