Add Discover tab navigation and 404 page E2E tests

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-05 21:56:40 +08:00
parent 584a73b90c
commit 6dd182b5e9
2 changed files with 125 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
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');
}
});
});
});