-
Notifications
You must be signed in to change notification settings - Fork 94
Description
I like the no-unnecessary-waiting rule, but don't currently use it because there are occasional use cases where we need to use explicit waits for a brief period (anywhere from milliseconds to a couple of seconds) following a dynamic wait.
A common example: a page has a grid on it that dynamically loads in data. A filter is applied to the grid. An intercept is done to capture the API call that loads in the data with the new filter, and cy.wait is used to dynamically wait for that API call to complete. Following that, the test tries to retrieve a value from a cell in the first row. However, the page actually takes about a second after the API call completes before the contents on the UI update with the new info, therefore Cypress retrieves the old value prior to filtering because it's just a little too fast.
To resolve this, we would add a cy.wait(1000) call to slow it down just a tiny bit so that we can be sure the UI is updated. However, this would be flagged by the no-unnecessary-waiting rule. That said, I DO want to prohibit longer waits.
To resolve this, it would be helpful if no-unnecessary-waiting were updated so that it has an optional config option to exempt waits up to a configurable number from flagging. If not provided, it will behave as it does now.