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-15187][DHIS2-15190] Working list bulk actions #3773

Merged
merged 42 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from 41 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
d5c8848
feat: add more actions & generic components
eirikhaugstulen Aug 22, 2024
1344fb4
Merge remote-tracking branch 'refs/remotes/origin/master' into eh/fea…
eirikhaugstulen Aug 26, 2024
40bf195
feat: add delete enrollments in program
eirikhaugstulen Aug 26, 2024
2f5472f
feat: add delete enrollments in program
eirikhaugstulen Aug 26, 2024
9de9a83
Merge remote-tracking branch 'origin/eh/feat/DHIS2-15187-working-list…
eirikhaugstulen Aug 26, 2024
82b1d22
feat: split delete enrollment actions
eirikhaugstulen Aug 28, 2024
ff6115a
feat: enable tei bulk deletion
eirikhaugstulen Aug 28, 2024
421339c
feat: design changes
eirikhaugstulen Sep 6, 2024
6881c19
Merge remote-tracking branch 'origin/master' into eh/feat/DHIS2-15187…
eirikhaugstulen Sep 22, 2024
99d9a15
chore: temp
eirikhaugstulen Sep 26, 2024
c993989
chore: temp
eirikhaugstulen Sep 30, 2024
0e88993
feat: add remaining functionality
eirikhaugstulen Oct 8, 2024
4053141
Merge remote-tracking branch 'origin/master' into eh/feat/DHIS2-15187…
eirikhaugstulen Oct 8, 2024
d1c9e4d
chore: lint
eirikhaugstulen Oct 8, 2024
c84f0f4
fix: add more specific error message
eirikhaugstulen Oct 9, 2024
f004ea8
chore: add tests for event working lists
eirikhaugstulen Oct 10, 2024
744eeb2
Merge remote-tracking branch 'refs/remotes/origin/master' into eh/fea…
eirikhaugstulen Oct 10, 2024
c50ae93
chore: add tests for tracked entity bulk operations
eirikhaugstulen Oct 13, 2024
ad9f235
chore: remove added data from NewPage.feature
eirikhaugstulen Oct 13, 2024
0dd17f8
chore: feature toggle changes in the api
eirikhaugstulen Oct 13, 2024
a9a188b
Merge remote-tracking branch 'refs/remotes/origin/master' into eh/fea…
eirikhaugstulen Oct 13, 2024
d0ab769
fix: remove delete tei action
eirikhaugstulen Oct 13, 2024
bfdd7ea
chore: pr-review
eirikhaugstulen Oct 22, 2024
e9f0a19
Merge remote-tracking branch 'origin/master' into eh/feat/DHIS2-15187…
eirikhaugstulen Oct 22, 2024
dac95d2
chore: styles
eirikhaugstulen Oct 22, 2024
9d2dcf4
fix: reset complete enrollment state
eirikhaugstulen Oct 22, 2024
41509c9
fix: review
eirikhaugstulen Oct 22, 2024
1dd386c
fix: flaky tests
eirikhaugstulen Oct 23, 2024
e07d24e
fix: replace get with wait
eirikhaugstulen Oct 23, 2024
a434ddc
fix: flaky tests
eirikhaugstulen Oct 23, 2024
a2f1095
fix: flaky tests
eirikhaugstulen Oct 24, 2024
f7f60f2
fix: flaky tests
eirikhaugstulen Oct 24, 2024
55de86d
fix: flaky tests
eirikhaugstulen Oct 24, 2024
9aca12d
fix: flaky tests
eirikhaugstulen Oct 24, 2024
690cc16
fix: tests
eirikhaugstulen Oct 24, 2024
295b866
fix: remove dataValues
eirikhaugstulen Oct 27, 2024
611fbb1
fix: pr-review
eirikhaugstulen Oct 28, 2024
0314229
Merge remote-tracking branch 'refs/remotes/origin/master' into eh/fea…
eirikhaugstulen Oct 29, 2024
09f985c
docs: [DHIS2-15187][DHIS2-15190] Working list bulk actions (#3867)
eirikhaugstulen Oct 30, 2024
3639ab7
feat: update caching logic
eirikhaugstulen Nov 4, 2024
c1bf06d
Merge remote-tracking branch 'origin/master' into eh/feat/DHIS2-15187…
eirikhaugstulen Nov 11, 2024
09882a2
fix: tests
eirikhaugstulen Nov 12, 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
@@ -0,0 +1,49 @@
Feature: User facing tests for bulk actions on event working lists

Scenario: the user should be able to select rows
Given you open the main page with Ngelehun and malaria case context
When you select the first 5 rows
Then the bulk action bar should say 5 selected
And the first 5 rows should be selected

Scenario: the user should be able to deselect rows
Given you open the main page with Ngelehun and malaria case context
When you select the first 5 rows
And you deselect the first 3 rows
Then the bulk action bar should say 2 selected

Scenario: the user should be able to select all rows
Given you open the main page with Ngelehun and malaria case context
When you select all rows
Then the bulk action bar should say 15 selected
And all rows should be selected

Scenario: the user should be able to deselect all rows
Given you open the main page with Ngelehun and malaria case context
When you select all rows
And all rows should be selected
And you select all rows
Then the bulk action bar should not be present
And no rows should be selected

Scenario: the filters should be disabled when rows are selected
Given you open the main page with Ngelehun and malaria case context
When you select the first 5 rows
Then the filters should be disabled

@v<42
Scenario: the user should be able to bulk complete events
Given you open the main page with Ngelehun and malaria case context
And you select the first 3 rows
And you click the bulk complete button
And the bulk complete modal should open
When you click the confirm complete events button
Then the bulk complete modal should close

Scenario: the user should be able to bulk delete events
Given you open the main page with Ngelehun and malaria case context
And you select the first 3 rows
And you click the bulk Delete button
And the bulk delete modal should open
When you click the confirm delete events button
Then the bulk delete modal should close
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import { Given, Then, When } from '@badeball/cypress-cucumber-preprocessor';
import '../../sharedSteps';

Given('you open the main page with Ngelehun and malaria case context', () => {
cy.visit('#/?programId=VBqh0ynB2wv&orgUnitId=DiszpKrYNg8');
});

Then('the bulk complete modal should open', () => {
cy.get('[data-test="bulk-complete-events-dialog"]')
.should('exist');
});

When('you click the confirm complete events button', () => {
cy.intercept({
method: 'POST',
url: '**/tracker?async=false**',
}, {
statusCode: 200,
body: {},
}).as('completeEvents');

cy.get('[data-test="bulk-complete-events-dialog"]')
.find('[data-test="dhis2-uicore-button"]')
.contains('Complete').click();

cy.wait('@completeEvents')
.its('request.body')
.should(({ events }) => {
expect(events).to.have.length(3);
expect(events[0]).to.include({ status: 'COMPLETED' });
expect(events[1]).to.include({ status: 'COMPLETED' });
expect(events[2]).to.include({ status: 'COMPLETED' });
});
});

Then('the bulk complete modal should close', () => {
cy.get('[data-test="bulk-complete-events-dialog"]')
.should('not.exist');
});

Then('the bulk delete modal should open', () => {
cy.get('[data-test="bulk-delete-events-dialog"]')
.should('exist');
});

// you click the confirm delete events button
When('you click the confirm delete events button', () => {
cy.intercept({
method: 'POST',
url: '**/tracker?async=false**',
}, {
statusCode: 200,
body: {},
}).as('deleteEvents');

cy.get('[data-test="bulk-delete-events-dialog"]')
.find('[data-test="dhis2-uicore-button"]')
.contains('Delete').click();

cy.wait('@deleteEvents')
.its('request.body')
.should(({ events }) => {
expect(events).to.have.length(3);
expect(events).to.deep.include({ event: 'a969f7a3bf1' });
expect(events).to.deep.include({ event: 'a6f092d0d44' });
expect(events).to.deep.include({ event: 'a5e67163090' });
});
});

Then('the bulk delete modal should close', () => {
cy.get('[data-test="bulk-delete-events-dialog"]')
.should('not.exist');
});
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor';
import { Given, Then, When } from '@badeball/cypress-cucumber-preprocessor';
import { v4 as uuid } from 'uuid';
import '../sharedSteps';
import { getCurrentYear, combineDataAndYear } from '../../../../support/date';
import { combineDataAndYear, getCurrentYear } from '../../../../support/date';

Given('you open the main page with Ngelehun and malaria case context', () => {
cy.visit('#/?programId=VBqh0ynB2wv&orgUnitId=DiszpKrYNg8');
Expand Down Expand Up @@ -29,7 +29,7 @@ Then('the default working list should be displayed', () => {
.should('have.length', 16)
.each(($row, index) => {
if (index) {
cy.wrap($row).find('td').first().invoke('text')
cy.wrap($row).find('td').eq(1).invoke('text')
.then((date) => {
const firstArgs = rows[date].length > 1 ?
new RegExp(`${rows[date].map(item => item.split(' ')[0]).join('|')}`, 'g')
Expand Down Expand Up @@ -185,7 +185,7 @@ Then('the list should display data for the second page', () => {
.should('have.length', 16)
.each(($row, index) => {
if (index) {
cy.wrap($row).find('td').first().invoke('text')
cy.wrap($row).find('td').eq(1).invoke('text')
.then((date) => {
const firstArgs = rows[date].length > 1 ?
new RegExp(`${rows[date].map(item => item.split(' ')[0]).join('|')}`, 'g')
Expand Down Expand Up @@ -219,7 +219,7 @@ Then('the list should display 10 rows of data', () => {
.should('have.length', 11)
.each(($row, index) => {
if (index) {
cy.wrap($row).find('td').first().invoke('text')
cy.wrap($row).find('td').eq(1).invoke('text')
.then((date) => {
const firstArgs = rows[date].length > 1 ?
new RegExp(`${rows[date].map(item => item.split(' ')[0]).join('|')}`, 'g')
Expand Down Expand Up @@ -278,7 +278,7 @@ Then('the list should display data ordered descendingly by report date', () => {
.should('have.length', 16)
.each(($row, index) => {
if (index) {
cy.wrap($row).find('td').first().invoke('text')
cy.wrap($row).find('td').eq(1).invoke('text')
.then((date) => {
const firstArgs = rows[date].length > 1 ?
new RegExp(`${rows[date].map(item => item.split(' ')[0]).join('|')}`, 'g')
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
Feature: User facing tests for bulk actions on Tracked Entity working lists

Scenario: the user should be able to select rows
Given you open the main page with Ngelehun and child programe context
When you select the first 5 rows
Then the bulk action bar should say 5 selected
And the first 5 rows should be selected

Scenario: the user should be able to deselect rows
Given you open the main page with Ngelehun and child programe context
When you select the first 5 rows
And you deselect the first 3 rows
Then the bulk action bar should say 2 selected

Scenario: the user should be able to select all rows
Given you open the main page with Ngelehun and child programe context
When you select all rows
Then the bulk action bar should say 15 selected
And all rows should be selected

Scenario: the user should be able to deselect all rows
Given you open the main page with Ngelehun and child programe context
When you select all rows
And all rows should be selected
And you select all rows
Then the bulk action bar should not be present
And no rows should be selected

Scenario: the filters should be disabled when rows are selected
Given you open the main page with Ngelehun and child programe context
When you select the first 5 rows
Then the filters should be disabled

Scenario: The user should see an error message when trying to bulk complete enrollments with errors
Given you open the main page with Ngelehun and Malaria Case diagnosis context
And you select the first 5 rows
And you click the bulk complete enrollments button
And the bulk complete enrollments modal should open
And the modal content should say: This action will complete 4 active enrollments in your selection. 1 enrollment already marked as completed will not be changed.
When you confirm 2 active enrollments with errors
Then an error dialog will be displayed to the user
And you close the error dialog
And the unsuccessful enrollments should still be selected

Scenario: the user should be able to bulk complete enrollments and events
Given you open the main page with Ngelehun and Malaria Case diagnosis context
And you select row number 7
And you select row number 8
And you select row number 10
And you click the bulk complete enrollments button
And the bulk complete enrollments modal should open
And the modal content should say: This action will complete 3 active enrollments in your selection.
When you confirm 3 active enrollments successfully
Then the bulk complete enrollments modal should close

Scenario: the user should be able to bulk complete enrollments without completing events
Given you open the main page with Ngelehun and Malaria Case diagnosis context
And you select row number 1
And you click the bulk complete enrollments button
And the bulk complete enrollments modal should open
And you deselect the complete events checkbox
And the modal content should say: This action will complete 1 active enrollment in your selection.
When you confirm 1 active enrollment without completing events successfully
Then the bulk complete enrollments modal should close

Scenario: the user should be able to bulk delete enrollments
Given you open the main page with Ngelehun and Malaria Case diagnosis context
And you select the first 3 rows
And you click the bulk delete enrollments button
And the bulk delete enrollments modal should open
When you confirm deleting 3 enrollments
Then the bulk delete enrollments modal should close

Scenario: the user should be able to bulk delete only active enrollments
Given you open the main page with Ngelehun and Malaria Case diagnosis context
And you select the first 3 rows
And you click the bulk delete enrollments button
And the bulk delete enrollments modal should open
When you deselect completed enrollments
And you confirm deleting 2 active enrollments
Then the bulk delete enrollments modal should close

@user:trackerAutoTestRestricted
Scenario: a restricted user should not be able to bulk delete enrollments
Given you open the main page with Ngelehun and WHO RMNCH Tracker context
And you open the working lists
When you select the first 3 rows
Then the bulk delete enrollments button should not be visible
Loading
Loading