35 lines
864 B
JavaScript
35 lines
864 B
JavaScript
/* eslint no-console: 0 */
|
|
import Nightmare from 'nightmare';
|
|
|
|
export default function createNightmare(width = 1280, height = 720) {
|
|
const nightmare = new Nightmare({show: process.env.E2E_SHOW, typeInterval: 10, x: 0, y: 0, waitTimeout: 2000})
|
|
.viewport(width, height);
|
|
|
|
// nightmare.on('page', (type, message, error) => {
|
|
// console.log(type);
|
|
// console.log(message.name);
|
|
// console.log(error);
|
|
// fail(error);
|
|
// });
|
|
|
|
nightmare.on('console', (type, message) => {
|
|
if (type === 'error') {
|
|
fail(message);
|
|
}
|
|
if (type === 'log') {
|
|
// console.log(message);
|
|
}
|
|
});
|
|
|
|
nightmare.header('Accept-Language', 'en');
|
|
|
|
afterAll(() => {
|
|
return nightmare
|
|
.end();
|
|
});
|
|
|
|
return nightmare;
|
|
}
|
|
|
|
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
|