// The Lucia project. // Copyright 2026-2026 DSP, inc. All rights reserved. // Authors: // imacat.yang@dsp.im (imacat), 2026/03/05 import { loginWithFixtures } from '../support/intercept'; describe('404 Not Found Page', () => { beforeEach(() => { // Suppress Navbar error on 404 page (route.matched[1] is null) cy.on('uncaught:exception', () => false); }); it('displays 404 page for non-existent route', () => { loginWithFixtures(); cy.visit('/this-page-does-not-exist'); cy.contains('404').should('be.visible'); cy.contains('The page you are looking for does not exist.').should('be.visible'); }); it('has a link back to Files page', () => { loginWithFixtures(); cy.visit('/some/random/path'); cy.contains('a', 'Go to Files') .should('be.visible') .should('have.attr', 'href', '/files'); }); it('displays 404 for unauthenticated user on invalid route', () => { cy.visit('/not-a-real-page'); cy.url().then((url) => { if (url.includes('/login')) { cy.url().should('include', '/login'); } else { cy.contains('404').should('be.visible'); } }); }); });