Launches the built app (out/main/index.js) via Playwright's _electron API — no browser project, no chromium download. Adds a launch fixture (electronApp/window/app), an AppPage page object with a screenshot helper for autonomous visual review, and a boot smoke suite (shell renders, @commitea/core label-parse runs in the renderer, preload API exposed). Scripts: e2e (build+run), e2e:only, e2e:report. Artifacts gitignored. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
49 lines
1.3 KiB
TypeScript
49 lines
1.3 KiB
TypeScript
import { dirname, join } from 'node:path'
|
|
import { fileURLToPath } from 'node:url'
|
|
|
|
import {
|
|
_electron as electron,
|
|
expect,
|
|
test as base,
|
|
type ElectronApplication,
|
|
type Page,
|
|
} from '@playwright/test'
|
|
|
|
import { AppPage } from './pages/app.page.js'
|
|
|
|
const here = dirname(fileURLToPath(import.meta.url))
|
|
/** The built main-process entry Playwright launches. `yarn e2e` builds it first. */
|
|
const MAIN_ENTRY = join(here, '..', 'out', 'main', 'index.js')
|
|
|
|
interface CommiteaFixtures {
|
|
/** The launched Electron application. */
|
|
electronApp: ElectronApplication
|
|
/** The app's first (and only) BrowserWindow, as a Playwright Page. */
|
|
window: Page
|
|
/** Page Object over the app shell. */
|
|
app: AppPage
|
|
}
|
|
|
|
export const test = base.extend<CommiteaFixtures>({
|
|
electronApp: async ({}, use) => {
|
|
const electronApp = await electron.launch({
|
|
args: [MAIN_ENTRY],
|
|
env: { ...process.env, NODE_ENV: 'test', COMMITEA_E2E: '1' },
|
|
})
|
|
await use(electronApp)
|
|
await electronApp.close()
|
|
},
|
|
|
|
window: async ({ electronApp }, use) => {
|
|
const window = await electronApp.firstWindow()
|
|
await window.waitForLoadState('domcontentloaded')
|
|
await use(window)
|
|
},
|
|
|
|
app: async ({ window }, use) => {
|
|
await use(new AppPage(window))
|
|
},
|
|
})
|
|
|
|
export { expect }
|