27 lines
714 B
JavaScript
27 lines
714 B
JavaScript
/* eslint no-console: 0 */
|
|
import Nightmare from 'nightmare';
|
|
|
|
export default function createNightmare(width = 1280, height = 720) {
|
|
const nightmare = new Nightmare({show: true, typeInterval: 10, x: 0, y: 0}).viewport(width, height);
|
|
|
|
nightmare.on('page', (type, message, error) => {
|
|
fail(error);
|
|
});
|
|
|
|
nightmare.on('dom-ready', function() {
|
|
nightmare.inject('js', `${__dirname}/nightmareModifiers.js`);
|
|
});
|
|
|
|
nightmare.on('console', (type, message) => {
|
|
if (type === 'error') {
|
|
fail(message);
|
|
}
|
|
if (type === 'log') {
|
|
// console.log(message);
|
|
}
|
|
});
|
|
return nightmare;
|
|
}
|
|
|
|
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
|