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 aa65ce4
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/components/GroupsTable/GroupsTable.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -181,6 +183,8 @@ describe('filtering', () => {
beforeEach(() => {
interceptors['successful with some items']();
mountTable();

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

const applyNameFilter = () =>
Expand All @@ -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)
Expand Down

0 comments on commit aa65ce4

Please sign in to comment.