wip
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
import { describe, it, expect, afterEach, beforeAll, afterAll } from 'vitest';
|
||||
import { PlaywrightAutomationAdapter, FixtureServer } from 'packages/automation/infrastructure/adapters/automation';
|
||||
import { NoOpLogAdapter } from '../../packages/automation/infrastructure/adapters/logging/NoOpLogAdapter';
|
||||
|
||||
describe('Playwright Adapter Smoke Tests', () => {
|
||||
let adapter: PlaywrightAutomationAdapter | undefined;
|
||||
let server: FixtureServer | undefined;
|
||||
let unhandledRejectionHandler: ((reason: unknown) => void) | null = null;
|
||||
const logger = new NoOpLogAdapter();
|
||||
|
||||
beforeAll(() => {
|
||||
unhandledRejectionHandler = (reason: unknown) => {
|
||||
@@ -15,7 +17,7 @@ describe('Playwright Adapter Smoke Tests', () => {
|
||||
}
|
||||
throw reason;
|
||||
};
|
||||
process.on('unhandledRejection', unhandledRejectionHandler);
|
||||
(process as any).on('unhandledRejection', unhandledRejectionHandler);
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
@@ -39,7 +41,7 @@ describe('Playwright Adapter Smoke Tests', () => {
|
||||
|
||||
afterAll(() => {
|
||||
if (unhandledRejectionHandler) {
|
||||
process.removeListener('unhandledRejection', unhandledRejectionHandler);
|
||||
(process as any).removeListener('unhandledRejection', unhandledRejectionHandler);
|
||||
unhandledRejectionHandler = null;
|
||||
}
|
||||
});
|
||||
@@ -50,7 +52,7 @@ describe('Playwright Adapter Smoke Tests', () => {
|
||||
headless: true,
|
||||
mode: 'mock',
|
||||
timeout: 5000,
|
||||
});
|
||||
}, logger);
|
||||
}).not.toThrow();
|
||||
});
|
||||
|
||||
@@ -59,7 +61,7 @@ describe('Playwright Adapter Smoke Tests', () => {
|
||||
headless: true,
|
||||
mode: 'mock',
|
||||
timeout: 5000,
|
||||
});
|
||||
}, logger);
|
||||
|
||||
const result = await adapter.connect();
|
||||
expect(result.success).toBe(true);
|
||||
@@ -74,7 +76,7 @@ describe('Playwright Adapter Smoke Tests', () => {
|
||||
headless: true,
|
||||
mode: 'mock',
|
||||
timeout: 5000,
|
||||
});
|
||||
}, logger);
|
||||
|
||||
await adapter.connect();
|
||||
const navResult = await adapter.navigateToPage(server.getFixtureUrl(2));
|
||||
@@ -87,12 +89,12 @@ describe('Playwright Adapter Smoke Tests', () => {
|
||||
headless: true,
|
||||
mode: 'mock',
|
||||
timeout: 5000,
|
||||
});
|
||||
}, logger);
|
||||
const adapter2 = new PlaywrightAutomationAdapter({
|
||||
headless: true,
|
||||
mode: 'mock',
|
||||
timeout: 5000,
|
||||
});
|
||||
}, logger);
|
||||
expect(adapter1).not.toBe(adapter2);
|
||||
}).not.toThrow();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user