Fanci-fy your mocha tests with puppeteer.
This package launches a puppeteer browser for your mocha tests. This enables simple and convenient end-to-end testing within the mocha framework.
Some additional utility functions have been provided for convenience.
const mochateer = headless: false width: 1280 height: 900 ;
page arguments are the puppeteer objects (see the puppeteer documentation).
In addition to the standard puppeteer behaviour, the
page argument also provides the following API:
Returns a promise resolving to the inner text of the specified element.
Identical to the puppeteer function, however also prints a nice error message on failure.
Wait for specific text to be displayed in a specified selector.
page.fill(selector, value[, iframe])
Fill an input. An optional iframe which contains the input field may be specified.
Select from a dropdown by the visible text.
Click on an element with the specified
selector and inner text or value of
When using mochateer, you may need to increase the timeout of the mocha runner:
mocha --timeout 20000