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

feat: [DHIS2-15462] Use dhis2 UI calendarinput component in forms #3658

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
b391af7
feat: use calendarInput component in forms
alaa-yahia May 27, 2024
aabaf48
fix: add disabled to calendar input
alaa-yahia May 29, 2024
04a48ed
fix: remove ref
alaa-yahia May 30, 2024
e56314c
fix: flow errors
alaa-yahia May 30, 2024
ec8c228
chore: update tests
alaa-yahia Aug 12, 2024
fe90a58
fix: failing tests
alaa-yahia Aug 12, 2024
68c208a
fix: failing tests
alaa-yahia Aug 12, 2024
350121b
fix: failing tests
alaa-yahia Aug 12, 2024
4edac97
fix: failing tests
alaa-yahia Aug 12, 2024
d6b2084
chore: remove unnecessary props
alaa-yahia Aug 15, 2024
727af38
fix: linter errors
alaa-yahia Aug 15, 2024
e729996
feat: add error messages
alaa-yahia Oct 10, 2024
807d2aa
fix: date and datetime errors
alaa-yahia Oct 14, 2024
927607f
Revert "feat: add error messages"
alaa-yahia Oct 14, 2024
f327235
feat: add errors
alaa-yahia Oct 15, 2024
4fca846
Merge branch 'master' into DHIS2-15462-use-dhis2-ui-calendarinput-com…
alaa-yahia Oct 18, 2024
9f844a4
fix: date internal errors
alaa-yahia Oct 18, 2024
c07e301
feat: add errors to main field
alaa-yahia Oct 21, 2024
6ef80ac
feat: add validation to dateTime & age fields
alaa-yahia Oct 28, 2024
1bd6fca
fix: flow errors
alaa-yahia Nov 3, 2024
df39b5d
Merge branch 'master' into DHIS2-15462-use-dhis2-ui-calendarinput-com…
alaa-yahia Nov 3, 2024
0307326
Merge remote-tracking branch 'origin/master' into DHIS2-15462-use-dhi…
alaa-yahia Nov 3, 2024
ab8297b
feat: scheduleDate reset when there is invalid date
alaa-yahia Nov 4, 2024
9745ce7
fix: width & calendarWidth to be string
alaa-yahia Nov 4, 2024
4871302
fix: schedule date in related stages to display calendarInput interna…
alaa-yahia Nov 4, 2024
48bf0eb
fix: remove current context from function
alaa-yahia Nov 7, 2024
2a5cd1e
fix: enrollement date input fields
alaa-yahia Nov 11, 2024
7fff18d
fix: refactor incident date validation to use form validations
alaa-yahia Nov 18, 2024
ab569c3
feat: eventDate validation to use internal error from calendarInput
alaa-yahia Nov 18, 2024
bdf947a
fix: flow errors
alaa-yahia Nov 18, 2024
059bc8b
Merge remote-tracking branch 'origin/master' into DHIS2-15462-use-dhi…
alaa-yahia Nov 18, 2024
e3614c3
fix: pass validationContext for unique validator
alaa-yahia Nov 20, 2024
d039205
Merge remote-tracking branch 'origin/master' into DHIS2-15462-use-dhi…
alaa-yahia Nov 20, 2024
2d09a3e
fix: always pass current context
alaa-yahia Nov 21, 2024
a06618f
chore: update calendarInput ui version
alaa-yahia Nov 25, 2024
fb6f0cf
Merge remote-tracking branch 'origin/master' into DHIS2-15462-use-dhi…
alaa-yahia Nov 25, 2024
c5c9de7
Merge branch 'master' into DHIS2-15462-use-dhis2-ui-calendarinput-com…
alaa-yahia Nov 25, 2024
f47f123
fix: update rules engine version
alaa-yahia Nov 25, 2024
ecde8c9
chore: update lock file
alaa-yahia Nov 25, 2024
2fe76aa
fix: error when date is null result in runtime error
alaa-yahia Nov 26, 2024
e2eef67
fix: flow types missing
alaa-yahia Nov 26, 2024
3f644f0
fix: failing tests
alaa-yahia Nov 29, 2024
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 @@ -89,7 +89,7 @@ When(/^you click the create new button number (.*)$/, (eq) => {
});

When(/^you type (.*) in the input number (.*)$/, (value, eq) => {
cy.get('[data-test="capture-ui-input"]')
cy.get('input[type="text"]')
.eq(eq)
.type(value)
.blur();
Expand Down Expand Up @@ -155,7 +155,7 @@ When(/^the user selects (.*)$/, (value) => {
});

When(/^you focus and blur a required field/, () => {
cy.get('[data-test="capture-ui-input"]')
cy.get('input[type="text"]')
.eq(1)
.focus()
.blur();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ When(/^the user clicks on the cancel button/, () =>
When(/^the user set the apgar score to (.*)/, score =>
cy
.get('[data-test="widget-enrollment-event"]')
.find('[data-test="capture-ui-input"]')
.find('input[type="text"]')
.eq(2)
.clear()
.type(score)
Expand Down Expand Up @@ -118,8 +118,8 @@ When('the user clicks switch tab to Schedule', () => {

Then('the user selects another schedule date', () => {
cy.get('[data-test="schedule-section"]').within(() => {
cy.get("[data-test='capture-ui-input']").eq(0).should('have.value', `${getCurrentYear() - 15}-01-07`);
cy.get("[data-test='capture-ui-input']").eq(0)
cy.get('input[type="text"]').eq(0).should('have.value', `${getCurrentYear() - 15}-01-07`);
cy.get('input[type="text"]').eq(0)
.clear()
.type(`${getCurrentYear()}-08-01`)
.blur();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@ Given('the tei created by this test is cleared from the database', () => {

And('you create a new tei in Child programme from Ngelehun CHC', () => {
cy.visit('/#/new?orgUnitId=DiszpKrYNg8&programId=IpHINAT79UW');
cy.get('[data-test="capture-ui-input"]')
cy.get('input[type="text"]')
.eq(1)
.type('1999-09-01')
.blur();
cy.get('[data-test="d2-section"]')
.find('[data-test="capture-ui-input"]')
.find('input[type="text"]')
.eq(0)
.type('Breaking')
.blur();
cy.get('[data-test="d2-section"]')
.find('[data-test="capture-ui-input"]')
.find('input[type="text"]')
.eq(1)
.type('TheGlass')
.blur();
cy.get('[data-test="capture-ui-input"]')
cy.get('input[type="text"]')
.eq(7)
.type('2023-09-01')
.blur();
Expand Down Expand Up @@ -68,7 +68,7 @@ And('you enroll the tei from Njandama MCHP', () => {
.click();

cy.get('[data-test="d2-section"]')
.find('[data-test="capture-ui-input"]')
.find('input[type="text"]')
.eq(8)
.type('1999-09-01')
.blur();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Given('you add an enrollment event that will result in a rule effect to hide a p
'/#/enrollmentEventNew?enrollmentId=fmhIsWXVDmS&orgUnitId=s7SLtx8wmRA&programId=WSGAb5XwJ3Y&stageId=PFDfvmGpsR3&teiId=uW8Y7AIcRKA',
);

cy.get('[data-test="capture-ui-input"]')
cy.get('input[type="text"]')
.eq(0)
.type(moment().format('YYYY-MM-DD'))
.blur();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ After({ tags: '@with-restore-deleted-event' }, () => {
.find('[data-test="create-new-button"]')
.click();

cy.get('[data-test="capture-ui-input"]')
cy.get('input[type="text"]')
.first()
.type('2023-01-26')
.blur();
Expand Down
58 changes: 29 additions & 29 deletions cypress/e2e/NewPage/NewPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ Then('you see validation error on visit date', () => {
});

And('you fill in 200 in the hemoglobin', () => {
cy.get('[data-test="capture-ui-input"]')
cy.get('input[type="text"]')
.eq(1)
.type('200');
});
Expand All @@ -340,13 +340,13 @@ And('you see validation error on hemoglobin', () => {
});

And('you fill in the visit date', () => {
cy.get('[data-test="capture-ui-input"]')
cy.get('input[type="text"]')
.eq(0)
.type(`${getCurrentYear()}-01-01`);
.type(`${getCurrentYear()}-01-01`).blur();
});

And('you fill in the hemoglobin', () => {
cy.get('[data-test="capture-ui-input"]')
cy.get('input[type="text"]')
.eq(1)
.type('50');
});
Expand Down Expand Up @@ -389,14 +389,14 @@ And('you are in the Person registration page', () => {
});

And('you fill in the first name with value that has duplicates', () => {
cy.get('[data-test="capture-ui-input"]')
cy.get('input[type="text"]')
.eq(1)
.type('Sarah')
.blur();
});

And('you fill in a unique first name', () => {
cy.get('[data-test="capture-ui-input"]')
cy.get('input[type="text"]')
.eq(1)
.type(`Sarah-${Math.round((new Date()).getTime() / 1000)}`)
.blur();
Expand Down Expand Up @@ -427,7 +427,7 @@ Then('you submit the form again from the duplicates modal', () => {
// New person in WHO RMNCH Tracker
And('you are in the WHO RMNCH program registration page', () => {
cy.visit('/#/new?programId=WSGAb5XwJ3Y&orgUnitId=DiszpKrYNg8');
cy.get('[data-test="capture-ui-input"]')
cy.get('input[type="text"]')
.eq(1)
.invoke('val').should('not.be.empty');
});
Expand All @@ -441,7 +441,7 @@ And('you are in Child programme and Buma MCHP organization unit registration pag
});

And('you fill the form with age 0', () => {
cy.get('[data-test="capture-ui-input"]')
cy.get('input[type="text"]')
.eq(9)
.type(moment().format('YYYY-MM-DD'))
.blur();
Expand All @@ -454,56 +454,56 @@ And('you see validation warning on birth date', () => {
});

And('you fill the WHO RMNCH program registration form with its required unique values', () => {
cy.get('[data-test="capture-ui-input"]')
cy.get('input[type="text"]')
.eq(2)
.type(`Sarah-${Math.round((new Date()).getTime() / 1000)}`);

cy.get('[data-test="capture-ui-input"]')
cy.get('input[type="text"]')
.eq(3)
.type('Gonzales');

cy.get('[data-test="capture-ui-input"]')
cy.get('input[type="text"]')
.eq(9)
.type('1992-01-01')
.blur();
});

And('you fill the WHO RMNCH program registration form with its required values', () => {
cy.get('[data-test="capture-ui-input"]')
cy.get('input[type="text"]')
.eq(3)
.type('Didriksson');

cy.get('[data-test="capture-ui-input"]')
cy.get('input[type="text"]')
.eq(2)
.type('Ava');

cy.get('[data-test="capture-ui-input"]')
cy.get('input[type="text"]')
.eq(9)
.type('1985-10-01')
.blur();
});

And('you fill in child programme first name with value that has duplicates', () => {
cy.get('[data-test="capture-ui-input"]')
cy.get('input[type="text"]')
.eq(4)
.type('Sarah')
.blur();
});


And('you fill the Child programme registration form with a first name with value that has duplicates', () => {
cy.get('[data-test="capture-ui-input"]')
cy.get('input[type="text"]')
.eq(1)
.type('2021-01-01')
.blur();
cy.get('[data-test="capture-ui-input"]')
cy.get('input[type="text"]')
.eq(4)
.type('Sarah')
.blur();
});

And('you fill in the birth report date', () => {
cy.get('[data-test="capture-ui-input"]')
cy.get('input[type="text"]')
.eq(7)
.type('2023-01-01')
.blur();
Expand All @@ -530,9 +530,9 @@ And('you see the form prefield with existing TEI attributes values', () => {
cy.get('[data-test="registration-page-content"]').within(() => {
cy.contains('New Enrollment in program: Child Programme').should('exist');
cy.contains('First name').should('exist');
cy.get('[data-test="capture-ui-input"]').eq(4).should('have.value', 'Anna');
cy.get('input[type="text"]').eq(4).should('have.value', 'Anna');
cy.contains('Last name').should('exist');
cy.get('[data-test="capture-ui-input"]').eq(5).should('have.value', 'Jones');
cy.get('input[type="text"]').eq(5).should('have.value', 'Jones');
cy.contains('Gender').should('exist');
cy.contains('Female').should('exist');
});
Expand All @@ -554,15 +554,15 @@ Given('you open the main page with Ngelehun and Malaria case diagnosis, treatmen
});

And('you fill the Malaria case diagnosis registration form with values', () => {
cy.get('[data-test="capture-ui-input"]')
cy.get('input[type="text"]')
.eq(3)
.type(`Ana-${Math.round((new Date()).getTime() / 1000)}`)
.blur();
cy.get('[data-test="capture-ui-input"]')
cy.get('input[type="text"]')
.eq(4)
.type(`Maria-${Math.round((new Date()).getTime() / 1000)}`)
.blur();
cy.get('[data-test="capture-ui-input"]')
cy.get('input[type="text"]')
.eq(5)
.type(moment().add(-1, 'day').format('YYYY-MM-DD'))
.blur();
Expand Down Expand Up @@ -602,26 +602,26 @@ Then('the first stage appears on registration page', () => {
});

And('you fill the Child Program program registration form with unique values', () => {
cy.get('[data-test="capture-ui-input"]')
cy.get('input[type="text"]')
.eq(1)
.type('2021-01-01')
.blur();
cy.get('[data-test="capture-ui-input"]')
cy.get('input[type="text"]')
.eq(2)
.type(20);
cy.get('[data-test="capture-ui-input"]')
cy.get('input[type="text"]')
.eq(3)
.type(30)
.blur();
cy.get('[data-test="capture-ui-input"]')
cy.get('input[type="text"]')
.eq(4)
.type(`Sarah-${Math.round((new Date()).getTime() / 1000)}`)
.blur();
cy.get('[data-test="capture-ui-input"]')
cy.get('input[type="text"]')
.eq(5)
.type(`Beth-${Math.round((new Date()).getTime() / 1000)}`)
.blur();
cy.get('[data-test="capture-ui-input"]')
cy.get('input[type="text"]')
.eq(7)
.type('2021-01-01')
.blur();
Expand Down
6 changes: 3 additions & 3 deletions cypress/e2e/ScopeSelector/ScopeSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Given('you are in the main page with program preselected', () => {
Given('you select both org unit and program Malaria case registration', () => {
cy.get('[data-test="org-unit-selector-container"]')
.click();
cy.get('[data-test="capture-ui-input"]')
cy.get('input[type="text"]')
.type('Ngelehun C');
cy.contains('Ngelehun CHC')
.click();
Expand All @@ -67,7 +67,7 @@ Given('you select both org unit and program Malaria case registration', () => {
Given('you select both org unit and program Child Programme', () => {
cy.get('[data-test="org-unit-selector-container"]')
.click();
cy.get('[data-test="capture-ui-input"]')
cy.get('input[type="text"]')
.type('Ngelehun C');
cy.contains('Ngelehun CHC')
.click();
Expand Down Expand Up @@ -359,7 +359,7 @@ And('you see message explaining this is an Event program', () => {
When('you select org unit that is incompatible with the already selected program', () => {
cy.get('[data-test="org-unit-selector-container"]')
.click();
cy.get('[data-test="capture-ui-input"]')
cy.get('input[type="text"]')
.type('Biriw');
cy.contains('Biriwa')
.click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { When, defineStep as And } from '@badeball/cypress-cucumber-preprocessor

And('you fill in the first name with values that have duplicates', () => {
cy.get('[data-test="d2-section"]')
.find('[data-test="capture-ui-input"]')
.find('input[type="text"]')
.eq(1)
.wait(500)
.type('Tesmi')
Expand All @@ -11,26 +11,26 @@ And('you fill in the first name with values that have duplicates', () => {

And('you fill in the first name with values that have less than 5 duplicates', () => {
cy.get('[data-test="d2-section"]')
.find('[data-test="capture-ui-input"]')
.find('input[type="text"]')
.eq(1)
.type('Sarah')
.blur();
cy.get('[data-test="d2-section"]')
.find('[data-test="capture-ui-input"]')
.find('input[type="text"]')
.eq(2)
.type('Fis')
.blur();
});

And('you fill in the first name with values that have exactly 5 duplicates', () => {
cy.get('[data-test="d2-section"]')
.find('[data-test="capture-ui-input"]')
.find('input[type="text"]')
.eq(1)
.wait(500)
.type('Tesmi')
.blur();
cy.get('[data-test="d2-section"]')
.find('[data-test="capture-ui-input"]')
.find('input[type="text"]')
.eq(2)
.type('Abel')
.blur();
Expand Down
Loading
Loading