wip
This commit is contained in:
@@ -3,12 +3,14 @@ import { PlaywrightAutomationAdapter } from 'packages/automation/infrastructure/
|
||||
|
||||
describe('CarsFlow integration', () => {
|
||||
test('adapter emits panel-attached then action-started then action-complete for performAddCar', async () => {
|
||||
const adapter = new PlaywrightAutomationAdapter({} as any)
|
||||
const received: any[] = []
|
||||
adapter.onLifecycle?.((e: any) => { received.push(e) })
|
||||
|
||||
const adapter = new PlaywrightAutomationAdapter({})
|
||||
const received: Array<{ type: string }> = []
|
||||
adapter.onLifecycle?.((e) => {
|
||||
received.push({ type: (e as { type: string }).type })
|
||||
})
|
||||
|
||||
// Use mock page fixture: minimal object with required methods
|
||||
const mockPage: any = {
|
||||
const mockPage = {
|
||||
waitForSelector: async () => {},
|
||||
evaluate: async () => {},
|
||||
waitForTimeout: async () => {},
|
||||
@@ -20,11 +22,13 @@ describe('CarsFlow integration', () => {
|
||||
await adapter.attachPanel(mockPage, 'add-car')
|
||||
|
||||
// simulate complete event via internal lifecycle emitter
|
||||
await (adapter as any).emitLifecycle({
|
||||
type: 'action-complete',
|
||||
actionId: 'add-car',
|
||||
timestamp: Date.now(),
|
||||
} as any)
|
||||
await (adapter as unknown as { emitLifecycle: (ev: { type: string; actionId: string; timestamp: number }) => Promise<void> }).emitLifecycle(
|
||||
{
|
||||
type: 'action-complete',
|
||||
actionId: 'add-car',
|
||||
timestamp: Date.now(),
|
||||
},
|
||||
)
|
||||
|
||||
const types = received.map(r => r.type)
|
||||
expect(types.indexOf('panel-attached')).toBeGreaterThanOrEqual(0)
|
||||
|
||||
@@ -40,7 +40,13 @@ describe('Overlay lifecycle (integration)', () => {
|
||||
it('emits modal-opened and confirms after action-started in sane order', async () => {
|
||||
const lifecycleEmitter = new TestLifecycleEmitter();
|
||||
const publisher = new RecordingPublisher();
|
||||
const logger = console as any;
|
||||
type LoggerLike = {
|
||||
debug: (...args: unknown[]) => void;
|
||||
info: (...args: unknown[]) => void;
|
||||
warn: (...args: unknown[]) => void;
|
||||
error: (...args: unknown[]) => void;
|
||||
};
|
||||
const logger = console as unknown as LoggerLike;
|
||||
|
||||
const service = new OverlaySyncService({
|
||||
lifecycleEmitter,
|
||||
@@ -85,7 +91,13 @@ describe('Overlay lifecycle (integration)', () => {
|
||||
it('emits panel-missing when cancelAction is called', async () => {
|
||||
const lifecycleEmitter = new TestLifecycleEmitter();
|
||||
const publisher = new RecordingPublisher();
|
||||
const logger = console as any;
|
||||
type LoggerLike = {
|
||||
debug: (...args: unknown[]) => void;
|
||||
info: (...args: unknown[]) => void;
|
||||
warn: (...args: unknown[]) => void;
|
||||
error: (...args: unknown[]) => void;
|
||||
};
|
||||
const logger = console as unknown as LoggerLike;
|
||||
|
||||
const service = new OverlaySyncService({
|
||||
lifecycleEmitter,
|
||||
|
||||
Reference in New Issue
Block a user