Using Puppeteer
User Interface (UI) testing is a technique used to identify issues with Graphical User Interfaces (GUIs). The technique is commonly used to test web application interfaces.
For example, if you have an application containing an HTML form, you could use UI testing to validate that the HTML form contains the correct set of input fields. UI testing can also validate interactions with the interface – including simulating button or hyperlink clicks.
Puppeteer is an open source library that can be used to automate UI tests. Puppeteer provides a headless Chromium instance that can be programmatically interacted with.
In the recipe, we will use Puppeteer to UI test the website http://example.com/.
Getting ready
- First, we need to create a directory and initialize our project directory:
$ mkdir using-puppeteer $ cd using-puppeteer $ npm init --yes
- Next, we'll create a directory to hold our test files. Within the directory, we'll also create...