From 23139e1622159d9d793a82ec052cc42a701a3581 Mon Sep 17 00:00:00 2001 From: Martijn Dirkse Date: Thu, 21 Nov 2024 15:29:30 +0100 Subject: [PATCH] Do not trust null/undefined value when selecting tests --- .github/workflows/testing.js.yml | 4 ++-- cypress/e2e/checks.cy.ts | 1 + cypress/e2e/copying.cy.ts | 2 +- cypress/e2e/debug/aboutOpenedReports.cy.ts | 2 +- cypress/e2e/debug/clickingInTableOpensReport.cy.ts | 2 +- cypress/e2e/debug/custom-editor.cy.ts | 2 +- cypress/e2e/debug/deleteReports.cy.ts | 2 +- cypress/e2e/debug/fileupload.cy.ts | 2 +- cypress/e2e/debug/filterTable.cy.ts | 2 +- cypress/e2e/debug/labels.cy.ts | 2 +- cypress/e2e/debug/refresh.cy.ts | 2 +- cypress/e2e/debug/reportGenerator.cy.ts | 2 +- cypress/e2e/debug/runningReports.cy.ts | 2 +- cypress/e2e/debug/settings-component.cy.ts | 2 +- cypress/e2e/debug/show-warnings-and-errors.cy.ts | 2 +- cypress/e2e/debug/table.cy.ts | 2 +- cypress/e2e/debug/toast.cy.ts | 2 +- cypress/e2e/debug/transformation.cy.ts | 2 +- cypress/e2e/keep_state.cy.ts | 2 +- cypress/e2e/test/testtab.cy.ts | 2 +- 20 files changed, 21 insertions(+), 20 deletions(-) diff --git a/.github/workflows/testing.js.yml b/.github/workflows/testing.js.yml index 4d7092e2..ad4adea3 100644 --- a/.github/workflows/testing.js.yml +++ b/.github/workflows/testing.js.yml @@ -96,8 +96,8 @@ jobs: run: sed "s|SELECTION||g" cypress.env.json.cicd.template > cypress.env.json.cicd working-directory: ladybug-frontend if: ${{ matrix.selection }} === 'default' - - name: Choose tests to run - choice is some-selection - run: sed "s|SELECTION|\"selection\":\"some-selection\",|g" cypress.env.json.cicd.template > cypress.env.json.cicd + - name: Choose tests to run + run: sed "s|SELECTION|\"selection\":\"${{ matrix.selection }}\",|g" cypress.env.json.cicd.template > cypress.env.json.cicd working-directory: ladybug-frontend if: ${{ matrix.selection }} === 'some-selection' diff --git a/cypress/e2e/checks.cy.ts b/cypress/e2e/checks.cy.ts index 8399ef04..7b2eb53e 100644 --- a/cypress/e2e/checks.cy.ts +++ b/cypress/e2e/checks.cy.ts @@ -1,5 +1,6 @@ describe('Checks of the test environment', () => { it('Show environment', () => { cy.log('Environment variable \'selection\' is ' + Cypress.env('selection')) + cy.screenshot() }) }) \ No newline at end of file diff --git a/cypress/e2e/copying.cy.ts b/cypress/e2e/copying.cy.ts index f5b71242..065014c9 100644 --- a/cypress/e2e/copying.cy.ts +++ b/cypress/e2e/copying.cy.ts @@ -1,7 +1,7 @@ import { showSkipped } from "cypress/support/commands"; describe('Tests about copying', () => { - if(Cypress.env('selection')) { + if(Cypress.env('selection') === "default") { showSkipped() return } diff --git a/cypress/e2e/debug/aboutOpenedReports.cy.ts b/cypress/e2e/debug/aboutOpenedReports.cy.ts index 102be059..bf065219 100644 --- a/cypress/e2e/debug/aboutOpenedReports.cy.ts +++ b/cypress/e2e/debug/aboutOpenedReports.cy.ts @@ -1,7 +1,7 @@ import { showSkipped } from "cypress/support/commands"; describe('About opened reports', () => { - if(Cypress.env('selection')) { + if(Cypress.env('selection') === "default") { showSkipped() return } diff --git a/cypress/e2e/debug/clickingInTableOpensReport.cy.ts b/cypress/e2e/debug/clickingInTableOpensReport.cy.ts index ac0e7f6c..d210e248 100644 --- a/cypress/e2e/debug/clickingInTableOpensReport.cy.ts +++ b/cypress/e2e/debug/clickingInTableOpensReport.cy.ts @@ -1,7 +1,7 @@ import { showSkipped } from "cypress/support/commands"; describe('Clicking a report', () => { - if(Cypress.env('selection')) { + if(Cypress.env('selection') === "default") { showSkipped() return } diff --git a/cypress/e2e/debug/custom-editor.cy.ts b/cypress/e2e/debug/custom-editor.cy.ts index d1368755..b87087e5 100644 --- a/cypress/e2e/debug/custom-editor.cy.ts +++ b/cypress/e2e/debug/custom-editor.cy.ts @@ -1,7 +1,7 @@ import { showSkipped } from "cypress/support/commands"; describe('Tests for custom editor in debug tab', () => { - if(Cypress.env('selection')) { + if(Cypress.env('selection') === "default") { showSkipped() return } diff --git a/cypress/e2e/debug/deleteReports.cy.ts b/cypress/e2e/debug/deleteReports.cy.ts index 23fe87be..d65fc076 100644 --- a/cypress/e2e/debug/deleteReports.cy.ts +++ b/cypress/e2e/debug/deleteReports.cy.ts @@ -1,7 +1,7 @@ import { showSkipped } from "cypress/support/commands"; describe('About deleting reports', () => { - if(Cypress.env('selection')) { + if(Cypress.env('selection') === "default") { showSkipped() return } diff --git a/cypress/e2e/debug/fileupload.cy.ts b/cypress/e2e/debug/fileupload.cy.ts index 5d34987a..97038eae 100644 --- a/cypress/e2e/debug/fileupload.cy.ts +++ b/cypress/e2e/debug/fileupload.cy.ts @@ -1,7 +1,7 @@ import { showSkipped } from "cypress/support/commands"; describe('Debug file upload', () => { - if(Cypress.env('selection')) { + if(Cypress.env('selection') === "default") { showSkipped() return } diff --git a/cypress/e2e/debug/filterTable.cy.ts b/cypress/e2e/debug/filterTable.cy.ts index 61ba7136..b9aade4f 100644 --- a/cypress/e2e/debug/filterTable.cy.ts +++ b/cypress/e2e/debug/filterTable.cy.ts @@ -1,7 +1,7 @@ import { showSkipped } from "cypress/support/commands"; describe('Tests for table filter', () => { - if(Cypress.env('selection')) { + if(Cypress.env('selection') === "default") { showSkipped() return } diff --git a/cypress/e2e/debug/labels.cy.ts b/cypress/e2e/debug/labels.cy.ts index 6cbf7508..d42d413c 100644 --- a/cypress/e2e/debug/labels.cy.ts +++ b/cypress/e2e/debug/labels.cy.ts @@ -1,7 +1,7 @@ import { showSkipped } from "cypress/support/commands"; describe('Test labels', () => { - if(Cypress.env('selection')) { + if(Cypress.env('selection') === "default") { showSkipped() return } diff --git a/cypress/e2e/debug/refresh.cy.ts b/cypress/e2e/debug/refresh.cy.ts index b2112c35..c0f8369b 100644 --- a/cypress/e2e/debug/refresh.cy.ts +++ b/cypress/e2e/debug/refresh.cy.ts @@ -1,7 +1,7 @@ import { showSkipped } from "cypress/support/commands"; describe('Refresh', () => { - if(Cypress.env('selection')) { + if(Cypress.env('selection') === "default") { showSkipped() return } diff --git a/cypress/e2e/debug/reportGenerator.cy.ts b/cypress/e2e/debug/reportGenerator.cy.ts index f4fbe3a9..9ad76d78 100644 --- a/cypress/e2e/debug/reportGenerator.cy.ts +++ b/cypress/e2e/debug/reportGenerator.cy.ts @@ -1,7 +1,7 @@ import { showSkipped } from "cypress/support/commands"; describe('Report generator', () => { - if(Cypress.env('selection')) { + if(Cypress.env('selection') === "default") { showSkipped() return } diff --git a/cypress/e2e/debug/runningReports.cy.ts b/cypress/e2e/debug/runningReports.cy.ts index a01ea12b..d93f8e89 100644 --- a/cypress/e2e/debug/runningReports.cy.ts +++ b/cypress/e2e/debug/runningReports.cy.ts @@ -1,7 +1,7 @@ import { showSkipped } from "cypress/support/commands"; describe('Test running reports', () => { - if(Cypress.env('selection')) { + if(Cypress.env('selection') === "default") { showSkipped() return } diff --git a/cypress/e2e/debug/settings-component.cy.ts b/cypress/e2e/debug/settings-component.cy.ts index 6c93fbe7..5bc55f45 100644 --- a/cypress/e2e/debug/settings-component.cy.ts +++ b/cypress/e2e/debug/settings-component.cy.ts @@ -1,7 +1,7 @@ import { showSkipped } from "cypress/support/commands"; describe('Tests for settings component', () => { - if(Cypress.env('selection')) { + if(Cypress.env('selection') === "default") { showSkipped() return } diff --git a/cypress/e2e/debug/show-warnings-and-errors.cy.ts b/cypress/e2e/debug/show-warnings-and-errors.cy.ts index 1d63d841..fd1708cb 100644 --- a/cypress/e2e/debug/show-warnings-and-errors.cy.ts +++ b/cypress/e2e/debug/show-warnings-and-errors.cy.ts @@ -1,7 +1,7 @@ import { showSkipped } from "cypress/support/commands"; describe('Tests for showing errors and warnings', () => { - if(Cypress.env('selection')) { + if(Cypress.env('selection') === "default") { showSkipped() return } diff --git a/cypress/e2e/debug/table.cy.ts b/cypress/e2e/debug/table.cy.ts index 5e6a3432..919acf17 100644 --- a/cypress/e2e/debug/table.cy.ts +++ b/cypress/e2e/debug/table.cy.ts @@ -1,7 +1,7 @@ import { showSkipped } from "cypress/support/commands"; describe('Tests for Debug tab table', () => { - if(Cypress.env('selection')) { + if(Cypress.env('selection') === "default") { showSkipped() return } diff --git a/cypress/e2e/debug/toast.cy.ts b/cypress/e2e/debug/toast.cy.ts index 6e34e7e1..edfe7774 100644 --- a/cypress/e2e/debug/toast.cy.ts +++ b/cypress/e2e/debug/toast.cy.ts @@ -1,7 +1,7 @@ import { showSkipped } from "cypress/support/commands"; describe('Test toast window', () => { - if(Cypress.env('selection')) { + if(Cypress.env('selection') === "default") { showSkipped() return } diff --git a/cypress/e2e/debug/transformation.cy.ts b/cypress/e2e/debug/transformation.cy.ts index 6a8d4c2a..0c5fbfa5 100644 --- a/cypress/e2e/debug/transformation.cy.ts +++ b/cypress/e2e/debug/transformation.cy.ts @@ -1,7 +1,7 @@ import { showSkipped } from "cypress/support/commands"; describe('Tests for report transformation', () => { - if(Cypress.env('selection')) { + if(Cypress.env('selection') === "default") { showSkipped() return } diff --git a/cypress/e2e/keep_state.cy.ts b/cypress/e2e/keep_state.cy.ts index 2ef1ded1..146c0852 100644 --- a/cypress/e2e/keep_state.cy.ts +++ b/cypress/e2e/keep_state.cy.ts @@ -1,7 +1,7 @@ import { showSkipped } from "cypress/support/commands"; describe('Tests for keeping state in tabs when switching tabs', () => { - if(Cypress.env('selection')) { + if(Cypress.env('selection') === "default") { showSkipped() return } diff --git a/cypress/e2e/test/testtab.cy.ts b/cypress/e2e/test/testtab.cy.ts index b1fd2f5b..24940507 100644 --- a/cypress/e2e/test/testtab.cy.ts +++ b/cypress/e2e/test/testtab.cy.ts @@ -1,7 +1,7 @@ import { showSkipped } from "cypress/support/commands"; describe('Test the Test tab', () => { - if(Cypress.env('selection')) { + if(Cypress.env('selection') === "default") { showSkipped() return }