Skip to content

Commit

Permalink
refactor: [DHIS2-15185] use Dhis2 DataTable component in working lists (
Browse files Browse the repository at this point in the history
  • Loading branch information
simonadomnisoru authored and superskip committed Oct 27, 2023
1 parent 64129b0 commit be652c2
Show file tree
Hide file tree
Showing 26 changed files with 666 additions and 2,308 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Then('the list should display the events retrieved from the api', () => {
cy.get('[data-test="event-working-lists"]')
.find('tr')
.each(($teiRow, index) => {
const rowId = $teiRow.get(0).getAttribute('id');
const rowId = $teiRow.get(0).getAttribute('data-test');
if (index > 1) {
expect(rowId).to.equal(teis[index - 1].event);
}
Expand Down Expand Up @@ -232,25 +232,27 @@ When('you click the report date column header', () => {

cy.route('GET', '**/tracker/events**').as('getEvents');

cy.get('[data-test="online-list-table"]')
.contains('Report date')
cy.get('[data-test="dhis2-uicore-tableheadercellaction"]')
.eq(0)
.click()
.click();
});

Then('events should be retrieved from the api ordered ascendingly by report date', () => {
cy.wait('@getEvents', { timeout: 40000 }).as('result');
cy.wait('@getEvents', { timeout: 40000 }).as('resultDefault');
cy.wait('@getEvents', { timeout: 40000 }).as('resultAsc');

cy.get('@result')
cy.get('@resultAsc')
.its('status')
.should('equal', 200);

cy.get('@result')
cy.get('@resultAsc')
.its('url')
.should('match', /order=.*asc/);

cy.get('@result')
cy.get('@resultAsc')
.its('url')
.should('include', 'page=1');

cy.get('@result').its('response.body.instances').as('events');
cy.get('@resultAsc').its('response.body.instances').as('events');
});
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,9 @@ Then('the list should display 10 rows of data', () => {
});

When('you click the report date column header', () => {
cy.get('[data-test="online-list-table"]')
.contains('Report date')
cy.get('[data-test="dhis2-uicore-tableheadercellaction"]')
.eq(0)
.click()
.click();
});

Expand Down Expand Up @@ -364,8 +365,9 @@ When('you change the sharing settings', () => {


When('you update the working list', () => {
cy.get('[data-test="online-list-table"]')
.contains('Report date')
cy.get('[data-test="dhis2-uicore-tableheadercellaction"]')
.eq(0)
.click()
.click();

cy.get('[data-test="list-view-menu-button"]')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ Then('the list should display the teis retrieved from the api', () => {
cy.get('[data-test="tei-working-lists"]')
.find('tr')
.each(($teiRow, index) => {
const rowId = $teiRow.get(0).getAttribute('id');
const rowId = $teiRow.get(0).getAttribute('data-test');
if (index > 1) {
expect(rowId).to.equal(teis[index - 1].trackedEntity);
}
Expand Down Expand Up @@ -226,8 +226,8 @@ When('you click the first name column header', () => {

cy.route('GET', '**/tracker/trackedEntities**').as('getTeis');

cy.get('[data-test="online-list-table"]')
.contains('First name')
cy.get('[data-test="dhis2-uicore-tableheadercellaction"]')
.eq(0)
.click();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,20 +332,21 @@ Then('the list should display 10 rows of data', () => {
});

When('you click the first name column header', () => {
cy.get('[data-test="online-list-table"]')
.contains('First name')
cy.get('[data-test="dhis2-uicore-tableheadercellaction"]')
.eq(0)
.click();
});

When('you click the last name column header', () => {
cy.get('[data-test="online-list-table"]')
.contains('Last name')
cy.get('[data-test="dhis2-uicore-tableheadercellaction"]')
.eq(2)
.click();
});

When('you click the WHOMCH Smoking column header', () => {
cy.get('[data-test="online-list-table"]')
.contains('WHOMCH Smoking')
cy.get('[data-test="dhis2-uicore-tableheadercellaction"]')
.eq(6)
.click()
.click();
});

Expand Down
10 changes: 6 additions & 4 deletions cypress/integration/WorkingLists/sharedSteps.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@ Then('the pagination for the tei working list should show the second page', () =
});

Then('the sort arrow should indicate ascending order', () => {
cy.get('[data-test="data-table-asc-sort-icon"]')
.should('exist');
cy.get('[data-test="table-row"]').within(() => {
cy.get('[data-test="table-row-asc"]').should('exist');
});
});

Then('the enrollment status filter button should show that the active filter is in effect', () => {
Expand Down Expand Up @@ -133,8 +134,9 @@ When('you click the first page button', () => {
});

Then('the sort arrow should indicate descending order', () => {
cy.get('[data-test="data-table-desc-sort-icon"]')
.should('exist');
cy.get('[data-test="table-row"]').within(() => {
cy.get('[data-test="table-row-desc"]').should('exist');
});
});

Then('rows per page should be set to 15', () => {
Expand Down
9 changes: 3 additions & 6 deletions i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -373,9 +373,6 @@ msgstr "Some operations are still runnning. Please wait.."
msgid "Operations running"
msgstr "Operations running"

msgid "Sort"
msgstr "Sort"

msgid ""
"This event has unsaved changes. Leaving this page without saving will lose "
"these changes. Are you sure you want to discard unsaved changes?"
Expand Down Expand Up @@ -1503,9 +1500,6 @@ msgstr "Error editing the event, the changes made were not saved"
msgid "Set coordinate"
msgstr "Set coordinate"

msgid "Page {{currentPage}}"
msgstr "Page {{currentPage}}"

msgid "Date"
msgstr "Date"

Expand All @@ -1524,6 +1518,9 @@ msgstr "To date"
msgid "To time"
msgstr "To time"

msgid "Page {{currentPage}}"
msgstr "Page {{currentPage}}"

msgid "Delete polygon"
msgstr "Delete polygon"

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
],
"dependencies": {
"@dhis2/rules-engine-javascript": "100.37.0",
"@dhis2/app-runtime": "^3.8.0",
"@dhis2/app-runtime": "^3.9.3",
"@dhis2/d2-i18n": "^1.1.0",
"@dhis2/d2-icons": "^1.0.1",
"@dhis2/d2-ui-app": "^2.0.0",
"@dhis2/d2-ui-org-unit-tree": "^7.3.3",
"@dhis2/d2-ui-rich-text": "^7.4.0",
"@dhis2/d2-ui-sharing-dialog": "^7.3.3",
"@dhis2/ui": "^8.7.7",
"@dhis2/ui": "^8.13.8",
"@joakim_sm/react-infinite-calendar": "^2.4.2",
"@material-ui/core": "3.9.4",
"@material-ui/icons": "3",
Expand Down

This file was deleted.

Loading

0 comments on commit be652c2

Please sign in to comment.