Home / Companies / Twilio / Blog / Post Details
Content Deep Dive

Automated tests for your Flex plugins using Jest and Puppeteer

Blog post from Twilio

Post Details
Company
Date Published
Author
Giuseppe Verni
Word Count
1,976
Language
English
Hacker News Points
-
Summary

Automated testing of your Flex plugin using Jest and Puppeteer is now possible. To do this, you need a Twilio Flex project, the Twilio CLI, and the Flex Plugin CLI. You also need to create a new flex plugin using `twilio flex:plugins:create`, add dependencies to the package.json file, and install puppeteer-core. The test script uses Jest for snapshot testing and Puppeteer for end-to-end browser testing. It opens a new Chrome window, navigates to the Flex login page, logs in, waits until the admin / agent desktop is open, and then tests that the close button renders correctly. Additional tests can be added to ensure that the plugin interacts with other plugins or adds automated login functionality. The test script can be further optimized and integrated into a CI/CD pipeline.