diff --git a/cypress/e2e/filesToDiscover.cy.js b/cypress/e2e/filesToDiscover.cy.js new file mode 100644 index 0000000..6dbeebd --- /dev/null +++ b/cypress/e2e/filesToDiscover.cy.js @@ -0,0 +1,69 @@ +import { loginWithFixtures } from '../support/intercept'; + +describe('Files to Discover Entry Flow', () => { + beforeEach(() => { + loginWithFixtures(); + // Suppress Cytoscape rendering errors in headless mode + cy.on('uncaught:exception', () => false); + cy.visit('/files'); + cy.wait('@getFiles'); + }); + + describe('double-click table row to enter Discover', () => { + it('double-click log file navigates to Map page', () => { + // Target the Name column (has class .fileName) to avoid matching Dependency column + cy.contains('td.fileName', 'sample-process.xes').parent('tr').dblclick(); + cy.url().should('include', '/discover/log/1/map'); + cy.wait('@getDiscover'); + cy.get('#cy').should('exist'); + }); + + it('double-click filter file navigates to Map page', () => { + cy.contains('td.fileName', 'filtered-sample').parent('tr').dblclick(); + cy.url().should('include', '/discover/filter/10/map'); + cy.wait('@getFilterDiscover'); + cy.get('#cy').should('exist'); + }); + }); + + describe('double-click grid card to enter Discover', () => { + beforeEach(() => { + // Switch to grid view + cy.get('svg').parent('li.cursor-pointer').last().click(); + }); + + it('double-click log file grid card navigates to Map page', () => { + // Use last() to target the All Files grid section (not Recently Used) + cy.get('li[title="sample-process.xes"]').last().dblclick(); + cy.url().should('include', '/discover/log/1/map'); + cy.wait('@getDiscover'); + cy.get('#cy').should('exist'); + }); + }); + + describe('DISCOVER tab filters files', () => { + it('clicking DISCOVER tab shows only Log, Filter, and Rule files', () => { + cy.get('.nav-item').contains('DISCOVER').click(); + cy.contains('td.fileName', 'sample-process.xes').should('exist'); + cy.contains('td.fileName', 'filtered-sample').should('exist'); + cy.contains('td.fileName', 'conformance-check-1').should('exist'); + }); + }); + + describe('Navbar state after entering Discover', () => { + it('shows DISCOVER heading and tabs after entering from Files', () => { + cy.contains('td.fileName', 'sample-process.xes').parent('tr').dblclick(); + cy.url().should('include', '/discover/'); + cy.get('#nav_bar').contains('DISCOVER').should('be.visible'); + cy.get('.nav-item').contains('MAP').should('exist'); + cy.get('.nav-item').contains('CONFORMANCE').should('exist'); + cy.get('.nav-item').contains('PERFORMANCE').should('exist'); + }); + + it('shows back arrow pointing to /files', () => { + cy.contains('td.fileName', 'sample-process.xes').parent('tr').dblclick(); + cy.url().should('include', '/discover/'); + cy.get('#backPage').should('have.attr', 'href', '/files'); + }); + }); +}); diff --git a/cypress/support/intercept.js b/cypress/support/intercept.js index 0c9346f..7a2e896 100644 --- a/cypress/support/intercept.js +++ b/cypress/support/intercept.js @@ -59,6 +59,12 @@ export function setupApiIntercepts() { body: { success: true }, }).as('deleteUserRole'); + // Filter detail (for fetchFunnel when entering filter from Files) + cy.intercept('GET', /\/api\/filters\/\d+$/, { + statusCode: 200, + body: { rules: [], log: { id: 1 }, name: 'filtered-sample' }, + }).as('getFilterDetail'); + // Discover (map data) cy.intercept('GET', '/api/logs/*/discover', { fixture: 'api/discover.json',