Great module by the way! Works great on live websites, but I am having a bit of difficulty loading my local web server.
I am using webpack and react. To run my server I usually run:
npm run node_modules/.bin/webpack-dev-server
I have added this to the jest-puppeteer.config.js
file:
module.exports = {
server: {
command: 'node node_modules/.bin/webpack-dev-server',
port: 1337,
},
launch: {
headless: false,
devtools: true,
timeout:30000
}
}
But when running the tests it just hangs when trying to load localhost:
describe('Web E2E Test', () => {
beforeAll(async () => {
await page.goto('http://localhost:1337/dashboard')
})
it('Should load dashboard', async () => {
await page.waitForSelector('#dashboard');
})
})
Here is my jest.config.js
:
module.exports = {
"verbose": true,
"preset": "jest-puppeteer-preset"
}
Here is the script in the package JSON I used to run the tests:
"e2e-test-web": "jest e2e"
After running this script I get this error when running the tests:
jest e2e
FAIL e2e/app.test.js (10.676s)
Web E2E Test
✕ Should load dashboard (5004ms)
●Web E2E Test › Should load dashboard
Timeout - Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout.
at node_modules/jest-jasmine2/build/queue_runner.js:68:21
●Web E2E Test › Should load dashboard
Timeout - Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout.
at node_modules/jest-jasmine2/build/queue_runner.js:68:21
Test Suites: 1 failed, 1 total
Tests: 1 failed, 1 total
Snapshots: 0 total
Time: 10.805s, estimated 11s
Ran all test suites matching /e2e/i.
(node:36277) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'addExpectationResult' of undefined
(node:36277) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:36277) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): TypeError: Cannot read property 'addExpectationResult' of undefined