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

30 lines
963 B
JavaScript
Raw Normal View History

2021-06-15 16:00:08 +02:00
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);
})