


The tests will confirm that these elements are on the page and contain the expected text within them.Īdd a new test file named at the root of the project. The first elements you will be testing are the header and the paragraph. With these installed, you can now begin adding browser tests to the project. Install these packages as development dependencies using this command: npm install -save-dev puppeteer jest

You will need to clone a demo application by running this command: git clone -single-branch -branch base-project

The first step is to set up a web application to test. Cloning and running the sample application With all these installed and set up, we can begin the tutorial. Node.js installed on your system (version >= 12).To follow this tutorial, a few things are required: You will then take this a step further by automating the testing process in a continuous integration flow. In this tutorial, you will learn and demonstrate how to write tests for the browser using Puppeteer. Unit tests are great, but nothing beats testing an application by interacting with the user-facing frontend. Users search items, fill forms, create shopping carts, log into their profiles, and perform many other tasks. Most interactions with a web application occur at the browser.
