Remove splash; add some pre-test code

This commit is contained in:
49lf
2024-08-12 18:06:08 -04:00
parent b5420f3527
commit d9feb92d70
3 changed files with 40 additions and 40 deletions

View File

@ -0,0 +1,40 @@
import { _electron as electron, test } from '@playwright/test';
import {
getUtils,
TEST_COLORS,
setup,
tearDown,
commonPoints,
PERSIST_MODELING_CONTEXT,
} from './test-utils'
test.describe("when a project", async () => {
// This was the very test created. It provides the foundation for the
// rest of the tests we have to write.
test('is created', async ({ page }) => {
// Launch Electron app.
const electronApp = await electron.launch({ args: ['.'] })
// Evaluation expression in the Electron context.
const appPath = await electronApp.evaluate(async ({ app }) => {
// This runs in the main Electron process, parameter here is always
// the result of the require('electron') in the main app script.
return app.getAppPath();
});
console.log(appPath);
// Get the first window that the app opens, wait if necessary.
const window = await electronApp.firstWindow();
// Print the title.
console.log(await window.title());
// Capture a screenshot.
await window.screenshot({ path: 'intro.png' });
// Direct Electron console to Node terminal.
window.on('console', console.log);
// Click button.
await window.click('text=Click me');
// Exit app.
await electronApp.close();
})
})

View File

@ -1,23 +0,0 @@
<html>
<head>
<title>Zoo Studio</title>
<style>
html, body {
padding: 0;
margin: 0;
border: none;
height: 100%;
width: 100%;
background-color: black;
color: white;
font-family: monospace;
}
</style>
</head>
<body style="display: flex; justify-content: center; align-items: center;">
<div style="display: flex;">
<img src="/logo-blue.svg"/><br/>
<span style="padding-left: 1ch;">Studio</span>
</div>
</body>
</html>

View File

@ -29,36 +29,19 @@ const createWindow = () => {
},
})
const splashWindow = new BrowserWindow({
width: 500,
height: 300,
transparent: false,
frame: false,
alwaysOnTop: true,
})
// and load the index.html of the app.
if (MAIN_WINDOW_VITE_DEV_SERVER_URL) {
splashWindow.loadFile('public/splash.html')
mainWindow.loadURL(MAIN_WINDOW_VITE_DEV_SERVER_URL)
} else {
splashWindow.loadFile(
path.join(__dirname, `../renderer/${MAIN_WINDOW_VITE_NAME}/splash.html`)
)
mainWindow.loadFile(
path.join(__dirname, `../renderer/${MAIN_WINDOW_VITE_NAME}/index.html`)
)
}
splashWindow.center()
// Open the DevTools.
// mainWindow.webContents.openDevTools()
setTimeout(() => {
splashWindow.close()
mainWindow.show()
}, 3000)
}
// Quit when all windows are closed, except on macOS. There, it's common