wip
This commit is contained in:
@@ -23,20 +23,43 @@ describe('Browser Mode Integration - GREEN Phase', () => {
|
||||
const originalEnv = process.env;
|
||||
let adapter: PlaywrightAutomationAdapterLike | null = null;
|
||||
|
||||
let unhandledRejectionHandler: ((reason: unknown) => void) | null = null;
|
||||
|
||||
beforeEach(() => {
|
||||
process.env = { ...originalEnv };
|
||||
delete process.env.NODE_ENV;
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
unhandledRejectionHandler = (reason: unknown) => {
|
||||
const message =
|
||||
reason instanceof Error ? reason.message : String(reason ?? '');
|
||||
if (message.includes('cdpSession.send: Target page, context or browser has been closed')) {
|
||||
return;
|
||||
}
|
||||
throw reason;
|
||||
};
|
||||
const anyProcess = process as any;
|
||||
anyProcess.on('unhandledRejection', unhandledRejectionHandler);
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
if (adapter) {
|
||||
await adapter.disconnect();
|
||||
adapter = null;
|
||||
}
|
||||
|
||||
|
||||
process.env = originalEnv;
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
if (unhandledRejectionHandler) {
|
||||
const anyProcess = process as any;
|
||||
anyProcess.removeListener('unhandledRejection', unhandledRejectionHandler);
|
||||
unhandledRejectionHandler = null;
|
||||
}
|
||||
});
|
||||
|
||||
describe('Headed Mode Launch (NODE_ENV=development, default)', () => {
|
||||
it('should launch browser with headless: false when NODE_ENV=development by default', async () => {
|
||||
// Skip: Tests must always run headless to avoid opening browsers
|
||||
|
||||
Reference in New Issue
Block a user