project files added

This commit is contained in:
mhalfmann
2021-06-15 16:00:08 +02:00
parent e156e2f053
commit db46afa351
13928 changed files with 1569902 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
const Application = require('spectron').Application;
const { join } = require('path');
const assert = require('assert')
const { setUpApp } = require('./utils');
const app = new Application({
env: { TEST_PROCESS_MANAGER: 1 },
path: require(join(__dirname, '../node_modules/electron')),
args: [join(__dirname, '../example/main.js')]
});
app.start()
.then(() => {
setUpApp(app);
return app.client.waitUntilWindowLoaded();
})
.then(() => app.electron.ipcRenderer.send('open-process-manager'))
.then(() => app.client.waitUntilWindowLoaded())
.then(() => assert(app.client.getWindowCount(), 2))
.then(() => app.client.changeFocusToMatchingURL(/process-manager\.html/))
.then(() => app.client.waitForVisible('#app .process-table'))
.then(() => app.stop())
.catch(function (error) {
console.error('Test failed', error);
if (app && app.isRunning()) {
app.stop().then(() => process.exit(1))
} else process.exit(1);
})
+15
View File
@@ -0,0 +1,15 @@
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;