diff --git a/cypress/e2e/EnrollmentAddEventPage/EnrollmentAddEventPageForm.feature b/cypress/e2e/EnrollmentAddEventPage/EnrollmentAddEventPageForm.feature index f1c0da9caf..966cd9083f 100644 --- a/cypress/e2e/EnrollmentAddEventPage/EnrollmentAddEventPageForm.feature +++ b/cypress/e2e/EnrollmentAddEventPage/EnrollmentAddEventPageForm.feature @@ -48,7 +48,7 @@ Feature: User interacts with the Enrollment New Event Workspace Scenario: User should be asked to create new event after completing a stage and choose to cancel Given you open the main page with Ngelehun and Malaria focus investigation context - And you opt in to use the new enrollment Dashboard for Malaria focus investigation + And you opt in to use the new enrollment Dashboard for Malaria focus investigation Then you land on the enrollment new event page by having typed #/enrollmentEventNew?enrollmentId=zRfAPUpjoG3&orgUnitId=DiszpKrYNg8&programId=M3xtLkYBlKI&stageId=CWaAcQYKVpq&teiId=S3JjTA4QMNe Then you see the following Enrollment: New Event And you see the widget header Foci investigation & classification @@ -72,3 +72,9 @@ Feature: User interacts with the Enrollment New Event Workspace When you choose option Yes, create new event in the modal Then you will be navigate to page #/enrollmentEventNew?enrollmentId=zRfAPUpjoG3&orgUnitId=DiszpKrYNg8&programId=M3xtLkYBlKI&teiId=S3JjTA4QMNe + Scenario: User is able to schedule an event with a note + Given you land on the enrollment new event page by having typed /#/enrollmentEventNew?enrollmentId=qcFFRp7DpcX&orgUnitId=DiszpKrYNg8&programId=WSGAb5XwJ3Y&stageId=edqlbukwRfQ&teiId=erqa3phUfpI + And you see the following Enrollment: New Event + And you select the schedule tab + When you add a comment to the event + And the events saves successfully diff --git a/cypress/e2e/EnrollmentAddEventPage/EnrollmentAddEventPageForm/index.js b/cypress/e2e/EnrollmentAddEventPage/EnrollmentAddEventPageForm/index.js index 9791f3f190..d4b2f403a9 100644 --- a/cypress/e2e/EnrollmentAddEventPage/EnrollmentAddEventPageForm/index.js +++ b/cypress/e2e/EnrollmentAddEventPage/EnrollmentAddEventPageForm/index.js @@ -1,4 +1,4 @@ -import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor'; +import { Given, When, Then, defineStep as And } from '@badeball/cypress-cucumber-preprocessor'; import '../sharedSteps'; const showAllEventsInProgramStage = () => { @@ -30,6 +30,32 @@ Given(/^you land on the enrollment new event page by having typed (.*)$/, (url) cy.visit(url); }); +Given('you select the schedule tab', () => { + cy.get('[data-test="new-event-schedule-tab"]') + .click(); +}); + +When('you add a comment to the event', () => { + cy.get('[data-test="comment-textfield"]') + .type('This is a comment') + .blur(); + + cy.get('[data-test="add-comment-btn"]') + .click(); +}); + +And('the events saves successfully', () => { + cy.intercept('POST', '**/tracker?async=false').as('postEvent'); + + cy.get('[data-test="dhis2-uicore-button"]') + .contains('Schedule') + .click(); + + cy.wait('@postEvent') + .its('response.statusCode') + .should('eq', 200); +}); + When(/^you click the create new button number (.*)$/, (eq) => { cy.get('[data-test="create-new-button"]') .eq(eq)