Add Discover tab navigation and 404 page E2E tests
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
91
cypress/e2e/discoverTabs.cy.js
Normal file
91
cypress/e2e/discoverTabs.cy.js
Normal file
@@ -0,0 +1,91 @@
|
||||
import { loginWithFixtures } from '../support/intercept';
|
||||
|
||||
describe('Discover Tab Navigation', () => {
|
||||
beforeEach(() => {
|
||||
loginWithFixtures();
|
||||
// Suppress Cytoscape rendering errors in headless mode
|
||||
cy.on('uncaught:exception', () => false);
|
||||
});
|
||||
|
||||
describe('navigating from Map page', () => {
|
||||
beforeEach(() => {
|
||||
cy.visit('/discover/log/297310264/map');
|
||||
cy.wait('@getDiscover');
|
||||
});
|
||||
|
||||
it('shows DISCOVER heading and MAP/CONFORMANCE/PERFORMANCE tabs', () => {
|
||||
cy.get('#nav_bar').contains('DISCOVER').should('be.visible');
|
||||
cy.get('.nav-item').should('have.length', 3);
|
||||
cy.get('.nav-item').eq(0).should('contain', 'MAP');
|
||||
cy.get('.nav-item').eq(1).should('contain', 'CONFORMANCE');
|
||||
cy.get('.nav-item').eq(2).should('contain', 'PERFORMANCE');
|
||||
});
|
||||
|
||||
it('clicking PERFORMANCE tab navigates to performance page', () => {
|
||||
cy.get('.nav-item').contains('PERFORMANCE').click();
|
||||
cy.url().should('include', '/performance');
|
||||
cy.wait('@getPerformance');
|
||||
cy.get('.z-\\[9999\\]', { timeout: 10000 }).should('not.exist');
|
||||
cy.contains('Time Usage').should('be.visible');
|
||||
});
|
||||
|
||||
it('clicking CONFORMANCE tab navigates to conformance page', () => {
|
||||
cy.get('.nav-item').contains('CONFORMANCE').click();
|
||||
cy.url().should('include', '/conformance');
|
||||
cy.wait('@getLogCheckParams');
|
||||
cy.get('.z-\\[9999\\]', { timeout: 10000 }).should('not.exist');
|
||||
cy.contains('Rule Settings').should('be.visible');
|
||||
});
|
||||
|
||||
it('shows back arrow to return to Files', () => {
|
||||
cy.get('#backPage').should('exist');
|
||||
cy.get('#backPage').should('have.attr', 'href', '/files');
|
||||
});
|
||||
});
|
||||
|
||||
describe('navigating from Performance page', () => {
|
||||
beforeEach(() => {
|
||||
cy.visit('/discover/log/297310264/performance');
|
||||
cy.wait('@getPerformance');
|
||||
cy.get('.z-\\[9999\\]', { timeout: 10000 }).should('not.exist');
|
||||
});
|
||||
|
||||
it('clicking MAP tab navigates to map page', () => {
|
||||
cy.get('.nav-item').contains('MAP').click();
|
||||
cy.url().should('include', '/map');
|
||||
cy.wait('@getDiscover');
|
||||
cy.get('#cy').should('exist');
|
||||
});
|
||||
|
||||
it('clicking CONFORMANCE tab navigates to conformance page', () => {
|
||||
cy.get('.nav-item').contains('CONFORMANCE').click();
|
||||
cy.url().should('include', '/conformance');
|
||||
cy.wait('@getLogCheckParams');
|
||||
cy.get('.z-\\[9999\\]', { timeout: 10000 }).should('not.exist');
|
||||
cy.contains('Rule Settings').should('be.visible');
|
||||
});
|
||||
});
|
||||
|
||||
describe('navigating from Conformance page', () => {
|
||||
beforeEach(() => {
|
||||
cy.visit('/discover/log/297310264/conformance');
|
||||
cy.wait('@getLogCheckParams');
|
||||
cy.get('.z-\\[9999\\]', { timeout: 10000 }).should('not.exist');
|
||||
});
|
||||
|
||||
it('clicking MAP tab navigates to map page', () => {
|
||||
cy.get('.nav-item').contains('MAP').click();
|
||||
cy.url().should('include', '/map');
|
||||
cy.wait('@getDiscover');
|
||||
cy.get('#cy').should('exist');
|
||||
});
|
||||
|
||||
it('clicking PERFORMANCE tab navigates to performance page', () => {
|
||||
cy.get('.nav-item').contains('PERFORMANCE').click();
|
||||
cy.url().should('include', '/performance');
|
||||
cy.wait('@getPerformance');
|
||||
cy.get('.z-\\[9999\\]', { timeout: 10000 }).should('not.exist');
|
||||
cy.contains('Time Usage').should('be.visible');
|
||||
});
|
||||
});
|
||||
});
|
||||
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