On today’s live stream, we worked through adding some e2e tests to a block we created in a previous stream. This was a lot of fun and I learned a lot about using the various packages available to developers when working with custom blocks.
- Discussed how the
@wordpress/scriptspackage contains the e2e testing tools
- Discussed how we also need
@wordpress/envto run them.
- Created a basic e2e test suite to test if the block was inserted and that the content was correct
- Discussed using snapshots and the difference between
- Discussed how to pre-populate the test database with content using npm
precommands and the
- Created a test to ensure that the block saved test input by the test as the
If you missed me live, you can view the recorded stream below and you can get the code for all of my live streams at https://github.com/ryanwelcher/twitch.
I typically stream Thursdays at 10:30 EST/EDT to both my Twitch and YouTube channels. If you like anything you see, please follow/subscribe to any or all of my accounts and if there is a topic you’d like to see streamed, please add it to https://github.com/ryanwelcher/twitch/issues or leave a comment below.