Tumortisch-Dist/resources/app/node_modules/electron-process-manager/tests/utils.js

16 lines
487 B
JavaScript
Raw Normal View History

2021-06-15 16:00:08 +02:00
const Promise = require('bluebird');
require('bluebird-extra').usePromise(Promise);
const setUpApp = function(app) {
app.client.addCommand('changeFocusToMatchingURL', URLRegexp => {
return app.client.windowHandles()
.then(handles => Promise.eachAny(handles.value, handle => {
return app.client.window(handle)
.then(() => app.client.getUrl())
.then(url => !!url.match(URLRegexp) || undefined)
}))
})
}
module.exports.setUpApp = setUpApp;