Skip to content

Commit

Permalink
chore: fix cypress test
Browse files Browse the repository at this point in the history
  • Loading branch information
simonadomnisoru committed Dec 16, 2024
1 parent 5e46787 commit 6782c70
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
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

0 comments on commit 6782c70

Please sign in to comment.