40 lines
1.1 KiB
JavaScript
40 lines
1.1 KiB
JavaScript
// 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('您想找的頁面不存在').should('be.visible');
|
|
});
|
|
|
|
it('has a link back to Files page', () => {
|
|
loginWithFixtures();
|
|
cy.visit('/some/random/path');
|
|
cy.contains('a', '回到 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');
|
|
}
|
|
});
|
|
});
|
|
});
|