Skip to content

Commit

Permalink
Merge pull request #335 from dhis2/development
Browse files Browse the repository at this point in the history
feat: merge development into master
  • Loading branch information
Mohammer5 authored Jun 8, 2023
2 parents 124a860 + dc7aade commit 048cf83
Show file tree
Hide file tree
Showing 78 changed files with 9,737 additions and 6,595 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dhis2-verify-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ jobs:
node-version: 14.x

- name: End-to-End tests
uses: cypress-io/github-action@v2
uses: cypress-io/github-action@v5
with:
# This should be a command that serves the app.
start: yarn d2-app-scripts start
Expand Down
31 changes: 31 additions & 0 deletions cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const {
networkShim,
chromeAllowXSiteCookies,
cucumberPreprocessor,
} = require('@dhis2/cypress-plugins')
const { defineConfig } = require('cypress')

// This function will be modified when we add plugins
async function setupNodeEvents(on, config) {
await cucumberPreprocessor(on, config)
networkShim(on, config)
chromeAllowXSiteCookies(on, config)
return config
}

module.exports = defineConfig({
video: false,
projectId: 's6p5xs',
experimentalInteractiveRunEvents: true,
defaultCommandTimeout: 30000,
e2e: {
setupNodeEvents,
baseUrl: 'http://localhost:3000',
specPattern: 'cypress/e2e/**/*.feature',
},
env: {
dhis2DataTestPrefix: 'dhis2-dataentry',
networkMode: 'live',
dhis2ApiVersion: '40',
},
})
13 changes: 0 additions & 13 deletions cypress.json

This file was deleted.

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

Before(() => {
// When this is not done, the cypress:run:stubs command fails on CI for
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('no data set has been selected yet', () => {
cy.visit('/')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ Feature: A data set can be selected

Scenario: An invalid data set is selected
Given a link references an invalid data set
Then a no-value-label should be displayed
Then a no-value-label should be displayed
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'

const getDataSetSelectorValueLabelByContent = (selectorValueLabel) => {
return cy.getSelectorValueLabelByContent('Data set', selectorValueLabel)
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'

const getOrgUnitSelectorValueLabelByContent = (selectorValueLabel) => {
return cy.getSelectorValueLabelByContent(
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 data set has been selected', () => {
cy.visit(`/#/?dataSetId=Nyh6laLdBEJ`)
Expand Down Expand Up @@ -79,14 +79,12 @@ When('selects the first period option', () => {

cy.get('@firstOption')
.invoke('text')
.as('selectedPeriodLabel')
.then(console.log.bind(null, 'first option label'))
.as('selectedPeriodLabel', { type: 'static' })

cy.get('@firstOption')
.find('[data-value]')
.invoke('attr', 'data-value')
.as('selectedPeriodValue')
.then(console.log.bind(null, 'first option value'))
.as('selectedPeriodValue', { type: 'static' })

cy.get('@firstOption').click()
})
Expand Down Expand Up @@ -159,7 +157,7 @@ Then(

Then('the period id should be persisted in the url', () => {
cy.get('@selectedPeriodValue').then((selectedPeriodValue) => {
cy.url().should('match', new RegExp(`&periodId=${selectedPeriodValue}`))
cy.url().should('include', `&periodId=${selectedPeriodValue}`)
})
})

Expand All @@ -172,7 +170,7 @@ Then('the previously selected period should still be selected', () => {
cy.get('[data-test="period-selector"]')
.contains(previousPeriodId)
.should('exist')
cy.url().should('match', new RegExp(`&periodId=${previousPeriodId}`))
cy.url().should('include', `&periodId=${previousPeriodId}`)
})
})

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 data set but no org unit has been selected yet', () => {
cy.visit('/#/?dataSetId=V8MHeZHIrcP&periodId=2021')
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Given, Then } from 'cypress-cucumber-preprocessor/steps'
import { Given, Then } from '@badeball/cypress-cucumber-preprocessor'

Given('the user opens the app', () => {
cy.visit('/')
Expand Down
Loading

1 comment on commit 048cf83

@dhis2-bot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.