tests
This commit is contained in:
parent
4811675149
commit
bfd7141864
3 changed files with 49 additions and 0 deletions
|
@ -30,6 +30,11 @@ jobs:
|
||||||
sudo dpkg --add-architecture i386
|
sudo dpkg --add-architecture i386
|
||||||
sudo apt-get update -y
|
sudo apt-get update -y
|
||||||
sudo apt-get install -y wine32
|
sudo apt-get install -y wine32
|
||||||
|
- store_test_results:
|
||||||
|
path: test-results
|
||||||
|
- run:
|
||||||
|
name: Base Functionality Test
|
||||||
|
command: yarn playwright test
|
||||||
- run:
|
- run:
|
||||||
name: Generate Builds (Linux)
|
name: Generate Builds (Linux)
|
||||||
command: yarn dist -l -p never
|
command: yarn dist -l -p never
|
||||||
|
|
44
test/base.test.ts
Normal file
44
test/base.test.ts
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
import { _electron as electron } from "playwright";
|
||||||
|
import { test, expect } from "@playwright/test";
|
||||||
|
|
||||||
|
test("Launch electron app", async () => {
|
||||||
|
const electronApp = await electron.launch({ args: ["./index.js"], cwd: "../build" });
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const windowState: { isVisible: boolean, isDevToolsOpened: boolean, isCrashed: boolean } = await electronApp.evaluate(async ({ BrowserWindow, app }) => {
|
||||||
|
const win = BrowserWindow.getAllWindows()[0];
|
||||||
|
|
||||||
|
console.log(win)
|
||||||
|
|
||||||
|
const getState = (win: Electron.BrowserWindow) => ({
|
||||||
|
isVisible: win.isVisible(),
|
||||||
|
isDevToolsOpened: win.webContents.isDevToolsOpened(),
|
||||||
|
isCrashed: win.webContents.isCrashed()
|
||||||
|
})
|
||||||
|
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
if (win && win.isVisible()) {
|
||||||
|
resolve(getState(win))
|
||||||
|
} else if (win) {
|
||||||
|
win.once("ready-to-show", () => setTimeout(() => resolve(getState(win))));
|
||||||
|
} else {
|
||||||
|
app.once("browser-window-created", (_e: Event, window: Electron.BrowserWindow) => setTimeout(() => resolve(getState(window))));
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
expect(windowState.isVisible).toBeTruthy();
|
||||||
|
expect(windowState.isDevToolsOpened).toBeFalsy();
|
||||||
|
expect(windowState.isCrashed).toBeFalsy();
|
||||||
|
|
||||||
|
await electronApp.close();
|
||||||
|
});
|
BIN
test/intro.png
Normal file
BIN
test/intro.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.8 KiB |
Loading…
Add table
Add a link
Reference in a new issue