Skip to content

Commit

Permalink
chore: test
Browse files Browse the repository at this point in the history
  • Loading branch information
eirikhaugstulen committed Oct 19, 2023
1 parent b149324 commit ec609e2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 19 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/verify-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ jobs:

- name: Unit tests
run: yarn test

instance-version:
runs-on: ubuntu-latest
needs: [lint, flow, unit-tests]
Expand All @@ -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
Expand All @@ -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
Expand Down
11 changes: 1 addition & 10 deletions cypress/e2e/NewPage/index.js
Original file line number Diff line number Diff line change
@@ -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');
Expand Down
7 changes: 6 additions & 1 deletion cypress/e2e/sharedSteps.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('/#/');
Expand Down
7 changes: 3 additions & 4 deletions cypress/support/tagUtils/filterInstanceVersion.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
};

0 comments on commit ec609e2

Please sign in to comment.