novu
novu copied to clipboard
fix(cypress): notifications editor flaky tests
- What kind of change does this PR introduce? (Bug fix)
Some fixes for the tests in Cypress of Notifications editor. It seems to happen some race conditions where in the tests access to elements was tried before them fully load. Pattern quite repeatedly in less powerful dev environments.
- Why was this change needed? (You can also link to an open issue here)
Improve the efficiency of the CI. Though at the cost of a bit of speed in test executions.
- Other information: N/A
Ofcourse it failed 😅
Ofcourse it failed 😅
The one I was suspecting. 🤦🏻 If someone knows a bit more that feature and could explain me what it does I think I could guess what's the potential race condition. With the other tests it was less hard to notice it.
@p-fernandez when creating a notification template, you promote the changes of this template to production. Then switch to the production environment and click on the template edit button.
Once you are in the template editor screen on the Production
environment, switch the environment flag to be Development
This should automatically redirect the user to the Development
template and basically have a different URL. This is what the test is testing.
I think I identified where the flakiness comes from. The environment selector has a behaviour that before being available has an overlay on top and the size of the input radios (the element that renders every environment) has a size of 0x0 so Cypress can't pick them up to run a click there. I couldn't debug it very deep but it also looks like the environment selector re-renders multiple times when loading and has some API calls associated that might make it unavailable for Cypress tests. I need more investigation, but it is the line I think I will follow. Hope it is not a red herring.
@p-fernandez might be it. Is it possible to wait until the element is visible and the overlay is not visible? Maybe with a combination of waitForIdle or something similar. Let me know if you will need help to go over it together in sync 🚀
@scopsy I gave many runs in a row and seems only to fail when uploading artifacts. Tests seem quite stable (hope I am not jinxing it).