Skip to content

Commit

Permalink
chore: merges the change of the data-test naming into v36 (#1598)
Browse files Browse the repository at this point in the history
* docs: Update README

* refactor: exports shared steps & fixes all tests (#1483)

* chore: only the fail true is on

* chore: fixes existing tests

* chore: reduces time

* chore: drops time more

* chore: adds 1000 ms

* chore: bring time to 20000

* chore: fixes new page

* chore: bring time down to 7000

* chore: time is 12000

* chore: timer is 14000

* chore: time equals 12000

* feat: extracts the functions

* chore: drops time to 6000

* chore: up to 12000

* chore: 15000

* chore: rebase and splits the shared steps

* chore: addmission date and missing steps

* chore: random and

* chore: fixes the tests

* chore: typo

* fix: program error bug (#1532)

* chore: solves the bug

* chore: covers with tests

* chore: adds missing test cases

* chore: removes the dhis2-capture- prefix (#1410)

* fix: the bug (#1536)

* chore(release): cut 1.15.1 [skip ci]

## [1.15.1](v1.15.0...v1.15.1) (2021-03-04)

### Bug Fixes

* the bug ([#1536](#1536)) ([fd2616f](fd2616f))

* chore: forward-ports the last two PRs  (#1588)

* fix: DHIS2-10738 pressing the back button after a fallback crashes app (#1581)

* chore: sets to false

* chore: covers bug case

* fix: the bug (#1580)

* chore: fix the rerun (#1589)

* chore: fixes

Co-authored-by: Joakim Storløkken Melseth <joakim@dhis2.org>
Co-authored-by: @dhis2-bot <apps@dhis2.org>
Co-authored-by: Joakim Storløkken Melseth <joakim.melseth@gmail.com>
  • Loading branch information
4 people authored Apr 8, 2021
1 parent 1360124 commit 0b6f8c3
Show file tree
Hide file tree
Showing 58 changed files with 320 additions and 308 deletions.
1 change: 1 addition & 0 deletions .github/workflows/cypress-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ jobs:
CI: true
CYPRESS_RECORD_KEY: '6b0bce0d-a4e8-417b-bbee-9157cbe9a999'
REACT_APP_DHIS2_BASE_URL: 'https://debug.dhis2.org/ca-test-2.36'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## [1.15.1](https://github.com/dhis2/capture-app/compare/v1.15.0...v1.15.1) (2021-03-04)


### Bug Fixes

* the bug ([#1536](https://github.com/dhis2/capture-app/issues/1536)) ([fd2616f](https://github.com/dhis2/capture-app/commit/fd2616f92b768249601be6e020527e9f89cd19ef))

# [1.15.0](https://github.com/dhis2/capture-app/compare/v1.14.0...v1.15.0) (2021-02-25)


Expand Down
30 changes: 17 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ You can download and install Node on your machine from [here](https://nodejs.org

You can find a tutorial on how to install `git` on your machine [here](https://www.atlassian.com/git/tutorials/install-git).

#### Yarn
#### Yarn 1

You can install `yarn` on your machine [here](https://classic.yarnpkg.com/en/docs/install/).
You can install `yarn 1` on your machine following the instructions [here](https://classic.yarnpkg.com/en/docs/install/).


### Installing

A step by step series of examples that tell you how to get a development env running.
Step by step instructions for setting up a development environment.

#### 1. Clone the repository

Expand All @@ -50,27 +50,31 @@ To install the dependencies you will have to be at the source folder of the clon
```
yarn
```
#### 3. Enable cross-site cookies in your browser (if server is running on a different domain)

#### 3. Set environment variables for backend communication
Read about cross-site cookies and DHIS2 applications [here](https://dhis2.nu/2020/08/cross-origin-cookies)

The application needs to communicate with a DHIS2 backend instance. The `.env.development` file contains default configuration, but you can override it by supplying a `.env.development.local` file in the root folder of the project.
TL;DR: Using Google Chrome or a Chromium-based browser open chrome://flags/#same-site-by-default-cookies and set `SameSite by default cookies` to `Disabled` (Browser restart required).

#### 4. Run the application

To start the application locally and interact with it in the browser, run:

An example of `.env.development`:
```
# Default admin/district authorization for development
REACT_APP_DHIS2_BASE_URL="https://debug.dhis2.org/2.34dev/"
REACT_APP_DHIS2_AUTHORIZATION="Basic c3lzdGVtOlN5c3RlbTEyMw=="
REACT_APP_TRACKER_CAPTURE_APP_PATH="https://debug.dhis2.org/2.34dev/dhis-web-tracker-capture"
yarn start
```

#### 4. Run the application
`http://localhost:3000` should automatically open in your browser.

You will be prompted for a path to the server instance, a user name and a password.

To start the application locally and interact with it on the browser, run:
The path to the server instance can also be set by supplying a `.env.development.local` file in the root folder of the project. An example of an `.env.development.local` file:

```
yarn start
REACT_APP_DHIS2_BASE_URL="http://localhost:8080"
```


## Built With

This project was bootstrapped with [Create React App](https://github.com/facebookincubator/create-react-app).
Expand Down
14 changes: 7 additions & 7 deletions cypress/integration/EnrollmentPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ beforeEach(() => {

Given('you are on an enrollment page', () => {
cy.visit('/#/enrollment?programId=IpHINAT79UW&orgUnitId=UgYg0YW7ZIh&teiId=fhFQhO0xILJ&enrollmentId=gPDueU02tn8');
cy.get('[data-test="dhis2-capture-enrollment-page-content"]')
cy.get('[data-test="enrollment-page-content"]')
.contains('Enrollment Dashboard');
});

Expand All @@ -18,28 +18,28 @@ And('you select the Inpatient morbidity program', () => {
});

And('you see the registration form for the Inpatient morbidity program', () => {
cy.get('[data-test="dhis2-capture-registration-page-content"]')
cy.get('[data-test="registration-page-content"]')
.contains('New Inpatient morbidity and mortality')
.should('exist');
cy.get('[data-test="dhis2-capture-registration-page-content"]')
cy.get('[data-test="registration-page-content"]')
.contains('Saving to Inpatient morbidity and mortality in Taninahun (Malen) CHP')
.should('exist');
});

And('you see the registration form for the Malaria case diagnosis', () => {
cy.get('[data-test="dhis2-capture-registration-page-content"]')
cy.get('[data-test="registration-page-content"]')
.contains('New malaria entity in program: Malaria case diagnosis, treatment and investigation')
.should('exist');
cy.get('[data-test="dhis2-capture-registration-page-content"]')
cy.get('[data-test="registration-page-content"]')
.contains('Saving a malaria entity in Malaria case diagnosis, treatment and investigation in Taninahun (Malen) CHP.')
.should('exist');
});

And('you see the registration form for the MNCH PNC program', () => {
cy.get('[data-test="dhis2-capture-registration-page-content"]')
cy.get('[data-test="registration-page-content"]')
.contains('New person in program: MNCH / PNC (Adult Woman)')
.should('exist');
cy.get('[data-test="dhis2-capture-registration-page-content"]')
cy.get('[data-test="registration-page-content"]')
.contains('Saving a person in MNCH / PNC (Adult Woman) in Taninahun (Malen) CHP.')
.should('exist');
});
Expand Down
54 changes: 27 additions & 27 deletions cypress/integration/LockedSelector/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@ beforeEach(() => {
});

When('you click the "New" button to add a new event', () => {
cy.get('[data-test="dhis2-capture-new-event-button"]')
cy.get('[data-test="new-event-button"]')
.click();
});

When('you click the first option from the "New" button to add a new event', () => {
cy.get('[data-test="dhis2-capture-new-button"]')
cy.get('[data-test="new-button"]')
.click();
cy.get('[data-test="dhis2-capture-new-menuitem-one"]')
cy.get('[data-test="new-menuitem-one"]')
.click();
});

Then('you should see informative text saying you should do finish your selections', () => {
cy.get('[data-test="dhis2-capture-informative-paper"]')
cy.get('[data-test="informative-paper"]')
.should('exist');
});

Given('you are in the main page with organisation unit preselected', () => {
cy.visit('/#/?orgUnitId=DiszpKrYNg8');
cy.get('[data-test="dhis2-capture-new-event-button"]')
cy.get('[data-test="new-event-button"]')
.should('exist');
});

Expand All @@ -33,7 +33,7 @@ Then('you should be taken to the new page', () => {

Given('you are in the main page with program preselected', () => {
cy.visit('/#/?programId=VBqh0ynB2wv');
cy.get('[data-test="dhis2-capture-new-button"]')
cy.get('[data-test="new-button"]')
.should('exist');
});

Expand Down Expand Up @@ -66,7 +66,7 @@ Given('you select both org unit and program Child Programme', () => {
});

When('you click the "Start again" button', () => {
cy.get('[data-test="dhis2-capture-start-again-button"]')
cy.get('[data-test="start-again-button"]')
.click();
});

Expand All @@ -83,7 +83,7 @@ Then('you should see the table', () => {
});

Then('you can see the new event page', () => {
cy.get('[data-test="dhis2-capture-start-again-button"]')
cy.get('[data-test="start-again-button"]')
.should('exist');
});

Expand All @@ -107,7 +107,7 @@ Given('you land on a main page with an invalid org unit id', () => {
});

Then('you should see error message', () => {
cy.get('[data-test="dhis2-capture-error-message-handler"]')
cy.get('[data-test="error-message-handler"]')
.should('exist');
});

Expand All @@ -117,12 +117,12 @@ Given('you land on a view event page from the url', () => {

Given('you are in the new event page with no selections made', () => {
cy.visit('/#/new');
cy.get('[data-test="dhis2-capture-informative-paper"]')
cy.get('[data-test="informative-paper"]')
.should('exist');
});

When('you click the cancel button', () => {
cy.get('[data-test="dhis2-capture-new-page-cancel-button"]')
cy.get('[data-test="new-page-cancel-button"]')
.click();
});

Expand Down Expand Up @@ -190,14 +190,14 @@ Given('you land on a view event page with an invalid id', () => {
});

When('you click the find button', () => {
cy.get('[data-test="dhis2-capture-find-button"]')
cy.get('[data-test="find-button"]')
.click();
});

When('you click the find button from the dropdown menu', () => {
cy.get('[data-test="dhis2-capture-find-button"]')
cy.get('[data-test="find-button"]')
.click();
cy.get('[data-test="dhis2-capture-find-menuitem-one"]')
cy.get('[data-test="find-menuitem-one"]')
.click();
});

Expand All @@ -210,13 +210,13 @@ Then('you are navigated to the search page with the same org unit and program Ch
});

Then('there should be visible a title with Child Program', () => {
cy.get('[data-test="dhis2-capture-search-page-content"]')
cy.get('[data-test="search-page-content"]')
.contains('person in program: Child Programme')
.should('exist');
});

And('there should be Child Programme domain forms visible to search with', () => {
cy.get('[data-test="dhis2-capture-search-page-content"]')
cy.get('[data-test="search-page-content"]')
.find('[data-test="capture-ui-input"]')
.should('have.length', 1);
});
Expand Down Expand Up @@ -245,7 +245,7 @@ Given(/^you land on the enrollment page by having typed the (.*)$/, (url) => {
});

Then(/^you can see on the locked selector the following (.*)$/, (state) => {
lockedSelectorCases[state].map(selection => cy.get('[data-test="dhis2-capture-locked-selector"]').contains(selection));
lockedSelectorCases[state].map(selection => cy.get('[data-test="locked-selector"]').contains(selection));
});

Then(/^you see the following (.*)$/, (message) => {
Expand All @@ -254,7 +254,7 @@ Then(/^you see the following (.*)$/, (message) => {

And('you land on the enrollment page by having typed only the enrollmentId on the url', () => {
cy.visit('/#/enrollment?enrollmentId=gPDueU02tn8');
cy.get('[data-test="dhis2-capture-enrollment-page-content"]')
cy.get('[data-test="enrollment-page-content"]')
.contains('Enrollment Dashboard');
});

Expand All @@ -272,7 +272,7 @@ And('you navigated to the main page', () => {

And('you see message explaining you need to select a program', () => {
cy.url().should('eq', `${Cypress.config().baseUrl}/#/enrollment?orgUnitId=UgYg0YW7ZIh&teiId=fhFQhO0xILJ&enrollmentId=gPDueU02tn8`);
cy.get('[data-test="dhis2-capture-enrollment-page-content"]')
cy.get('[data-test="enrollment-page-content"]')
.contains('Carlos Cruz is enrolled in multiple programs. Choose a program.');
});

Expand All @@ -287,13 +287,13 @@ And('you reset the org unit selection', () => {

And('you see the enrollment page but there is no org unit id in the url', () => {
cy.url().should('eq', `${Cypress.config().baseUrl}/#/enrollment?programId=IpHINAT79UW&teiId=fhFQhO0xILJ&enrollmentId=gPDueU02tn8`);
cy.get('[data-test="dhis2-capture-enrollment-page-content"]')
cy.get('[data-test="enrollment-page-content"]')
.contains('Enrollment Dashboard');
});

And('you see the enrollment page', () => {
cy.url().should('eq', `${Cypress.config().baseUrl}/#/enrollment?programId=IpHINAT79UW&orgUnitId=UgYg0YW7ZIh&teiId=fhFQhO0xILJ&enrollmentId=gPDueU02tn8`);
cy.get('[data-test="dhis2-capture-enrollment-page-content"]')
cy.get('[data-test="enrollment-page-content"]')
.contains('Enrollment Dashboard');
});

Expand All @@ -307,7 +307,7 @@ And('you reset the enrollment selection', () => {

And('you see message explaining you need to select an enrollment', () => {
cy.url().should('eq', `${Cypress.config().baseUrl}/#/enrollment?programId=IpHINAT79UW&orgUnitId=UgYg0YW7ZIh&teiId=fhFQhO0xILJ`);
cy.get('[data-test="dhis2-capture-enrollment-page-content"]')
cy.get('[data-test="enrollment-page-content"]')
.contains('There are multiple enrollments for this program. Choose an enrollment to view the dashboard.');
});

Expand All @@ -319,9 +319,9 @@ And('you select the Child Programme', () => {
});

And('you see message explaining there are no enrollments for this program', () => {
cy.get('[data-test="dhis2-capture-enrollment-page-content"]')
cy.get('[data-test="enrollment-page-content"]')
.contains('Carlos Cruz is not enrolled in this program.');
cy.get('[data-test="dhis2-capture-enrollment-page-content"]')
cy.get('[data-test="enrollment-page-content"]')
.contains('Enroll Carlos Cruz in this program.');
});

Expand All @@ -333,7 +333,7 @@ And('you select the Antenatal care visit', () => {
});

And('you see message explaining this is an Event program', () => {
cy.get('[data-test="dhis2-capture-enrollment-page-content"]')
cy.get('[data-test="enrollment-page-content"]')
.contains('Antenatal care visit is an event program and does not have enrollments.');
});

Expand All @@ -345,9 +345,9 @@ When('you select org unit that is incompatible with the already selected program
});

Then('you can see message on the locked selector', () => {
cy.get('[data-test="dhis2-capture-locked-selector"]')
cy.get('[data-test="locked-selector"]')
.contains('No programs available.');
cy.get('[data-test="dhis2-capture-locked-selector"]')
cy.get('[data-test="locked-selector"]')
.contains('Show all');
});

Loading

0 comments on commit 0b6f8c3

Please sign in to comment.