* chore: update eslint ignore patterns * Add CI linter and test * remove app arch and start a conversation test case --------- Co-authored-by: Hien To <tominhhien97@gmail.com>
48 lines
1.2 KiB
TypeScript
48 lines
1.2 KiB
TypeScript
import { _electron as electron } from "playwright";
|
|
import { ElectronApplication, Page, expect, test } from "@playwright/test";
|
|
|
|
import {
|
|
findLatestBuild,
|
|
parseElectronApp,
|
|
stubDialog,
|
|
} from "electron-playwright-helpers";
|
|
|
|
let electronApp: ElectronApplication;
|
|
let page: Page;
|
|
|
|
test.beforeAll(async () => {
|
|
process.env.CI = "e2e";
|
|
|
|
const latestBuild = findLatestBuild("dist");
|
|
expect(latestBuild).toBeTruthy();
|
|
|
|
// parse the packaged Electron app and find paths and other info
|
|
const appInfo = parseElectronApp(latestBuild);
|
|
expect(appInfo).toBeTruthy();
|
|
|
|
electronApp = await electron.launch({
|
|
args: [appInfo.main], // main file from package.json
|
|
executablePath: appInfo.executable, // path to the Electron executable
|
|
});
|
|
await stubDialog(electronApp, "showMessageBox", { response: 1 });
|
|
|
|
page = await electronApp.firstWindow();
|
|
});
|
|
|
|
test.afterAll(async () => {
|
|
await electronApp.close();
|
|
await page.close();
|
|
});
|
|
|
|
test("explores models", async () => {
|
|
await page.getByRole("button", { name: "Explore Models" }).first().click();
|
|
const header = await page
|
|
.getByRole("heading")
|
|
.filter({ hasText: "Explore Models" })
|
|
.first()
|
|
.isDisabled();
|
|
expect(header).toBe(false);
|
|
|
|
// More test cases here...
|
|
});
|