()
| 28 | } |
| 29 | |
| 30 | async init() { |
| 31 | const userDataDir = path.resolve( |
| 32 | path.join(itestDir(), this.name, (this.testNdx++).toString()) |
| 33 | ); |
| 34 | this.currentDataDir = userDataDir; |
| 35 | const { bin, entry } = getAppInfo(); |
| 36 | const launchOpts = { |
| 37 | args: [`--user-data-dir=${userDataDir}`, entry], |
| 38 | bypassCSP: true, |
| 39 | timeout: 10000, |
| 40 | } as any; |
| 41 | |
| 42 | if (process.env.VIDEO == 'true') { |
| 43 | launchOpts.recordVideo = { dir: path.join('run', 'videos') }; |
| 44 | } |
| 45 | |
| 46 | // @ts-ignore |
| 47 | if (bin) launchOpts.executablePath = bin; |
| 48 | this.zui = await electron.launch(launchOpts); |
| 49 | |
| 50 | // Pipe the stdout from the electron process into the test runner process |
| 51 | if (process.env['VERBOSE']) { |
| 52 | this.zui.process().stdout.pipe(process.stdout); |
| 53 | } |
| 54 | |
| 55 | await waitForTrue(() => this.zui.windows().length === 2); |
| 56 | await waitForTrue(async () => !!(await this.getWindowByTitle('Zui'))); |
| 57 | await waitForTrue( |
| 58 | async () => !!(await this.getWindowByTitle('Background')) |
| 59 | ); |
| 60 | this.mainWin = await this.getWindowByTitle('Zui'); |
| 61 | |
| 62 | const debug = false; |
| 63 | if (debug) { |
| 64 | this.mainWin.on('console', console.log); |
| 65 | this.zui.process().stdout.on('data', (data) => { |
| 66 | console.log(data.toString()); |
| 67 | }); |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | async dropFile(file: string) { |
| 72 | await this.mainWin.evaluate((file) => { |
no test coverage detected