-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix dataset export conflict with paginated results (#484)
Our front-end uses `from` and `search_after` query params to handle paginated search results. When a user exports a subset of our complaint database, the aforementioned pagination params are sent to the API causing it to throw an error because `from mod size != 0`. Instead of reworking the API logic it's better to just purge pagination params from export URLs because they're irrelevant. The whole point of exporting is to download all the search results and not just a single page of search results. See https://github.com/cfpb/ccdb5-api/blob/a63efc345e1a652f9c8ec4875e9247aef6f56128/complaint_search/serializer.py#L185-L189 See https://jira/browse/DATAP-33
- Loading branch information
Showing
4 changed files
with
42 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
describe('Complaint export', () => { | ||
const currentPage = '.m-pagination_label'; | ||
const nextButton = '.m-pagination .m-pagination_btn-next'; | ||
|
||
const exportButton = '.export-btn'; | ||
const filteredDataset = 'label[for=dataset_filtered]'; | ||
const exportUriInput = '.heres-the-url input'; | ||
|
||
beforeEach(() => { | ||
let request = '?**&field=all**sort=created_date_desc'; | ||
let fixture = { fixture: 'list/get-complaints.json' }; | ||
cy.intercept(request, fixture).as('getComplaints'); | ||
|
||
request = '?**&size=0'; | ||
fixture = { fixture: 'list/get-aggs.json' }; | ||
cy.intercept('GET', request, fixture).as('getAggs'); | ||
|
||
cy.visit('?size=10&searchText=debt%20recovery&tab=List'); | ||
cy.wait('@getComplaints'); | ||
cy.wait('@getAggs'); | ||
}); | ||
|
||
it('sends user to an export link without pagination params', () => { | ||
cy.get(nextButton).click(); | ||
cy.url().should('include', 'page=2'); | ||
cy.get(currentPage).should('have.text', 'Page 2'); | ||
|
||
cy.get(exportButton).click(); | ||
cy.get(filteredDataset).click(); | ||
|
||
cy.get(exportUriInput).should('not.include.value', 'frm='); | ||
cy.get(exportUriInput).should('not.include.value', 'search_after='); | ||
}); | ||
}); |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters