Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: [DHIS2-17730] flaky scenario in EnrollmentEditEventPageForm.feature #3714

Merged
merged 1 commit into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading