Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into eh/TECH/TECH-1539_R…
Browse files Browse the repository at this point in the history
…eplaceIconButton
  • Loading branch information
eirikhaugstulen committed Oct 27, 2023
2 parents d5467be + e017ac8 commit 9f99f4b
Show file tree
Hide file tree
Showing 315 changed files with 7,956 additions and 2,029 deletions.
2 changes: 1 addition & 1 deletion .cypress-cucumber-preprocessorrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"nonGlobalStepDefinitions": true
}
}
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
REACT_APP_CACHE_VERSION=$npm_package_cacheVersion
REACT_APP_SERVER_VERSION=$npm_package_serverVersion
REACT_APP_VERSION=$npm_package_version
# TODO: Remove this when upgrading to react-scripts 5 (and webpack 5)
NODE_OPTIONS=--openssl-legacy-provider
10 changes: 5 additions & 5 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,17 @@ jobs:
needs: prerequisites
if: contains(fromJson(needs.prerequisites.outputs.json-labels), github.event.label.name)
runs-on: ubuntu-latest
container: cypress/browsers:node14.7.0-chrome84
strategy:
fail-fast: false
matrix:
versions: ${{ fromJSON(needs.prerequisites.outputs.versions) }}
containers: ${{ fromJSON(needs.prerequisites.outputs.matrix-containers) }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

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

- name: compute-instance-url
id: instance-url
Expand All @@ -98,7 +97,7 @@ jobs:
version: ${{ matrix.versions }}

- name: Cypress run
uses: cypress-io/github-action@v4
uses: cypress-io/github-action@v6
with:
record: true
parallel: true
Expand All @@ -115,6 +114,7 @@ jobs:
CYPRESS_dhis2InstanceVersion: ${{matrix.versions}}
CYPRESS_dhis2Username: ${{ secrets.CYPRESS_DHIS2_USERNAME }}
CYPRESS_dhis2Password: ${{ secrets.CYPRESS_DHIS2_PASSWORD }}
NODE_OPTIONS: "--openssl-legacy-provider"

call-e2e-tests-result:
needs: cypress
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@ on:
pull_request:
types: [ labeled ]

jobs:
jobs:
preview:
runs-on: ubuntu-latest
if: (github.event.label.name == 'preview' || github.event.label.name == 'testing') && !github.event.push.repository.fork && github.actor != 'dependabot[bot]'
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14.x
node-version: 18.x

- uses: actions/cache@v2
id: yarn-cache
with:
path: '**/node_modules'
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}

- name: Install
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile
Expand Down
50 changes: 25 additions & 25 deletions .github/workflows/verify-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip ci]')"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14.x
node-version: 18.x

- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
Expand All @@ -40,10 +40,10 @@ jobs:
needs: install
if: "!contains(github.event.head_commit.message, '[skip ci]')"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14.x
node-version: 18.x

- uses: actions/cache@v2
id: yarn-cache
Expand All @@ -59,10 +59,10 @@ jobs:
if: "!contains(github.event.head_commit.message, '[skip ci]')"
needs: install
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14.x
node-version: 18.x

- uses: actions/cache@v2
id: yarn-cache
Expand All @@ -78,10 +78,10 @@ jobs:
needs: install
if: "!contains(github.event.head_commit.message, '[skip ci]')"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14.x
node-version: 18.x

- uses: actions/cache@v2
id: yarn-cache
Expand All @@ -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 @@ -119,13 +118,13 @@ jobs:
matrix:
containers: [1, 2, 3, 4, 5]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14.x
node-version: 18.x

- name: Cypress run
uses: cypress-io/github-action@v4
uses: cypress-io/github-action@v6
with:
record: true
parallel: true
Expand All @@ -142,16 +141,17 @@ jobs:
CYPRESS_dhis2InstanceVersion: ${{ needs.instance-version.outputs.version }}
CYPRESS_dhis2Username: ${{ secrets.CYPRESS_DHIS2_USERNAME }}
CYPRESS_dhis2Password: ${{ secrets.CYPRESS_DHIS2_PASSWORD }}
NODE_OPTIONS: "--openssl-legacy-provider"

build:
runs-on: ubuntu-latest
needs: [lint, flow, unit-tests]
if: "!contains(github.event.head_commit.message, '[skip ci]')"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14.x
node-version: 18.x

- uses: actions/cache@v2
id: yarn-cache
Expand All @@ -175,13 +175,13 @@ jobs:
needs: build
if: "!github.event.push.repository.fork && !contains(github.event.head_commit.message, '[skip ci]') && github.actor != 'dependabot[bot]'"
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
token: ${{ env.GH_TOKEN }}

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

- uses: actions/download-artifact@v2
with:
Expand Down
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
# [100.42.0](https://github.com/dhis2/capture-app/compare/v100.41.4...v100.42.0) (2023-10-24)


### Features

* [DHIS2-12361] Tracked Entity Relationships widget ([cafed8d](https://github.com/dhis2/capture-app/commit/cafed8d8aac3fe9955739b1a8ee2cdde57722967))

## [100.41.4](https://github.com/dhis2/capture-app/compare/v100.41.3...v100.41.4) (2023-10-22)


### Bug Fixes

* **translations:** sync translations from transifex (master) ([c82ce9f](https://github.com/dhis2/capture-app/commit/c82ce9f69159878f5ca9cc2e6ca9944544099368))

## [100.41.3](https://github.com/dhis2/capture-app/compare/v100.41.2...v100.41.3) (2023-10-16)


### Bug Fixes

* [DHIS2-15782] navigation with program stage filter ([#3431](https://github.com/dhis2/capture-app/issues/3431)) ([8f7a017](https://github.com/dhis2/capture-app/commit/8f7a017c5860104620c6b7fc8c20916b00037302))

## [100.41.2](https://github.com/dhis2/capture-app/compare/v100.41.1...v100.41.2) (2023-10-12)


Expand Down
2 changes: 1 addition & 1 deletion config/eslint/alias.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ if (fileExists(path.resolve(__dirname, '../../src/core_modules/capture-core')))
alias['capture-core-utils'] = path.resolve(__dirname, '../../src/core_modules/capture-core-utils');
}

module.exports = alias;
module.exports = alias;
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 } = require('@dhis2/cypress-plugins');
const { defineConfig } = require('cypress');
const getCypressEnvVariables = require('./cypress/support/getCypressEnvVariables');
const cucumberPreprocessor = require('./cypress/support/cucumberPreprocessor');

async function setupNodeEvents(on, config) {
await chromeAllowXSiteCookies(on);
await cucumberPreprocessor(on, config);

config.env = getCypressEnvVariables(config);
return config;
}

module.exports = defineConfig({
video: true,
dhis2_datatest_prefix: 'dhis2-capture',
chromeWebSecurityComment:
'chromeWebSecurity should removed once https://github.com/cypress-io/cypress/issues/4220 is fixed',
chromeWebSecurity: false,
defaultCommandTimeout: 25000,
projectId: '322xnh',
experimentalFetchPolyfill: true,
retries: {
runMode: 3,
},
env: {
dhis2DataTestPrefix: 'capture-app',
networkMode: 'live',
},
e2e: {
setupNodeEvents,
baseUrl: 'http://localhost:3000',
specPattern: 'cypress/e2e/**/*.feature',
},
});
18 changes: 0 additions & 18 deletions cypress.json

This file was deleted.

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

import '../sharedSteps';

Given('the user is on the the main page', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Feature: User interacts with the Enrollment New Event Workspace

Scenario: User should be asked to create new event after completing a stage and choose to cancel
Given you open the main page with Ngelehun and Malaria focus investigation context
And you opt in to use the new enrollment Dashboard for Malaria focus investigation
And you opt in to use the new enrollment Dashboard for Malaria focus investigation
Then you land on the enrollment new event page by having typed #/enrollmentEventNew?enrollmentId=zRfAPUpjoG3&orgUnitId=DiszpKrYNg8&programId=M3xtLkYBlKI&stageId=CWaAcQYKVpq&teiId=S3JjTA4QMNe
Then you see the following Enrollment: New Event
And you see the widget header Foci investigation & classification
Expand All @@ -72,3 +72,9 @@ Feature: User interacts with the Enrollment New Event Workspace
When you choose option Yes, create new event in the modal
Then you will be navigate to page #/enrollmentEventNew?enrollmentId=zRfAPUpjoG3&orgUnitId=DiszpKrYNg8&programId=M3xtLkYBlKI&teiId=S3JjTA4QMNe

Scenario: User is able to schedule an event with a note
Given you land on the enrollment new event page by having typed /#/enrollmentEventNew?enrollmentId=qcFFRp7DpcX&orgUnitId=DiszpKrYNg8&programId=WSGAb5XwJ3Y&stageId=edqlbukwRfQ&teiId=erqa3phUfpI
And you see the following Enrollment: New Event
And you select the schedule tab
When you add a comment to the event
And the events saves successfully
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Given, When, Then, defineStep as And } from '@badeball/cypress-cucumber-preprocessor';
import '../sharedSteps';

const showAllEventsInProgramStage = () => {
Expand Down Expand Up @@ -29,6 +30,32 @@ Given(/^you land on the enrollment new event page by having typed (.*)$/, (url)
cy.visit(url);
});

Given('you select the schedule tab', () => {
cy.get('[data-test="new-event-schedule-tab"]')
.click();
});

When('you add a comment to the event', () => {
cy.get('[data-test="comment-textfield"]')
.type('This is a comment')
.blur();

cy.get('[data-test="add-comment-btn"]')
.click();
});

And('the events saves successfully', () => {
cy.intercept('POST', '**/tracker?async=false').as('postEvent');

cy.get('[data-test="dhis2-uicore-button"]')
.contains('Schedule')
.click();

cy.wait('@postEvent')
.its('response.statusCode')
.should('eq', 200);
});

When(/^you click the create new button number (.*)$/, (eq) => {
cy.get('[data-test="create-new-button"]')
.eq(eq)
Expand Down Expand Up @@ -58,19 +85,6 @@ When(/^you click the checkbox number (.*)$/, (eq) => {
.click();
});

When(/^you click the (.*) button/, (buttonText) => {
cy.intercept({
method: 'POST',
url: '**/tracker?async=false',
}).as('postEvents');

cy.get('[data-test="dhis2-uicore-button"]')
.contains(buttonText)
.click();

cy.wait('@postEvents');
});

When(/^you click the button to (.*) without post request/, (buttonText) => {
cy.get('[data-test="dhis2-uicore-button"]')
.contains(buttonText)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Given, defineStep as And } from '@badeball/cypress-cucumber-preprocessor';
import '../sharedSteps';

Given(/^you land on the enrollment (.*) page by having typed (.*)$/, (_, url) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor';

Given('you land on the EnrollmentEventNew-page without a stageId', () => {
cy.visit('/#/enrollmentEventNew?programId=IpHINAT79UW&orgUnitId=DiszpKrYNg8&teiId=x2kJgpb0XQC&enrollmentId=RiNIt1yJoge');
});
Expand Down
Loading

0 comments on commit 9f99f4b

Please sign in to comment.