Skip to content

Commit

Permalink
chore: [DHIS2-17730] flaky scenario in EnrollmentEditEventPageForm.fe…
Browse files Browse the repository at this point in the history
…ature (#3714)
  • Loading branch information
simonadomnisoru authored Jul 22, 2024
1 parent 7d27e4c commit 0c69d59
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,10 @@ Then the user see the following text: Low-dose acetylsalicylic acid given
When the user sets Plurality assessed to Singleton
Then the user don't see the following text: Low-dose acetylsalicylic acid given

# DHIS2-17730
@skip
Scenario: User can modify and save the data in the form
Given you land on the enrollment event page with selected Person by having typed /#/enrollmentEventEdit?orgUnitId=DiszpKrYNg8&eventId=V1CerIi3sdL
Then the user see the following text: Enrollment: View Event
And the user see the following text: 11
And the apgar score is 11
When the user clicks on the edit button
And the user set the apgar score to 5
And the user clicks on the save button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,29 @@ const changeEnrollmentAndEventsStatus = () => (
})
);

And('the apgar score is 11', () => {
cy.buildApiUrl('tracker', 'events/V1CerIi3sdL')
.then(url => cy.request(url))
.then(({ body }) => {
const { dataValues, ...rest } = body;
const dataValuesToUpdate = dataValues.map(dataValue => (
dataValue.dataElement === 'a3kGcGDCuk6' ? { ...dataValue, value: 11 } : dataValue
));
const eventToUpdate = { ...rest, dataValues: dataValuesToUpdate };

return cy
.buildApiUrl('tracker?async=false&importStrategy=UPDATE')
.then(url => cy.request('POST', url, { events: [eventToUpdate] }))
.then(() => {
cy.reload();
cy.get('[data-test="widget-enrollment-event"]')
.find('[data-test="form-field"]')
.contains('11')
.should('exist');
});
});
});

Given(/^you land on the enrollment event page with selected (.*) by having typed (.*)$/, (tet, url) => {
cy.visit(url);
cy.get('[data-test="scope-selector"]').contains(`${tet}`);
Expand Down

0 comments on commit 0c69d59

Please sign in to comment.