Added v2 playwright e2e tests and workflow action (#2379)

This commit is contained in:
Zane
2025-04-29 07:02:43 -07:00
committed by GitHub
parent 8d6c5ef6af
commit c8f63e3f91
15 changed files with 673 additions and 39 deletions
+30 -9
View File
@@ -9,27 +9,46 @@ import type {
} from 'electron';
const isDevelopment = !app.isPackaged;
const isHeadless = process.env.HEADLESS === 'true';
// Enable sandbox before app is ready
app.enableSandbox();
if (isHeadless) {
app.disableHardwareAcceleration();
}
async function createWindow() {
// Handle different preload paths for dev and prod
const preloadPath = isDevelopment
? path.join(app.getAppPath(), '.vite/build/preload/preload.js')
: path.join(__dirname, 'preload.js');
// Create the browser window.
// Create the browser window with headless options when needed
const mainWindow = new BrowserWindow({
width: 1200,
height: 800,
webPreferences: {
nodeIntegration: false,
contextIsolation: true,
webSecurity: true,
preload: preloadPath,
sandbox: true,
},
...(isHeadless
? {
show: false,
webPreferences: {
nodeIntegration: false,
contextIsolation: true,
webSecurity: true,
preload: preloadPath,
sandbox: true,
offscreen: true,
},
}
: {
webPreferences: {
nodeIntegration: false,
contextIsolation: true,
webSecurity: true,
preload: preloadPath,
sandbox: true,
},
}),
});
// Set up CSP
@@ -108,7 +127,9 @@ async function createWindow() {
// Load the app
if (isDevelopment) {
mainWindow.loadURL('http://localhost:3001/');
mainWindow.webContents.openDevTools();
if (!isHeadless) {
mainWindow.webContents.openDevTools();
}
} else {
// In production, load from the asar archive
mainWindow.loadFile(path.join(__dirname, 'renderer/index.html'));