Add Discover tab navigation and 404 page E2E tests
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
34
cypress/e2e/notFound404.cy.js
Normal file
34
cypress/e2e/notFound404.cy.js
Normal 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');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user