Solved: How To Use 'au jest' to run an e2e test?


I’ve recently upgraded an older non-cli to cli and the olde e2e tests don’t run - saying: ReferenceError: protractor is not defined

I find nothing in the CLI guide/github about running e2e tests, nor anything mentioning protractor

Has anyone gotten an e2e test running with protractor on the new CLI ?


As mentioned already in the Gitter channel here is an article describing the basics for a TS based project using Karma/Jasmine with Protractor.


thanks, I’m bouncing back and forth between gitter and here – and will update this topic with the eventual solution


Starting to look better: & – both navalia & nightmare are mentioned with jest in blogs, and the nightmare has a fabulous looking set of capabilities and add-ons.

Will advise soonest…



Kudos to zewa666 for the pointer to nightmare.js – works like a champ!

#1 yarn add --dev nightmare

#2 create a file: test/e2e/nightmare.spec.js

import nightmare from 'nightmare';
describe('When starting the app', function () {
	test('it shows out of service', async function () {
		let page = nightmare({
			show: true,
			dock: true,
			openDevTools: {
				mode: 'detach'
		let text = await page.evaluate(() => document.body.textContent)
		expect(text).toContain('out of service');

#3 au run --watch

#4 au jest (in a different session)

The gorgeous result: a window opens showing the out-of-service page, another opens showing the dev console, then jest passes the test, and nightmare waits 3 seconds before closing up and everything shuts down.

I am sure that I’ll have a set of problems to work through getting all my tests re-written – but who cares!!

Total bonus to be right there with proper async/await !!


as a side note, I discovered that having the dev tools open can cause the screenshot function to hang – so be sure not to open dev tools after you’re done setting up your tests !