Skip to content

Commit

Permalink
fix: DHIS2-10738 pressing the back button after a fallback crashes app (
Browse files Browse the repository at this point in the history
#1581)

* chore: sets to false

* chore: covers bug case
  • Loading branch information
paschalidi committed Mar 25, 2021
1 parent 3283322 commit 6d625bb
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cypress/integration/SearchPage.feature
Original file line number Diff line number Diff line change
Expand Up @@ -228,3 +228,12 @@ Feature: User interacts with Search page
When you select Child Programme
And you are in the search page with the Child Programme being preselected from the url
And and you can see the unique identifier input

Scenario: Fallback search navigates back to main page
Given you are in the search page with the Child Programme and org unit being preselected from the url
And you expand the attributes search area
When you fill in the first and last name with values that will return results
And you click search
And you click the fallback search button
When you click the back button
Then you should be taken to the main page with org unit preselected
14 changes: 14 additions & 0 deletions cypress/integration/SearchPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -345,3 +345,17 @@ When('and you can see the unique identifier input', () => {
.find('[data-test="capture-ui-input"]')
.should('exist');
});

Given('you are in the search page with the Child Programme and org unit being preselected from the url', () => {
cy.visit('/#/search?programId=IpHINAT79UW&orgUnitId=DiszpKrYNg8');
});

When('you click the back button', () => {
cy.get('[data-test="dhis2-capture-back-button"]')
.click();
});

Then('you should be taken to the main page with org unit preselected', () => {
cy.url()
.should('eq', `${Cypress.config().baseUrl}/#/?orgUnitId=DiszpKrYNg8`);
});
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ export const getCurrentSelectionsReducerDesc = (appUpdaters: Updaters) => create
[searchPageActionTypes.FALLBACK_SEARCH_COMPLETED]:
(state, { payload: { trackedEntityTypeId } }) => ({
...state,
complete: false,
programId: undefined,
categories: undefined,
categoriesMeta: undefined,
Expand All @@ -219,6 +220,7 @@ export const getCurrentSelectionsReducerDesc = (appUpdaters: Updaters) => create
programId: undefined,
categories: undefined,
categoriesMeta: undefined,
complete: false,
trackedEntityTypeId,
}),
}, 'currentSelections', {
Expand Down

0 comments on commit 6d625bb

Please sign in to comment.