test: set more electron args when is testing

This commit is contained in:
leejooy96 committed 2024-08-09 09:35:09 +09:00
1 parent 18a14803c9
commit ed84aeb78b
1 file changed
+10 -1
+10 -1
View File
@@ -1,6 +1,7 @@
import { Page, _electron as electron } from 'playwright' import { Page, _electron as electron } from 'playwright'
import { ElectronApplication } from 'playwright-core' import { ElectronApplication } from 'playwright-core'
import { test, expect } from '@playwright/test' import { test, expect } from '@playwright/test'
import { main } from '../package.json'
let appWindow: Page let appWindow: Page
let appElectron: ElectronApplication let appElectron: ElectronApplication
@@ -20,7 +21,15 @@ function existElementByTestId(selector: string, waitingMilliseconds = 100) {
test.beforeAll(async () => { test.beforeAll(async () => {
// Open Electron app from build directory // Open Electron app from build directory
appElectron = await electron.launch({ appElectron = await electron.launch({
args: ['dist/main/index.js'], args: [
main,
...(process.env.CI === 'true' ? ['--no-sandbox'] : []),
'--enable-logging',
'--ignore-certificate-errors',
'--ignore-ssl-errors',
'--ignore-blocklist',
'--ignore-gpu-blocklist'
],
locale: 'en-US', locale: 'en-US',
colorScheme: 'light', colorScheme: 'light',
env: { env: {