From 5e66d677f1402b0414ae07124ad810fbc12c36ec Mon Sep 17 00:00:00 2001 From: Jamie Curnow Date: Mon, 24 Mar 2025 14:34:45 +1000 Subject: [PATCH] Adds test for dashboard endpoints --- docker/docker-compose.ci.mysql.yml | 1 + test/cypress/e2e/api/Dashboard.cy.js | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 test/cypress/e2e/api/Dashboard.cy.js diff --git a/docker/docker-compose.ci.mysql.yml b/docker/docker-compose.ci.mysql.yml index 388cdb38..108a1dca 100644 --- a/docker/docker-compose.ci.mysql.yml +++ b/docker/docker-compose.ci.mysql.yml @@ -18,6 +18,7 @@ services: MYSQL_DATABASE: 'npm' MYSQL_USER: 'npm' MYSQL_PASSWORD: 'npmpass' + MARIADB_AUTO_UPGRADE: '1' volumes: - mysql_vol:/var/lib/mysql networks: diff --git a/test/cypress/e2e/api/Dashboard.cy.js b/test/cypress/e2e/api/Dashboard.cy.js new file mode 100644 index 00000000..8fbb9715 --- /dev/null +++ b/test/cypress/e2e/api/Dashboard.cy.js @@ -0,0 +1,25 @@ +/// + +describe('Dashboard endpoints', () => { + let token; + + before(() => { + cy.getToken().then((tok) => { + token = tok; + }); + }); + + it('Should be able to get host counts', function() { + cy.task('backendApiGet', { + token: token, + path: '/api/reports/hosts' + }).then((data) => { + cy.validateSwaggerSchema('get', 200, '/reports/hosts', data); + expect(data).to.have.property('dead'); + expect(data).to.have.property('proxy'); + expect(data).to.have.property('redirection'); + expect(data).to.have.property('stream'); + }); + }); + +});