From ec609e24a89b3bb959a97dd66da0a73f18bb1110 Mon Sep 17 00:00:00 2001 From: eirikhaugstulen Date: Thu, 19 Oct 2023 10:05:01 +0200 Subject: [PATCH] chore: test --- .github/workflows/verify-app.yml | 7 +++---- cypress/e2e/NewPage/index.js | 11 +---------- cypress/e2e/sharedSteps.js | 7 ++++++- cypress/support/tagUtils/filterInstanceVersion.js | 7 +++---- 4 files changed, 13 insertions(+), 19 deletions(-) diff --git a/.github/workflows/verify-app.yml b/.github/workflows/verify-app.yml index afe87ad0dd..39b3ec3cd6 100644 --- a/.github/workflows/verify-app.yml +++ b/.github/workflows/verify-app.yml @@ -91,7 +91,7 @@ jobs: - name: Unit tests run: yarn test - + instance-version: runs-on: ubuntu-latest needs: [lint, flow, unit-tests] @@ -105,11 +105,10 @@ jobs: instance-url: ${{ secrets.CYPRESS_DHIS2_INSTANCES_BASE_URL }}/ca-test-dev username: ${{ secrets.CYPRESS_DHIS2_USERNAME }} password: ${{ secrets.CYPRESS_DHIS2_PASSWORD }} - + cypress-dev: runs-on: ubuntu-latest needs: instance-version - container: cypress/browsers:node14.7.0-chrome84 strategy: # when one test fails, DO NOT cancel the other # containers, because this will kill Cypress processes @@ -125,7 +124,7 @@ jobs: node-version: 14.x - name: Cypress run - uses: cypress-io/github-action@v4 + uses: cypress-io/github-action@v6 with: record: true parallel: true diff --git a/cypress/e2e/NewPage/index.js b/cypress/e2e/NewPage/index.js index 27ed7ce40b..39ef495cd2 100644 --- a/cypress/e2e/NewPage/index.js +++ b/cypress/e2e/NewPage/index.js @@ -1,16 +1,7 @@ -import { Given, When, Then, defineStep as And, BeforeStep } from '@badeball/cypress-cucumber-preprocessor'; +import { Given, When, Then, defineStep as And } from '@badeball/cypress-cucumber-preprocessor'; import moment from 'moment'; import { getCurrentYear } from '../../support/date'; import '../sharedSteps'; -import { filterInstanceVersion } from '../../support/tagUtils'; - -let skip; -BeforeStep(function callback(...props) { - console.log('Before hook from global.js'); - console.log('Props', props); - console.log('This', this); - filterInstanceVersion(skip); -}); And('you are on the default registration page', () => { cy.visit('/#/new'); diff --git a/cypress/e2e/sharedSteps.js b/cypress/e2e/sharedSteps.js index 8f419b639b..720368202d 100644 --- a/cypress/e2e/sharedSteps.js +++ b/cypress/e2e/sharedSteps.js @@ -2,8 +2,13 @@ import { Given, When, Then, - defineStep as And, + defineStep as And, Before, } from '@badeball/cypress-cucumber-preprocessor'; +import { filterInstanceVersion } from '../support/tagUtils'; + +Before(function callback() { + filterInstanceVersion(() => this.skip()); +}); Given('you are in the main page with no selections made', () => { cy.visit('/#/'); diff --git a/cypress/support/tagUtils/filterInstanceVersion.js b/cypress/support/tagUtils/filterInstanceVersion.js index b8b0c867b8..f7b933cd8e 100644 --- a/cypress/support/tagUtils/filterInstanceVersion.js +++ b/cypress/support/tagUtils/filterInstanceVersion.js @@ -35,8 +35,7 @@ export const filterInstanceVersion = (skip) => { return test; }); - cy.log(`Instance version: ${currentInstanceVersion}`); - cy.log(`Test version: ${versionTags.map(versionTag => versionTag[0]).join(', ')}`); - - !shouldRun && skip(); + if (!shouldRun) { + skip(); + } };