Skip to content

Commit

Permalink
Wait for dangling requests in the filtering tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gkarat committed Mar 3, 2023
1 parent f4db674 commit 3a49cc2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/components/GroupsTable/GroupsTable.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ describe('filtering', () => {
beforeEach(() => {
interceptors['successful with some items']();
mountTable();

cy.wait('@getGroups'); // first initial request
});

const applyNameFilter = () =>
Expand All @@ -190,17 +192,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)
Expand Down

0 comments on commit 3a49cc2

Please sign in to comment.