Puppeteer test script for Notes

In test-compose/notesui, create a file named uitest.js containing the following:

const puppeteer = require('puppeteer');const assert = require('chai').assert;const util = require('util');const { URL } = require('url');describe('Notes', function() {    this.timeout(10000);    let browser;    let page;    before(async function() {        browser = await puppeteer.launch({ slomo: 500 });        page = await browser.newPage();        await page.goto(process.env.NOTES_HOME_URL);    });    after(async function() {        await page.close();        await browser.close();    });});

This is the start of a Mocha test suite. In the before function, we set up Puppeteer by launching a Puppeteer instance, starting a new Page object, and telling that Page to go to the Notes application ...

Get Node.js Web Development - Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.