Initialize project and ignore local references
This commit is contained in:
1 parent
a11ac3eaba
commit
2af82b6bb3
132 files changed
+29426
No files matched your search
@@ -0,0 +1,51 @@
|
||||
import { existsSync } from "node:fs";
|
||||
import { mkdtemp, rm } from "node:fs/promises";
|
||||
import { join } from "node:path";
|
||||
import { tmpdir } from "node:os";
|
||||
import { _electron as electron, expect, test } from "@playwright/test";
|
||||
import { getElectronExecutablePath, getMainEntryPath } from "./launch";
|
||||
|
||||
test("first launch onboarding creates a company and opens the desktop shell", async () => {
|
||||
const entry = getMainEntryPath();
|
||||
expect(existsSync(entry)).toBeTruthy();
|
||||
|
||||
const profileDir = await mkdtemp(join(tmpdir(), "agentcompany-e2e-"));
|
||||
const workspaceDir = await mkdtemp(join(tmpdir(), "agentcompany-workspace-"));
|
||||
|
||||
const app = await electron.launch({
|
||||
executablePath: getElectronExecutablePath(),
|
||||
args: [entry],
|
||||
cwd: process.cwd(),
|
||||
env: {
|
||||
...process.env,
|
||||
AGENTCOMPANY_PROFILE_DIR: profileDir,
|
||||
AGENTCOMPANY_DISABLE_UPDATES: "true",
|
||||
AGENTCOMPANY_DISABLE_SINGLE_INSTANCE: "true",
|
||||
},
|
||||
});
|
||||
|
||||
try {
|
||||
const page = await app.firstWindow();
|
||||
await expect(page.getByText("AgentCompany Desktop")).toBeVisible();
|
||||
await page.getByLabel("Company name").fill("Orbit Foundry");
|
||||
await page.getByLabel("Workspace folder").fill(workspaceDir);
|
||||
await page.getByRole("button", { name: /Continue to dashboard/i }).click();
|
||||
|
||||
await expect(page.getByRole("heading", { name: "Dashboard" })).toBeVisible();
|
||||
// Company name is rendered in a custom dropdown trigger button in the sidebar.
|
||||
await expect(page.locator("aside button", { hasText: "Orbit Foundry" }).first()).toBeVisible();
|
||||
const showConsoleButton = page.getByRole("button", { name: /show console/i });
|
||||
await expect(showConsoleButton).toBeVisible();
|
||||
await showConsoleButton.click();
|
||||
await expect(page.getByText("Console", { exact: true })).toBeVisible();
|
||||
const hideConsoleButton = page.getByRole("button", { name: /hide console/i });
|
||||
await expect(hideConsoleButton).toBeVisible();
|
||||
await hideConsoleButton.click();
|
||||
await expect(page.getByText("Console", { exact: true })).toBeHidden();
|
||||
await expect(showConsoleButton).toBeVisible();
|
||||
} finally {
|
||||
await app.close();
|
||||
await rm(profileDir, { recursive: true, force: true });
|
||||
await rm(workspaceDir, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,13 @@
|
||||
import { execFileSync } from "node:child_process";
|
||||
|
||||
/**
|
||||
* Playwright globalSetup: build the Electron app from source before E2E tests.
|
||||
* Uses execFileSync (no shell) for safety and deterministic builds.
|
||||
*/
|
||||
export default function globalSetup() {
|
||||
execFileSync("pnpm", ["electron-vite", "build"], {
|
||||
stdio: "inherit",
|
||||
cwd: process.cwd(),
|
||||
timeout: 120_000,
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import { resolve } from "node:path";
|
||||
|
||||
export function getElectronExecutablePath() {
|
||||
return resolve(process.cwd(), process.platform === "win32" ? "node_modules/.bin/electron.cmd" : "node_modules/.bin/electron");
|
||||
}
|
||||
|
||||
export function getMainEntryPath() {
|
||||
return resolve(process.cwd(), "out/main/index.js");
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { defineConfig } from "@playwright/test";
|
||||
|
||||
export default defineConfig({
|
||||
testDir: ".",
|
||||
testMatch: ["desktop.smoke.spec.ts"],
|
||||
timeout: 120_000,
|
||||
fullyParallel: false,
|
||||
workers: 1,
|
||||
reporter: "list",
|
||||
use: {
|
||||
trace: "on-first-retry",
|
||||
screenshot: "only-on-failure",
|
||||
},
|
||||
// Build from current source before running e2e tests.
|
||||
// Uses globalSetup (not webServer) because electron-vite build is a
|
||||
// one-shot build command, not a long-running server process.
|
||||
globalSetup: "./e2e-global-setup.ts",
|
||||
});
|
||||
Reference in new issue
Block a user