From aa65ce4d1e98f815e18f5539349f1e15a0f1222b Mon Sep 17 00:00:00 2001 From: Georgii Karataev Date: Fri, 3 Mar 2023 16:05:09 +0100 Subject: [PATCH] Wait for dangling requests in the filtering tests --- src/components/GroupsTable/GroupsTable.cy.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/components/GroupsTable/GroupsTable.cy.js b/src/components/GroupsTable/GroupsTable.cy.js index 1c2dc1278..9841c23de 100644 --- a/src/components/GroupsTable/GroupsTable.cy.js +++ b/src/components/GroupsTable/GroupsTable.cy.js @@ -145,10 +145,12 @@ describe('pagination', () => { }); }); -describe('sorting', () => { +describe.only('sorting', () => { beforeEach(() => { interceptors['successful with some items'](); mountTable(); + + cy.wait('@getGroups'); // first initial request }); const checkSorting = (label, order, dataField) => { @@ -181,6 +183,8 @@ describe('filtering', () => { beforeEach(() => { interceptors['successful with some items'](); mountTable(); + + cy.wait('@getGroups'); // first initial request }); const applyNameFilter = () => @@ -190,17 +194,15 @@ describe('filtering', () => { it('renders filter chip', () => { applyNameFilter(); hasChip('Name', 'lorem'); + cy.wait('@getGroups'); }); it('sends correct request', () => { - applyNameFilter().then(() => { - cy.wait('@getGroups') - .its('request.url') - .should('include', 'hostname_or_id=lorem'); - }); + applyNameFilter(); + cy.wait('@getGroups').its('request.url').should('include', 'hostname_or_id=lorem'); }); - it.only('can remove the chip or reset filters', () => { + it('can remove the chip or reset filters', () => { applyNameFilter(); cy.wait('@getGroups').its('request.url').should('contain', 'hostname_or_id=lorem'); cy.get(CHIP_GROUP)