Skip to content

Commit

Permalink
Try to fix flaky tests debug_filterTable (wearefrank#111)
Browse files Browse the repository at this point in the history
Try to fix flaky tests debug_filterTable
  • Loading branch information
mhdirkse authored Mar 22, 2022
1 parent 5120fc3 commit cd2b77a
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions cypress/integration/debug_filterTable.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,21 @@ describe('Table size and toggle filter', function () {
})

it('Typing in a table size and retyping it', function () {
// The default value for the maximum is 10 and there are 2 reports, so expect 2.
// We only assume here that the default is two or more.
cy.get('.table-responsive tbody').find('tr').should('have.length', 2);
cy.get('#displayAmount').type('{selectAll}{del}');
cy.get('.table-responsive tbody').find('tr').should('have.length', 0);
// From now on, we type one character at a time. Cypress can type very rapidly.
// We do not expect our app to catch up without guards.
cy.get('#displayAmount').type(1);
cy.get('.table-responsive tbody').find('tr').should('have.length', 1);
cy.get('#displayAmount').type("{backspace}2");
cy.get('#displayAmount').type("{backspace}");
cy.get('.table-responsive tbody').find('tr').should('have.length', 0);
cy.get('#displayAmount').type("2");
cy.get('.table-responsive tbody').find('tr').should('have.length', 2);
// If we would omit typing 1 here, we would test that the length remained 2
// when the edit field changed from 2 to 10. This would not be a good test, because
// Cypress would not see when the typing of 10 would have effect.
cy.get('#displayAmount').type("{backspace}1");
cy.get('.table-responsive tbody').find('tr').should('have.length', 1);
// Martijn Monday February 21. Changed {backspace}10 to {backspace}9
// to make this test stable. Originally, the test succeeded on Martijn's
// computer but was unstable on GitHub. Martijn could not reproduce the
// failure manually. Martijn and Chakir guessed that Cypress can
// type faster than real users.
cy.get('#displayAmount').type("{backspace}9")
cy.get('#displayAmount').type("{backspace}");
cy.get('.table-responsive tbody').find('tr').should('have.length', 0);
cy.get('#displayAmount').type("9")
cy.get('.table-responsive tbody').find('tr').should('have.length', 2)
})

Expand Down

0 comments on commit cd2b77a

Please sign in to comment.