Skip to content

Commit

Permalink
feat: adds missing parts from the chain (#1513)
Browse files Browse the repository at this point in the history
* chore: adds the missing parts

* chore: adds text
  • Loading branch information
paschalidi authored Feb 16, 2021
1 parent 31db119 commit 409b07e
Show file tree
Hide file tree
Showing 27 changed files with 374 additions and 185 deletions.
7 changes: 0 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
# [1.9.0](https://github.com/dhis2/capture-app/compare/v1.8.3...v1.9.0) (2021-02-12)


### Features

* DHIS2-10161 Create enrollment page with routing ([#1387](https://github.com/dhis2/capture-app/issues/1387)) ([efa2828](https://github.com/dhis2/capture-app/commit/efa282893c51cb97c66f6df0c2a6f3b4126da8f1)), closes [#1448](https://github.com/dhis2/capture-app/issues/1448) [#1449](https://github.com/dhis2/capture-app/issues/1449) [#1450](https://github.com/dhis2/capture-app/issues/1450) [#1451](https://github.com/dhis2/capture-app/issues/1451) [#1388](https://github.com/dhis2/capture-app/issues/1388) [#1495](https://github.com/dhis2/capture-app/issues/1495) [#1497](https://github.com/dhis2/capture-app/issues/1497)

## [1.8.3](https://github.com/dhis2/capture-app/compare/v1.8.2...v1.8.3) (2021-02-08)


Expand Down
30 changes: 13 additions & 17 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 1
#### Yarn

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


### Installing

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

#### 1. Clone the repository

Expand All @@ -50,31 +50,27 @@ 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)

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

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:
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.

An example of `.env.development`:
```
yarn start
# 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"
```

`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.
#### 4. Run the application

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:
To start the application locally and interact with it on the browser, run:

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


## Built With

This project was bootstrapped with [Create React App](https://github.com/facebookincubator/create-react-app).
Expand Down
29 changes: 29 additions & 0 deletions cypress/integration/EnrollmentPage.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Feature: User interacts with Search page

Scenario: Navigating to the registration page for new event by clicking the link button
Given you are on an enrollment page
And you reset the program selection
And you select the Inpatient morbidity program
When you choose to register a new event program by clicking the link button
Then you see the registration form for the Inpatient morbidity program

Scenario: Navigating to the working lists page for new event by clicking the link button
Given you are on an enrollment page
And you reset the program selection
And you select the Inpatient morbidity program
When you choose to be navigated to the working list by clicking the link button
Then you see the working lists for the Inpatient morbidity program

Scenario: Navigating to the enrollment page for the same tet by clicking the link button
Given you are on an enrollment page
And you reset the program selection
When you select the MNCH PNC program
When you choose to enroll a person by clicking the link button
Then you see the registration form for the MNCH PNC program

Scenario: Navigating to the enrollment page for a different tet by clicking the link button
Given you are on an enrollment page
And you reset the program selection
When you select the Malaria case diagnosis program
When you choose to enroll a malaria entity by clicking the link button
Then you see the registration form for the Malaria case diagnosis
92 changes: 92 additions & 0 deletions cypress/integration/EnrollmentPage/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
beforeEach(() => {
cy.loginThroughForm();
});

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"]')
.contains('Enrollment Dashboard');
});

And('you reset the program selection', () => {
cy.get('[data-test="reset-selection-button"]')
.should('have.length.greaterThan', 2);
cy.get('[data-test="reset-selection-button"]')
.eq(0)
.click();
});

And('you select the Inpatient morbidity program', () => {
cy.get('.Select').eq(0)
.type('Inpatient morbidi');
cy.contains('Inpatient morbidity and mortality')
.click();
});

And('you see the registration form for the Inpatient morbidity program', () => {
cy.get('[data-test="dhis2-capture-registration-page-content"]')
.contains('New Inpatient morbidity and mortality')
.should('exist');
cy.get('[data-test="dhis2-capture-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"]')
.contains('New malaria entity in program: Malaria case diagnosis, treatment and investigation')
.should('exist');
cy.get('[data-test="dhis2-capture-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"]')
.contains('New person in program: MNCH / PNC (Adult Woman)')
.should('exist');
cy.get('[data-test="dhis2-capture-registration-page-content"]')
.contains('Saving a person in MNCH / PNC (Adult Woman) in Taninahun (Malen) CHP.')
.should('exist');
});

And('you see the working lists for the Inpatient morbidity program', () => {
cy.get('[data-test="event-working-lists"]')
.find('tbody')
.find('tr')
.should('have.length', 15);
});

And('you select the Malaria case diagnosis program', () => {
cy.get('.Select').eq(0)
.type('Malaria case diag');
cy.contains('Malaria case diagnosis')
.click();
});

And('you select the MNCH PNC program', () => {
cy.get('.Select').eq(0)
.type('MNCH');
cy.contains('PNC (Adult Woman)')
.click();
});

And('you choose to register a new event program by clicking the link button', () => {
cy.contains('Create a new event in this program.')
.click();
});

And('you choose to be navigated to the working list by clicking the link button', () => {
cy.contains('View working list in this program.')
.click();
});

And('you choose to enroll a malaria entity by clicking the link button', () => {
cy.contains('Enroll a new malaria entity in this program.')
.click();
});

And('you choose to enroll a person by clicking the link button', () => {
cy.contains('Enroll Carlos Cruz in this program.')
.click();
});
24 changes: 13 additions & 11 deletions cypress/integration/LockedSelector.feature
Original file line number Diff line number Diff line change
Expand Up @@ -137,17 +137,19 @@ Feature: Use the LockedSelector to navigate
And you see the following <message>

Examples:
| url | state | message |
| /#/enrollment?programId=IpHINAT79UW&orgUnitId=UgYg0YW7ZIh&teiId=fhFQhO0xILJ&enrollmentId=gPDueU02tn8 | all | Enrollment Dashboard |
| /#/enrollment?enrollmentId=gPDueU02tn8 | all | Enrollment Dashboard |
| /#/enrollment?programId=IpHINAT79UW&enrollmentId=gPDueU02tn8 | all | Enrollment Dashboard |
| /#/enrollment?orgUnitId=UgYg0YW7ZIh&enrollmentId=gPDueU02tn8 | all | Enrollment Dashboard |
| /#/enrollment?orgUnitId=UgYg0YW7ZIh&teiId=fhFQhO0xILJ | teiAndOrgUnit | Choose program to view more information. |
| /#/enrollment?programId=IpHINAT79UW&teiId=fhFQhO0xILJ | teiAndChildProgram | Choose enrollment to view more information. |
| /#/enrollment?programId=qDkgAbB5Jlk&teiId=fhFQhO0xILJ | teiAndMalariaProgram | There are no enrollments |
| /#/enrollment?programId=lxAQ7Zs9VYR&teiId=fhFQhO0xILJ | teiAndEventProgram | You selected an Event program. |
| /#/enrollment?programId=IpHINAT79UW | error | Please enter a valid url. |
| /#/enrollment?orgUnitId=UgYg0YW7ZIh | error | Please enter a valid url. |
| url | state | message |
| /#/enrollment?enrollmentId=gPDueU02tn8 | all | Enrollment Dashboard |
| /#/enrollment?teiId=fhFQhO0xILJ&enrollmentId=gPDueU02tn8 | all | Enrollment Dashboard |
| /#/enrollment?orgUnitId=UgYg0YW7ZIh&enrollmentId=gPDueU02tn8 | all | Enrollment Dashboard |
| /#/enrollment?orgUnitId=UgYg0YW7ZIh&teiId=fhFQhO0xILJ&enrollmentId=gPDueU02tn8 | all | Enrollment Dashboard |
| /#/enrollment?programId=IpHINAT79UW&enrollmentId=gPDueU02tn8 | all | Enrollment Dashboard |
| /#/enrollment?programId=IpHINAT79UW&teiId=fhFQhO0xILJ&enrollmentId=gPDueU02tn8 | all | Enrollment Dashboard |
| /#/enrollment?programId=IpHINAT79UW&orgUnitId=UgYg0YW7ZIh&enrollmentId=gPDueU02tn8 | all | Enrollment Dashboard |
| /#/enrollment?programId=IpHINAT79UW&orgUnitId=UgYg0YW7ZIh&teiId=fhFQhO0xILJ&enrollmentId=gPDueU02tn8 | all | Enrollment Dashboard |
| /#/enrollment?orgUnitId=UgYg0YW7ZIh&teiId=fhFQhO0xILJ | teiAndOrgUnit | Carlos Cruz is enrolled in multiple programs. Choose a program. |
| /#/enrollment?programId=IpHINAT79UW&teiId=fhFQhO0xILJ | teiAndChildProgram | There are multiple enrollments for this program. Choose an enrollment to view the dashboard. |
| /#/enrollment?programId=qDkgAbB5Jlk&teiId=fhFQhO0xILJ | teiAndMalariaProgram | Carlos Cruz is a person and cannot be enrolled in the Malaria case diagnosis, treatment and investigation. Choose another program that allows person enrollment. Enroll a new malaria entity in this program.|
| /#/enrollment?programId=lxAQ7Zs9VYR&teiId=fhFQhO0xILJ | teiAndEventProgram | Antenatal care visit is an event program and does not have enrollments. |

Scenario: Enrollment page > resetting the tei
Given you land on the enrollment page by having typed only the enrollmentId on the url
Expand Down
20 changes: 12 additions & 8 deletions cypress/integration/LockedSelector/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,14 +257,14 @@ And('there should be Child Programme domain forms visible to search with', () =>
.should('have.length', 1);
});

const selectedChildProgram = ['Selected Program', 'Child Programme'];
const selectedMalariaProgram = ['Selected Program', 'Malaria case diagnosis'];
const selectedEventProgram = ['Selected Program', 'Antenatal care visit'];
const selectedChildProgram = ['Selected program', 'Child Programme'];
const selectedMalariaProgram = ['Selected program', 'Malaria case diagnosis'];
const selectedEventProgram = ['Selected program', 'Antenatal care visit'];
const emptyProgramSelection = ['Program', 'Select program'];
const selectedOrgUnit = ['Selected registering unit', 'Taninahun (Malen) CHP'];
const emptyOrgUnitSelection = ['Registering Organisation Unit'];
const selectedTei = ['Selected', 'Carlos Cruz'];
const selectedEnrollment = ['Selected Enrollment', '2018-08-07 15:47'];
const selectedEnrollment = ['Selected enrollment', '2018-08-07 15:47'];
const emptyEnrollmentSelection = ['Enrollment', 'Select...'];

const lockedSelectorCases = {
Expand All @@ -290,6 +290,8 @@ 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"]')
.contains('Enrollment Dashboard');
});

And('you reset the tei selection', () => {
Expand All @@ -315,7 +317,7 @@ And('you reset the program selection', () => {
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"]')
.contains('Choose program to view more information.');
.contains('Carlos Cruz is enrolled in multiple programs. Choose a program.');
});

And('you reset the org unit selection', () => {
Expand Down Expand Up @@ -350,7 +352,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"]')
.contains('Choose enrollment to view more information.');
.contains('There are multiple enrollments for this program. Choose an enrollment to view the dashboard.');
});

And('you select the MNCH PNC program', () => {
Expand All @@ -369,7 +371,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"]')
.contains('There are no enrollments');
.contains('Carlos Cruz is not enrolled in this program.');
cy.get('[data-test="dhis2-capture-enrollment-page-content"]')
.contains('Enroll Carlos Cruz in this program.');
});

And('you select the Antenatal care visit', () => {
Expand All @@ -381,6 +385,6 @@ 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"]')
.contains('You selected an Event program.');
.contains('Antenatal care visit is an event program and does not have enrollments.');
});

5 changes: 1 addition & 4 deletions cypress/integration/NewPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ And('you select tracked entity type person', () => {

And('you see the registration form for the Person', () => {
cy.get('[data-test="dhis2-capture-registration-page-content"]')
.contains('New Person')
.should('exist');
cy.get('[data-test="dhis2-capture-registration-page-content"]')
.contains('New Person')
.contains('New person')
.should('exist');
cy.get('[data-test="dhis2-capture-registration-page-content"]')
.contains('Profile')
Expand Down
4 changes: 2 additions & 2 deletions cypress/support/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ Cypress.Commands.add('loginThroughForm', () => {
cy.get('form').submit();
});

cy.get('[data-test="loading-indicator-for-page"]', { timeout: 60000 })
.should('not.exist');
cy.get('[data-test="dhis2-capture-locked-selector"]', { timeout: 60000 })
.should('exist');
});
39 changes: 25 additions & 14 deletions 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: 2021-02-12T12:19:06.824Z\n"
"PO-Revision-Date: 2021-02-12T12:19:06.824Z\n"
"POT-Creation-Date: 2021-02-16T11:21:42.194Z\n"
"PO-Revision-Date: 2021-02-16T11:21:42.194Z\n"

msgid "Choose one or more dates..."
msgstr ""
Expand Down Expand Up @@ -531,7 +531,7 @@ msgstr ""
msgid "Show all"
msgstr ""

msgid "Selected Program"
msgid "Selected program"
msgstr ""

msgid "Some programs are being filtered."
Expand Down Expand Up @@ -582,27 +582,41 @@ msgstr ""
msgid "There is an error while opening this enrollment. Please enter a valid url."
msgstr ""

msgid "Enrollment with id '{{selectedEnrollmentId}}' doesn't exist"
msgid "Enrollment with id \"{{enrollmentId}}\" does not exist"
msgstr ""

msgid "{{teiDisplayName}} is enrolled in multiple programs. Choose a program."
msgstr ""

msgid "Choose program to view more information."
msgid "{{programName}} has categories. Choose all categories to view dashboard."
msgstr ""

msgid "Choose enrollment to view more information."
msgid ""
"There are multiple enrollments for this program. Choose an enrollment to "
"view the dashboard."
msgstr ""

msgid "There are no enrollments for {{teiDisplayName}} in the selected program"
msgid "{{teiDisplayName}} is not enrolled in this program."
msgstr ""

msgid "Enroll {{teiDisplayName}} in this program."
msgstr ""

msgid ""
"You selected an Event program. Event programs do not have tracked entities "
"nor enrollments."
"{{teiDisplayName}} is a {{tetName}} and cannot be enrolled in the "
"{{programName}}. Choose another program that allows {{tetName}} enrollment. "
msgstr ""

msgid "To create a new event"
msgid "Enroll a new {{selectedTetName}} in this program."
msgstr ""

msgid "To view the working lists click"
msgid "{{programName}} is an event program and does not have enrollments."
msgstr ""

msgid "Create a new event in this program."
msgstr ""

msgid "View working list in this program."
msgstr ""

msgid "Delete event"
Expand Down Expand Up @@ -840,9 +854,6 @@ msgstr ""
msgid "Results found"
msgstr ""

msgid "Selected program"
msgstr ""

msgid "Search {{uniqueAttrName}}"
msgstr ""

Expand Down
Loading

0 comments on commit 409b07e

Please sign in to comment.