I have heard a lot of E2E tests and how important they are to make products, especially the front-end side, more robust. However, I did not have any chance to work with them.
And just in time, when working in Edit Flow, there was a strange issue that E2E tests failed, then suddenly worked, and then failed. I worked on it and learned a few interesting things.
- Setting up the environment to run tests (a real website with a real data) takes a lot of effort.
- Writing steps to instruct tests is… time-consuming too. Sometimes, you need to check and choose the correct selector to tell the bot what to do.
- We can set up Puppeteer to run and see what each test really do on our screen, and take a screenshot at any time during the test. That’s really cool to see what the issue was. I’ve learned all of these from this video.
- When dealing with datetime picker or datetime in general, keep in mind what’s next in a few months. In the issue I dealt with in the Edit Flow plugin, the selector was correct in some months, but it failed in other months. That makes the test unstable.
They’re all not something new or extraordinary but I am glad that I’ve explored a new area.