v0.14.0 changeset (#534)

* v0.14.0 changeset

* fixes

* improvements
This commit is contained in:
Chris Tate
2026-02-23 10:48:07 -06:00
committed by GitHub
parent 16c4ef2da6
commit b7665e52b6
10 changed files with 193 additions and 12 deletions
+55 -2
View File
@@ -1,5 +1,5 @@
import { describe, it, expect, beforeAll, afterAll, beforeEach, vi } from 'vitest';
import { BrowserManager } from './browser.js';
import { describe, it, expect, beforeAll, afterAll, beforeEach, afterEach, vi } from 'vitest';
import { BrowserManager, getDefaultTimeout } from './browser.js';
import { executeCommand } from './actions.js';
import { chromium } from 'playwright-core';
@@ -1196,3 +1196,56 @@ describe('BrowserManager', () => {
});
});
});
describe('getDefaultTimeout', () => {
const originalEnv = { ...process.env };
afterEach(() => {
process.env = { ...originalEnv };
});
it('should return 25000 when env var is not set', () => {
delete process.env.AGENT_BROWSER_DEFAULT_TIMEOUT;
expect(getDefaultTimeout()).toBe(25000);
});
it('should return parsed value when env var is a valid positive integer', () => {
process.env.AGENT_BROWSER_DEFAULT_TIMEOUT = '10000';
expect(getDefaultTimeout()).toBe(10000);
});
it('should return 25000 for negative values', () => {
process.env.AGENT_BROWSER_DEFAULT_TIMEOUT = '-1';
expect(getDefaultTimeout()).toBe(25000);
});
it('should return 25000 for zero', () => {
process.env.AGENT_BROWSER_DEFAULT_TIMEOUT = '0';
expect(getDefaultTimeout()).toBe(25000);
});
it('should return 25000 for values below 1000ms floor', () => {
process.env.AGENT_BROWSER_DEFAULT_TIMEOUT = '500';
expect(getDefaultTimeout()).toBe(25000);
});
it('should accept exactly 1000ms as the minimum', () => {
process.env.AGENT_BROWSER_DEFAULT_TIMEOUT = '1000';
expect(getDefaultTimeout()).toBe(1000);
});
it('should return 25000 for non-numeric strings', () => {
process.env.AGENT_BROWSER_DEFAULT_TIMEOUT = 'abc';
expect(getDefaultTimeout()).toBe(25000);
});
it('should return 25000 for empty string', () => {
process.env.AGENT_BROWSER_DEFAULT_TIMEOUT = '';
expect(getDefaultTimeout()).toBe(25000);
});
it('should allow overriding above 25s for users who need longer timeouts', () => {
process.env.AGENT_BROWSER_DEFAULT_TIMEOUT = '60000';
expect(getDefaultTimeout()).toBe(60000);
});
});