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

fix: [DHIS2-15879] Unable to schedule event with note #3421

Merged
merged 4 commits into from
Oct 27, 2023
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 @@ -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
Expand All @@ -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
Original file line number Diff line number Diff line change
@@ -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 = () => {
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @flow
import { useMemo } from 'react';
import { useDataQuery } from '@dhis2/app-runtime';
import uuid from 'd2-utilizr/lib/uuid';
import { generateUID } from '../../../utils/uid/generateUID';

export const useCommentDetails = () => {
const { data, error, loading } = useDataQuery(useMemo(() => ({
Expand All @@ -18,6 +18,6 @@ export const useCommentDetails = () => {
return {
error,
currentUser: !loading && data.currentUser,
noteId: uuid(),
noteId: generateUID(),
};
};
Loading