Skip to content

Commit

Permalink
chore: upgrade cypress setup (#1421)
Browse files Browse the repository at this point in the history
* chore: upgrade cypress setup in the user-app project

Changes:
- upgrade cypress to version 13.0
- upgrade @dhis2/cypress-commands to 10.0.6
- upgrade @dhis2/cypress-plugins to 10.0.6
- replace cypress.json with new config file cypress.config.js
- replace cypress-cucumber-preprocessor package with @badeball/cypress-cucumber-preprocessor
- rename cypress/integration folder to cypress/e2e
- rename cypress/support/index.js to cypress/support/e2e.js

* chore: update cypress github action

* chore: update node version in gh workflow to 18

* chore: fix linting issues

* chore: update fixtures

* chore: update api version in github workflow
  • Loading branch information
d-rita authored Jun 25, 2024
1 parent 9c59840 commit 59c89e0
Show file tree
Hide file tree
Showing 58 changed files with 3,758 additions and 1,433 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dhis2-preview-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 16.x
node-version: 18.x

- uses: c-hive/gha-yarn-cache@v1
- run: yarn install --frozen-lockfile
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/dhis2-verify-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 16.x
node-version: 18.x

- uses: c-hive/gha-yarn-cache@v1
- run: yarn install --frozen-lockfile
Expand All @@ -51,7 +51,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 16.x
node-version: 18.x

- uses: c-hive/gha-yarn-cache@v1
- run: yarn install --frozen-lockfile
Expand All @@ -70,7 +70,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 16.x
node-version: 18.x

- uses: c-hive/gha-yarn-cache@v1
- run: yarn install --frozen-lockfile
Expand Down Expand Up @@ -98,10 +98,10 @@ jobs:

- uses: actions/setup-node@v1
with:
node-version: 16.x
node-version: 18.x

- name: End-to-End tests
uses: cypress-io/github-action@v2
uses: cypress-io/github-action@v6
with:
start: yarn d2-app-scripts start
wait-on: 'http://localhost:3000'
Expand All @@ -113,7 +113,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
CYPRESS_dhis2BaseUrl: http://localhost:8080
CYPRESS_dhis2ApiVersion: 41
CYPRESS_dhis2ApiVersion: 42
CYPRESS_networkMode: stub

release:
Expand All @@ -127,7 +127,7 @@ jobs:

- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
cache: 'yarn'

- uses: actions/download-artifact@v2
Expand Down
35 changes: 35 additions & 0 deletions cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
const {
chromeAllowXSiteCookies,
cucumberPreprocessor,
networkShim,
} = require('@dhis2/cypress-plugins')
const { defineConfig } = require('cypress')

async function setupNodeEvents(on, config) {
await cucumberPreprocessor(on, config)
networkShim(on)
chromeAllowXSiteCookies(on)
return config
}

module.exports = defineConfig({
video: false,
projectId: '48zztu',
experimentalInteractiveRunEvents: true,
env: {
dhis2BaseUrl: 'http://localhost:8080',
dhis2Username: 'admin',
dhis2Password: 'district',
dhis2DataTestPrefix: '',
networkMode: 'live',
dhis2ApiVersion: '42',
},
defaultCommandTimeout: 10000,
requestTimeout: 10000,
e2e: {
setupNodeEvents,
baseUrl: 'http://localhost:3000',
specPattern: 'cypress/e2e/**/*.feature',
excludeSpecPattern: ['**/*-wip/*.feature'],
},
})
18 changes: 0 additions & 18 deletions cypress.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Given, When, Then } from 'cypress-cucumber-preprocessor/steps'
import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor'

Given('the user-manager is on the homepage', () => {
cy.visit('/')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Given, When, Then } from 'cypress-cucumber-preprocessor/steps'
import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor'

Given('the user is on the homepage', () => {
cy.visit('/')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Given } from 'cypress-cucumber-preprocessor/steps'
import { Given } from '@badeball/cypress-cucumber-preprocessor'

Given('some user groups exist', () => {})

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import '../common.js'
import { Given, Then, When } from 'cypress-cucumber-preprocessor/steps'
import { Given, Then, When } from '@badeball/cypress-cucumber-preprocessor'

Then('the user-manager should see the first page of all user groups', () => {
cy.getWithDataTest('{dhis2-uiwidgets-pagination-summary}').contains(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import '../common.js'
import { Given, Then, When } from 'cypress-cucumber-preprocessor/steps'
import { Given, Then, When } from '@badeball/cypress-cucumber-preprocessor'

const NAME_SEARCH_QUERY = 'admin'

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Given } from 'cypress-cucumber-preprocessor/steps'
import { Given } from '@badeball/cypress-cucumber-preprocessor'

Given('some user roles exist', () => {})

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import '../common.js'
import { Given, Then, When } from 'cypress-cucumber-preprocessor/steps'
import { Given, Then, When } from '@badeball/cypress-cucumber-preprocessor'

Then('the user-manager should see the first page of all user roles', () => {
cy.getWithDataTest('{dhis2-uiwidgets-pagination-summary}').contains(
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import '../common.js'
import { Given, Then, When } from 'cypress-cucumber-preprocessor/steps'
import { Given, Then, When } from '@badeball/cypress-cucumber-preprocessor'

const NAME_SEARCH_QUERY = 'admin'

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Given } from 'cypress-cucumber-preprocessor/steps'
import { Given } from '@badeball/cypress-cucumber-preprocessor'

Given('some users exist', () => {})

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import '../common.js'
import { Given, Then, When } from 'cypress-cucumber-preprocessor/steps'
import { Given, Then, When } from '@badeball/cypress-cucumber-preprocessor'

Then('the user-manager should see the first page of all users', () => {
cy.getWithDataTest('{dhis2-uiwidgets-pagination-summary}').contains(
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import '../common.js'
import { Given, Then, When } from 'cypress-cucumber-preprocessor/steps'
import { Given, Then, When } from '@badeball/cypress-cucumber-preprocessor'

const NAME_SEARCH_QUERY = 'admin'

Expand Down
Loading

0 comments on commit 59c89e0

Please sign in to comment.