This commit is contained in:
2025-12-12 21:39:48 +01:00
parent ddbd99b747
commit cae81b1088
49 changed files with 777 additions and 269 deletions

View File

@@ -1,14 +1,15 @@
import { describe, test, expect } from 'vitest'
import type { Page } from 'playwright'
import { PlaywrightAutomationAdapter } from 'packages/automation/infrastructure/adapters/automation'
describe('CarsFlow integration', () => {
test('adapter emits panel-attached then action-started then action-complete for performAddCar', async () => {
const adapter = new PlaywrightAutomationAdapter({})
const adapter = new PlaywrightAutomationAdapter({}, undefined, undefined)
const received: Array<{ type: string }> = []
adapter.onLifecycle?.((e) => {
received.push({ type: (e as { type: string }).type })
adapter.onLifecycle?.((e: { type: string; actionId?: string; timestamp: number; payload?: any }) => {
received.push({ type: e.type })
})
// Use mock page fixture: minimal object with required methods
const mockPage = {
waitForSelector: async () => {},
@@ -16,7 +17,7 @@ describe('CarsFlow integration', () => {
waitForTimeout: async () => {},
click: async () => {},
setDefaultTimeout: () => {},
}
} as unknown as Page
// call attachPanel which emits panel-attached and then action-started
await adapter.attachPanel(mockPage, 'add-car')