-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into eh/feat/DHIS2-15475…
…_SwitchToPluginComponent
- Loading branch information
Showing
139 changed files
with
4,015 additions
and
2,676 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
cypress/integration/EnrollmentPage/HiddenProgramStage.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Feature: Hidden program stage | ||
|
||
Scenario: The user cannot add an event in a hidden program stage | ||
Given you add an enrollment event that will result in a rule effect to hide a program stage | ||
Then the New Postpartum care visit event button is disabled in the stages and events widget | ||
And and an error is show in the Postpartum care visit stage | ||
And the Postpartum care visit button is disabled in the enrollmentEventNew page |
66 changes: 66 additions & 0 deletions
66
cypress/integration/EnrollmentPage/HiddenProgramStage/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import moment from 'moment'; | ||
|
||
const cleanUpIfApplicable = () => { | ||
cy.buildApiUrl( | ||
'tracker', | ||
'trackedEntities/uW8Y7AIcRKA?program=WSGAb5XwJ3Y&fields=enrollments', | ||
) | ||
.then(url => cy.request(url)) | ||
.then(({ body }) => { | ||
const enrollment = body.enrollments?.find(e => e.enrollment === 'fmhIsWXVDmS'); | ||
const event = enrollment?.events?.find(e => e.programStage === 'PFDfvmGpsR3'); | ||
if (!event) { | ||
return null; | ||
} | ||
return cy | ||
.buildApiUrl('events', event.event) | ||
.then(eventUrl => | ||
cy.request('DELETE', eventUrl)); | ||
}); | ||
}; | ||
|
||
Given('you add an enrollment event that will result in a rule effect to hide a program stage', () => { | ||
cleanUpIfApplicable(); | ||
cy.visit( | ||
'/#/enrollmentEventNew?enrollmentId=fmhIsWXVDmS&orgUnitId=s7SLtx8wmRA&programId=WSGAb5XwJ3Y&stageId=PFDfvmGpsR3&teiId=uW8Y7AIcRKA', | ||
); | ||
|
||
cy.get('[data-test="capture-ui-input"]') | ||
.eq(0) | ||
.type(moment().format('YYYY-MM-DD')) | ||
.blur(); | ||
|
||
cy | ||
.get('[data-test="virtualized-select"]') | ||
.eq(6) | ||
.click() | ||
.contains('Termination of pregnancy') | ||
.click(); | ||
|
||
cy.contains('[data-test="dhis2-uicore-button"]', 'Save without completing').click(); | ||
}); | ||
|
||
Then('the New Postpartum care visit event button is disabled in the stages and events widget', () => { | ||
cy.contains('[data-test="create-new-button"]', 'New Postpartum care visit event') | ||
.should('be.disabled'); | ||
}); | ||
|
||
Then('and an error is show in the Postpartum care visit stage', () => { | ||
cy.visit( | ||
'/#/enrollmentEventNew?enrollmentId=fmhIsWXVDmS&orgUnitId=s7SLtx8wmRA&programId=WSGAb5XwJ3Y&teiId=uW8Y7AIcRKA&stageId=bbKtnxRZKEP', | ||
); | ||
cy.contains('[data-test="dhis2-uicore-button"]', 'Complete') | ||
.should('be.disabled'); | ||
cy.contains('[data-test="dhis2-uicore-button"]', 'Save without completing') | ||
.should('be.disabled'); | ||
cy.contains('[data-test="dhis2-uicore-noticebox-content"]', 'You can\'t add any more Postpartum care visit events') | ||
.should('exist'); | ||
}); | ||
|
||
Then('the Postpartum care visit button is disabled in the enrollmentEventNew page', () => { | ||
cy.visit( | ||
'/#/enrollmentEventNew?enrollmentId=fmhIsWXVDmS&orgUnitId=s7SLtx8wmRA&programId=WSGAb5XwJ3Y&teiId=uW8Y7AIcRKA', | ||
); | ||
|
||
cy.contains('[data-test="program-stage-selector-button"]', 'Postpartum care visit').should('be.disabled'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.