Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes indeterminism with the cy.intercept by moving it upwards above …
…the clicks (#104501) (#104527) ## Summary Fixes indeterminism with cypress by moving the `cy.intercept('PATCH', '/api/timeline').as('updateTimeline');` above where the click is happening. Backport to 7.14.0 to hopefully stabilize it better as well. You can make the indeterminism deterministic by adding (for testing only), a `cy.wait(5000)` like so: ```ts // Keep clicking on the disable all button until the first element of all the elements are no longer checked. // In cases where the click handler is not present on the page just yet, this will cause the button to be clicked // multiple times until it sees that the click took effect. You could go through the whole list but I just check // for the first to be unchecked and then assume the click was successful cy.root() .pipe(($el) => { $el.find(TIMELINE_ROW_RENDERERS_DISABLE_ALL_BTN).trigger('click'); return $el.find(TIMELINE_ROW_RENDERERS_MODAL_ITEMS_CHECKBOX).first(); }) .should('not.be.checked'); cy.wait(5000); // <--- Temp addition for testing to ensure our intercept works above this. If the intercept is below this then we see the same indetermism behavior but deterministically. ``` ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
- Loading branch information