diff --git a/pkg/dashboard/frontend/cypress/e2e/a11y.cy.ts b/pkg/dashboard/frontend/cypress/e2e/a11y.cy.ts index 4eb93603..2a67282e 100644 --- a/pkg/dashboard/frontend/cypress/e2e/a11y.cy.ts +++ b/pkg/dashboard/frontend/cypress/e2e/a11y.cy.ts @@ -7,7 +7,9 @@ describe('a11y test suite', () => { '/storage', '/secrets', '/topics', + '/jobs', '/websockets', + '/logs', '/not-found', ] diff --git a/pkg/dashboard/frontend/cypress/e2e/logs.cy.ts b/pkg/dashboard/frontend/cypress/e2e/logs.cy.ts new file mode 100644 index 00000000..ab968987 --- /dev/null +++ b/pkg/dashboard/frontend/cypress/e2e/logs.cy.ts @@ -0,0 +1,60 @@ +describe('logs test suite', () => { + beforeEach(() => { + cy.viewport('macbook-16') + + cy.visit('/logs') + + cy.wait(500) + }) + + it(`Should create logs for started service`, () => { + const expectedServices = [ + 'test-app_services-my-test-secret', + 'test-app_services-my-test-service', + 'test-app_services-my-test-db', + ] + + cy.getTestEl('test-row0-service').should(($el) => { + expect($el.text()).to.be.oneOf(expectedServices) + }) + cy.getTestEl('test-row1-service').should(($el) => { + expect($el.text()).to.be.oneOf(expectedServices) + }) + cy.getTestEl('test-row2-service').should(($el) => { + expect($el.text()).to.be.oneOf(expectedServices) + }) + }) + + it(`Should create logs for nodemon`, () => { + const expectedLogs = [ + '$ nodemon -r dotenv/config services/my-test-secret.ts', + '$ nodemon -r dotenv/config services/my-test-service.ts', + '$ nodemon -r dotenv/config services/my-test-db.ts', + ] + + cy.getTestEl('test-row6-msg').should(($el) => { + expect($el.text()).to.be.oneOf(expectedLogs) + }) + cy.getTestEl('test-row7-msg').should(($el) => { + expect($el.text()).to.be.oneOf(expectedLogs) + }) + cy.getTestEl('test-row8-msg').should(($el) => { + expect($el.text()).to.be.oneOf(expectedLogs) + }) + }) + + it(`Should purge logs`, () => { + cy.getTestEl('logs').children().should('have.length.above', 2) + + cy.intercept('DELETE', '/api/logs').as('purge') + + cy.getTestEl('purge-logs-btn').click() + + cy.wait('@purge') + + cy.getTestEl('logs') + .children() + .first() + .should('have.text', 'No logs available') + }) +}) diff --git a/pkg/dashboard/frontend/src/components/logs/LogsExplorer.tsx b/pkg/dashboard/frontend/src/components/logs/LogsExplorer.tsx index 27b7dc9f..d60d412e 100644 --- a/pkg/dashboard/frontend/src/components/logs/LogsExplorer.tsx +++ b/pkg/dashboard/frontend/src/components/logs/LogsExplorer.tsx @@ -15,6 +15,7 @@ const Logs: React.FC = () => {
{serviceName}
-{serviceName}
+