git clone https://github.com/trentmwillis/devtools-protocol-demos.git
From there you can run the various demos using
npm run and then the corresponding script name as documented below.
There are two types of demos in this repository:
The Service Demos showcase Puppeteer-powered APIs. You can run them with
npm run service<name>.
static-site-api- Creates a RESTful API for getting content from a statically generated site. After starting the service, go to
http://localhost:3000to get a random post from my blog.
screenshot-emailer- Creates a service where you can email a screenshot of a webpage to someone. You'll need a Gmail account in order for this demo to work.
playback- Creates a service where you can post a series of commands and Puppeteer will "playback" those commands. After starting the service, you can run
service-demos/playback-demo-script.jsin the browser to see it work.
The Testing Demos showcase testing various aspects of the ChitChat web application. You can run them with
npm run test:<name>.
intro- A basic introduction showing launching the browser, visiting a page, and checking for an element's text.
user-flow- Builds on the
introdemo and runs through a user flow for sending messages in the app.
accessibility- Builds on the
user-flowdemo and checks the accessibility of the page using
visual-regression- Builds on the
accessibilitydemo and checks the visual appearance of the app by using screenshots.
memory-leak-by-heap- Demonstrates a simple approach to detecting memory leaks by looking at the JS heap size of the app before and after a series of actions.
memory-leak-by-prototype- Demonstrates detecting memory leaks by checking for objects of a specific prototype in the app's memory.
code-coverage- Shows how to get code coverage (usage) reports for the assets used by a web app. Runs a test and then uses Istanbul to generate the report.
multi-user- Demonstrates how to launch multiple instances of an application to test multi-user interactions.
multi-user-full- Demonstrates how to launch multiple instances of an application to test multi-user interactions with accessibility, memory, and code coverage checks as well.