Let's first set up the directory and install the packages:
$ mkdir test-compose/notesui
$ cd test-compose/notesui
$ npm init
... answer the questions
$ npm install puppeteer@1.1.x mocha@5.x chai@4.1.x --save
During installation, you'll see that Puppeteer causes the download of Chromium like so:
Downloading Chromium r497674 - 92.5 Mb [====================] 100% 0.0s
The puppeteer module will launch that Chromium instance as needed, managing it as a background process, and communicating with it using the DevTools protocol.
In the script we're about to write, we need a user account that we can use to log in and perform some actions. Fortunately, we already have a script to set up a test account. In users/package.json, add this line to the scripts section:
"setupuser": "PORT=3333 node users-add",
We're about to write this test script, but let's finish the setup, the final bit of which is adding these lines to run.sh:
docker exec -it userauth-test npm run setupuser docker exec -it notesapp-test npm run test-docker-ui
When executed, these two lines ensure that the test user is set up, and it then runs the user interface tests.