|
1 | 1 | import 'regenerator-runtime/runtime'; // if there is an error with moduleNameMapper, npm -S install regenerator-runtime
|
2 | 2 |
|
3 | 3 | //const { Application } = require('spectron');
|
4 |
| -const electronPath = require('electron'); |
5 |
| -const path = require('path'); |
| 4 | +// const electronPath = require('electron'); |
| 5 | +// const path = require('path'); |
6 | 6 |
|
7 |
| -let app; |
| 7 | +// let app; |
8 | 8 |
|
9 |
| -// beforeAll(() => { |
10 |
| -// // create a new app to test with setTimeout to be 15000 because the app takes a few seconds to spin up |
11 |
| -// app = new Application({ |
12 |
| -// path: electronPath, |
13 |
| -// chromeDriverArgs: ['--disable-extensions'], |
14 |
| -// args: [path.join(__dirname, '../app/electron/main.js')] // this is the path from this test file to main.js inside electron folder |
15 |
| -// }); |
16 |
| -// return app.start(); |
17 |
| -// }, 15000); |
| 9 | +// // beforeAll(() => { |
| 10 | +// // // create a new app to test with setTimeout to be 15000 because the app takes a few seconds to spin up |
| 11 | +// // app = new Application({ |
| 12 | +// // path: electronPath, |
| 13 | +// // chromeDriverArgs: ['--disable-extensions'], |
| 14 | +// // args: [path.join(__dirname, '../app/electron/main.js')] // this is the path from this test file to main.js inside electron folder |
| 15 | +// // }); |
| 16 | +// // return app.start(); |
| 17 | +// // }, 15000); |
18 | 18 |
|
19 |
| -// getWindowsCount() will return 2 instead of 1 in dev mode (one for the actual app, one in the browser at localhost:8080 in dev mode) |
20 |
| -xtest('Displays App window', async () => { |
21 |
| - const windowCount = await app.client.getWindowCount(); |
22 |
| - // expect(windowCount).toBe(1); // this returns true/passed if in production mode, change mode in script "test" to 'production' instead of 'test' |
23 |
| - expect(windowCount).toBe(2); // 'dev' or 'test' mode results in 2 windows (one for the app and one for the browser) |
24 |
| -}); |
25 |
| - |
26 |
| -/* we want to test other functionalities of app.client such as text, title, etc. but even the examples from the official spectron website |
27 |
| -or github repo did not yield the same outcomes as demonstrated. So we stopped testing Electron app here */ |
28 |
| -// afterAll(() => { |
29 |
| -// if (app && app.isRunning()) { |
30 |
| -// return app.stop(); |
31 |
| -// } |
| 19 | +// // getWindowsCount() will return 2 instead of 1 in dev mode (one for the actual app, one in the browser at localhost:8080 in dev mode) |
| 20 | +// xtest('Displays App window', async () => { |
| 21 | +// const windowCount = await app.client.getWindowCount(); |
| 22 | +// // expect(windowCount).toBe(1); // this returns true/passed if in production mode, change mode in script "test" to 'production' instead of 'test' |
| 23 | +// expect(windowCount).toBe(2); // 'dev' or 'test' mode results in 2 windows (one for the app and one for the browser) |
32 | 24 | // });
|
| 25 | + |
| 26 | +// /* we want to test other functionalities of app.client such as text, title, etc. but even the examples from the official spectron website |
| 27 | +// or github repo did not yield the same outcomes as demonstrated. So we stopped testing Electron app here */ |
| 28 | +// // afterAll(() => { |
| 29 | +// // if (app && app.isRunning()) { |
| 30 | +// // return app.stop(); |
| 31 | +// // } |
| 32 | +// // }); |
0 commit comments