Skip to content
This repository has been archived by the owner on Jan 13, 2024. It is now read-only.

Commit

Permalink
support electron (sort of) and nightmare. fixes #179
Browse files Browse the repository at this point in the history
  • Loading branch information
igorklopov committed Aug 2, 2017
1 parent 6e66c59 commit cd9601f
Show file tree
Hide file tree
Showing 9 changed files with 79 additions and 0 deletions.
15 changes: 15 additions & 0 deletions dictionary/electron.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
'use strict';

module.exports = {
pkg: {
patches: {
'index.js': [
'path.join(__dirname, fs',
'path.join(path.dirname(process.execPath), \'electron\', fs'
]
},
deployFiles: [
[ 'dist', 'electron/dist' ]
]
}
};
4 changes: 4 additions & 0 deletions dictionary/minstache.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
'use strict';

module.exports = {
};
18 changes: 18 additions & 0 deletions dictionary/nightmare.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
'use strict';

module.exports = {
pkg: {
patches: {
'lib/nightmare.js': [
'path.join(__dirname, \'runner.js\')',
'path.join(path.dirname(process.execPath), \'nightmare/runner.js\')'
]
},
deployFiles: [
[ 'lib/runner.js', 'nightmare/runner.js' ],
[ 'lib/frame-manager.js', 'nightmare/frame-manager.js' ],
[ 'lib/ipc.js', 'nightmare/ipc.js' ],
[ 'lib/preload.js', 'nightmare/preload.js' ]
]
}
};
5 changes: 5 additions & 0 deletions test/test-79-npm/electron/electron.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use strict';

// see nightmare
require('electron');
console.log('ok');
7 changes: 7 additions & 0 deletions test/test-79-npm/electron/electron.meta.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use strict';

module.exports = function () {
return {
deployFilesFrom: [ 'electron' ]
};
};
1 change: 1 addition & 0 deletions test/test-79-npm/electron/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "private": true }
21 changes: 21 additions & 0 deletions test/test-79-npm/nightmare/nightmare.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
'use strict';

var Nightmare = require('nightmare');
var nightmare = new Nightmare({ show: true });

nightmare
.goto('http://yahoo.com')
.type('form[action*="/search"] [name=p]', 'github nightmare')
.click('form[action*="/search"] [type=submit]')
.wait('#main')
.evaluate(function () {
// nightmare takes thisFunction.toString(), so --public is needed
return document.querySelector('#main .searchCenterMiddle li a').href;
})
.end()
.then(function (result) {
console.log(result);
})
.catch(function (error) {
console.error('Search failed:', error);
});
7 changes: 7 additions & 0 deletions test/test-79-npm/nightmare/nightmare.meta.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use strict';

module.exports = function () {
return {
deployFilesFrom: [ 'electron', 'nightmare' ]
};
};
1 change: 1 addition & 0 deletions test/test-79-npm/nightmare/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "private": true }

0 comments on commit cd9601f

Please sign in to comment.