Skip to content

Commit

Permalink
Merge pull request #1466 from dhis2/update-cypress-to-v12
Browse files Browse the repository at this point in the history
chore(cypress): update to v13
  • Loading branch information
Mohammer5 authored Apr 25, 2024
2 parents 52aa1b4 + e1d1c1e commit 12b3de0
Show file tree
Hide file tree
Showing 331 changed files with 1,955 additions and 2,291 deletions.
10 changes: 10 additions & 0 deletions .cypress-cucumber-preprocessorrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"nonGlobalStepDefinitions": true,
"e2e": {
"stepDefinitions": [
"[filepath]/*.{js,mjs,ts,tsx}",
"[filepath]/../common/index.{js,mjs,ts,tsx}",
"cypress/e2e/common.js"
]
}
}
4 changes: 2 additions & 2 deletions .github/workflows/dhis2-preview-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14.x
node-version: 20.x

- uses: c-hive/gha-yarn-cache@v1
- run: yarn install --frozen-lockfile

- run: yarn build
- run: yarn build:legacy

- name: Deploy
id: netlify-deploy
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/dhis2-verify-lib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14.x
node-version: 20.x

- uses: c-hive/gha-yarn-cache@v1
- run: |
yarn install --frozen-lockfile
yarn setup
NODE_OPTIONS=--openssl-legacy-provider yarn setup
- name: Build
run: yarn build
run: NODE_OPTIONS=--openssl-legacy-provider yarn build

- run: ./scripts/create-artifact.sh

Expand All @@ -46,7 +46,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14.x
node-version: 20.x

- uses: actions/download-artifact@v2
with:
Expand All @@ -67,7 +67,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14.x
node-version: 20.x

- uses: actions/download-artifact@v2
with:
Expand Down Expand Up @@ -97,7 +97,7 @@ jobs:

- uses: actions/setup-node@v1
with:
node-version: 14.x
node-version: 20.x

- uses: actions/download-artifact@v2
with:
Expand All @@ -109,10 +109,10 @@ jobs:
run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

- name: End-to-End tests
uses: cypress-io/github-action@v2
uses: cypress-io/github-action@v6
with:
# This should be a command that starts the server to test against.
start: 'yarn cy:start'
start: 'yarn cy:start:legacy'
wait-on: 'http://localhost:5000'
wait-on-timeout: 300
record: true
Expand All @@ -136,7 +136,7 @@ jobs:
token: ${{env.GH_TOKEN}}
- uses: actions/setup-node@v3
with:
node-version: 14.x
node-version: 20.x
cache: 'yarn'

- uses: actions/download-artifact@v2
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ bundle.stats.json

# cypress
cypress/screenshots
cypress/downloads
cypress/videos
cypress.env.json

Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v16
v20
4 changes: 2 additions & 2 deletions collections/forms/i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"POT-Creation-Date: 2024-02-12T14:58:56.792Z\n"
"PO-Revision-Date: 2024-02-12T14:58:56.792Z\n"
"POT-Creation-Date: 2024-04-18T04:00:14.144Z\n"
"PO-Revision-Date: 2024-04-18T04:00:14.144Z\n"

msgid "Upload file"
msgstr "Upload file"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import '../common/index.js'
import { Given, Then } from 'cypress-cucumber-preprocessor/steps'
import { Given, Then } from '@badeball/cypress-cucumber-preprocessor'

Given('an unchecked Checkbox without value is rendered', () => {
cy.visitStory('Testing:Checkbox', 'Unchecked')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import '../common/index.js'
import { Given, Then } from 'cypress-cucumber-preprocessor/steps'
import { Given, Then } from '@badeball/cypress-cucumber-preprocessor'

Given('an unchecked Checkbox with a value is rendered', () => {
cy.visitStory('Testing:Checkbox', 'Unchecked with value')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { When } from 'cypress-cucumber-preprocessor/steps'
import { When } from '@badeball/cypress-cucumber-preprocessor'

When('the user clicks on the Checkbox', () => {
cy.get('[data-test="dhis2-uicore-checkbox"]').click()
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'
import { hasValueMessage } from '../../../validators/hasValue.js'

Given('an unchecked Checkbox is rendered', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import '../common/index.js'
import { Given, When, Then } from 'cypress-cucumber-preprocessor/steps'
import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor'

Given('a multi-file IputField is rendered', () => {
cy.visitStory('Testing:FileInput', 'Standard form')
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('a single-file FileInput is rendered', () => {
cy.visitStory('Testing:FileInput', 'Standard form')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import '../common/index.js'
import { When, Then } from 'cypress-cucumber-preprocessor/steps'
import { When, Then } from '@badeball/cypress-cucumber-preprocessor'

When('a file with the wrong file type is provided', () => {
cy.get('[name="fileTxt"]').uploadSingleFile('md', 'FileInput/file.md')
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('a Input with no text is rendered', () => {
cy.visitStory('Testing:InputFieldFF', 'Default')
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'
import { hasValueMessage } from '../../../validators/hasValue.js'

Given('an empty, required Input is rendered', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import '../common/index.js'
import { Given, When, Then } from 'cypress-cucumber-preprocessor/steps'
import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor'

Given('the MultiSelect has two options', () => {
const options = [
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('a required MultiSelect with no selected value', () => {
cy.visitStory('Testing:MultiSelectFieldFF', 'Required')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import '../common/index.js'
import { When, Then } from 'cypress-cucumber-preprocessor/steps'
import { When, Then } from '@badeball/cypress-cucumber-preprocessor'
import { hasValueMessage } from '../../../validators/hasValue.js'

When('the user submits the form', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import '../common/index.js'
import { Given, When, Then } from 'cypress-cucumber-preprocessor/steps'
import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor'

Given('there are three options', () => {
const options = [
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(
'a FieldGroupFF with required RadioFieldFFs and no selected value',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import '../common/index.js'
import { When, Then } from 'cypress-cucumber-preprocessor/steps'
import { When, Then } from '@badeball/cypress-cucumber-preprocessor'
import { hasValueMessage } from '../../../validators/hasValue.js'

When('the user submits the form', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import '../common/index.js'
import { Given, When, Then } from 'cypress-cucumber-preprocessor/steps'
import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor'

Given('the SingleSelect has one option', () => {
const options = [{ value: 'Value', label: 'Label' }]
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('a required SingleSelect with no selected value', () => {
cy.visitStory('Testing:SingleSelectFieldFF', 'Required')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import '../common/index.js'
import { When, Then } from 'cypress-cucumber-preprocessor/steps'
import { When, Then } from '@badeball/cypress-cucumber-preprocessor'
import { hasValueMessage } from '../../../validators/hasValue.js'

When('the user submits the form', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import '../common/index.js'
import { Given, Then } from 'cypress-cucumber-preprocessor/steps'
import { Given, Then } from '@badeball/cypress-cucumber-preprocessor'

Given('an unchecked Switch without value is rendered', () => {
cy.visitStory('Testing:SwitchFieldFF', 'Unchecked')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import '../common/index.js'
import { Given, Then } from 'cypress-cucumber-preprocessor/steps'
import { Given, Then } from '@badeball/cypress-cucumber-preprocessor'

Given('an unchecked Switch with a value is rendered', () => {
cy.visitStory('Testing:SwitchFieldFF', 'Unchecked with value')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { When } from 'cypress-cucumber-preprocessor/steps'
import { When } from '@badeball/cypress-cucumber-preprocessor'

When('the user clicks on the Switch', () => {
cy.get('[data-test="dhis2-uicore-switch"]').click()
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'
import { hasValueMessage } from '../../../validators/hasValue.js'

Given('an unchecked Switch is rendered', () => {
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('a TextArea with no text is rendered', () => {
cy.visitStory('TextArea', 'Default')
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'
import { hasValueMessage } from '../../../validators/hasValue.js'

Given('an empty, required TextArea is rendered', () => {
Expand Down
18 changes: 0 additions & 18 deletions components/alert/src/alert-bar/features/api/hidden_callback.js

This file was deleted.

8 changes: 6 additions & 2 deletions components/alert/src/alert-bar/features/api/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import '../common/index.js'
import { Given, Then } from 'cypress-cucumber-preprocessor/steps'
import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor'

Given('an AlertBar with onHidden handler is rendered', () => {
cy.visitStory('AlertBar', 'With onHidden')
Expand All @@ -22,6 +21,11 @@ Given('an AlertBar with permanent is rendered', () => {
cy.get('[data-test="dhis2-uicore-alertbar"]').should('be.visible')
})

When('the Alertbar is not rendered', () => {
cy.wait(8000)
cy.get('[data-test="dhis2-uicore-alertbar"]').should('not.exist')
})

Then('the icon will be visible', () => {
cy.get('[data-test="dhis2-uicore-alertbar-icon"]').should('be.visible')
})
Expand Down
47 changes: 0 additions & 47 deletions components/alert/src/alert-bar/features/api/prop_message.js

This file was deleted.

12 changes: 0 additions & 12 deletions components/alert/src/alert-bar/features/api/props_message.js

This file was deleted.

11 changes: 0 additions & 11 deletions components/alert/src/alert-bar/features/api/props_permanent.js

This file was deleted.

2 changes: 1 addition & 1 deletion components/alert/src/alert-bar/features/common/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { When, Given, Then } from 'cypress-cucumber-preprocessor/steps'
import { When, Given, Then } from '@badeball/cypress-cucumber-preprocessor'

Given('a default AlertBar is rendered', () => {
cy.visitStory('AlertBar', 'Default')
Expand Down
Loading

0 comments on commit 12b3de0

Please sign in to comment.