Add Cypress E2E tests with fixture-based API mocking for UI regression protection
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
55
cypress/e2e/files.cy.js
Normal file
55
cypress/e2e/files.cy.js
Normal file
@@ -0,0 +1,55 @@
|
||||
import { loginWithFixtures } from '../support/intercept';
|
||||
|
||||
describe('Files Page', () => {
|
||||
beforeEach(() => {
|
||||
loginWithFixtures();
|
||||
cy.visit('/files');
|
||||
});
|
||||
|
||||
it('displays the file list after login', () => {
|
||||
cy.wait('@getFiles');
|
||||
cy.contains('h2', 'All Files').should('exist');
|
||||
// Should display file names from fixture
|
||||
cy.contains('sample-process.xes').should('exist');
|
||||
cy.contains('filtered-sample').should('exist');
|
||||
cy.contains('production-log.csv').should('exist');
|
||||
});
|
||||
|
||||
it('shows Recently Used section', () => {
|
||||
cy.wait('@getFiles');
|
||||
cy.contains('h2', 'Recently Used').should('exist');
|
||||
});
|
||||
|
||||
it('switches to DISCOVER tab', () => {
|
||||
cy.wait('@getFiles');
|
||||
cy.contains('.nav-item', 'DISCOVER').click();
|
||||
// DISCOVER tab shows filtered file types
|
||||
cy.contains('h2', 'All Files').should('exist');
|
||||
});
|
||||
|
||||
it('switches to COMPARE tab and shows drag zones', () => {
|
||||
cy.wait('@getFiles');
|
||||
cy.contains('.nav-item', 'COMPARE').click();
|
||||
cy.contains('Performance Comparison').should('exist');
|
||||
cy.contains('Drag and drop a file here').should('exist');
|
||||
});
|
||||
|
||||
it('shows Import button on FILES tab', () => {
|
||||
cy.wait('@getFiles');
|
||||
cy.get('#import_btn').should('contain', 'Import');
|
||||
});
|
||||
|
||||
it('can switch between list and grid view', () => {
|
||||
cy.wait('@getFiles');
|
||||
// DataTable (list view) should be visible by default
|
||||
cy.get('table').should('exist');
|
||||
});
|
||||
|
||||
it('double-click file navigates to discover page', () => {
|
||||
cy.wait('@getFiles');
|
||||
// Double-click the first file row in the table
|
||||
// The actual route depends on file type (log→map, log-check→conformance, etc.)
|
||||
cy.get('table tbody tr').first().dblclick();
|
||||
cy.url().should('include', '/discover');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user