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-18635] Fix Cypress tests #3912

Merged
merged 3 commits into from
Dec 16, 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 @@ -21,9 +21,9 @@ Feature: User interacts with the Enrollment New Event Workspace
And the user selects Positive
And you click the Save without completing button
Then all events should be displayed
And the newest event in datatable nr 1 should contain Active
And the newest event in datatable nr 1 should contain 13
And the newest event in datatable nr 1 should contain Positive
And the newest event in datatable nr 2 should contain Active
And the newest event in datatable nr 2 should contain 13
And the newest event in datatable nr 2 should contain Positive
And the events in Sputum smear microscopy are deleted

Scenario: Required fields should display an error when saving without data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ Then('all events should be displayed', () => {
});

Then(/^the newest event in datatable nr (.*) should contain (.*)$/, (eq, status) => {
cy.get('[data-test="dhis2-uicore-datatable"]')
cy.get('[data-test="stage-content"]')
.eq(eq)
.within(() => {
cy.get('[data-test="dhis2-uicore-datatablerow"]')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ And the user see the following text: 11
When the user clicks on the cancel button
Then the user is navigated to the enrollment dashboard

@with-restore-event-schedule-date
Scenario: User can update schedule date for a scheduled event
Given you land on the enrollment event page with selected Person by having typed /#/enrollmentEventEdit?eventId=RIrfCcEP8Uu&orgUnitId=DiszpKrYNg8
Then the view enrollment event form is in edit mode
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
import { defineStep as And, Given, Then, When } from '@badeball/cypress-cucumber-preprocessor';
import { defineStep as And, Given, Then, When, Before } from '@badeball/cypress-cucumber-preprocessor';
import { getCurrentYear } from '../../../support/date';

Before({ tags: '@with-restore-event-schedule-date' }, () => {
cy.buildApiUrl('tracker', 'events/RIrfCcEP8Uu')
.then(url => cy.request(url))
.then((apiResponse) => {
const event = apiResponse.body;
const eventToUpdate = { ...event, scheduledAt: `${getCurrentYear() - 15}-01-07` };
return cy
.buildApiUrl('tracker?async=false&importStrategy=UPDATE')
.then(eventUrl => cy.request('POST', eventUrl, { events: [eventToUpdate] }));
});
});

const changeEnrollmentAndEventsStatus = () => (
cy.buildApiUrl(
'tracker',
Expand Down
Loading