My first experience with E2E: Jest and Puppeteer

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.

Here is the issue, and here is my PR. What I’ve learned so far:

  • 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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s