Skip to content

Commit 4c55ffc

Browse files
csamujuliandescottes
authored andcommitted
test: remove raceWithTimeout from integration tests
1 parent bb1bf90 commit 4c55ffc

1 file changed

Lines changed: 2 additions & 29 deletions

File tree

tests/integration/moz-extension.integration.test.ts

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -85,25 +85,6 @@ async function getExtensionHostname(firefox: FirefoxClient, extensionId: string)
8585
}
8686
}
8787

88-
/**
89-
* Race a promise against a timeout. Resolves 'ok' on success, 'timeout' if
90-
* the timeout fires, or rejects with the original error.
91-
*/
92-
function raceWithTimeout(promise: Promise<any>, ms: number): Promise<'ok' | 'timeout'> {
93-
let timer: ReturnType<typeof setTimeout>;
94-
return Promise.race([
95-
promise.then(
96-
() => 'ok' as const,
97-
(e: any) => {
98-
throw e;
99-
}
100-
),
101-
new Promise<'timeout'>((resolve) => {
102-
timer = setTimeout(() => resolve('timeout'), ms);
103-
}),
104-
]).finally(() => clearTimeout(timer));
105-
}
106-
10788
describe('BiDi Navigation Integration Tests', () => {
10889
let firefox: FirefoxClient;
10990
let extensionUrl: string;
@@ -157,10 +138,7 @@ describe('BiDi Navigation Integration Tests', () => {
157138
it('should navigate to moz-extension:// URL without hanging', async () => {
158139
// Non-standard schemes use wait:"none" because the Remote Agent
159140
// doesn't emit navigation completion events for extension contexts.
160-
// A 5s timeout proves no hang while tolerating slow CI.
161-
const result = await raceWithTimeout(firefox.navigate(extensionUrl), 5000);
162-
163-
expect(result).toBe('ok');
141+
await firefox.navigate(extensionUrl);
164142

165143
// Poll for the page URL since wait:none returns before the page loads
166144
const driver = firefox.getDriver();
@@ -174,12 +152,7 @@ describe('BiDi Navigation Integration Tests', () => {
174152
}, 15000);
175153

176154
it('should create new page with moz-extension:// URL without hanging', async () => {
177-
const result = await raceWithTimeout(
178-
firefox.createNewPage(extensionUrl).then((idx: number) => idx),
179-
5000
180-
);
181-
182-
expect(result).toBe('ok');
155+
await firefox.createNewPage(extensionUrl);
183156

184157
// Poll for the page URL since wait:none returns before the page loads
185158
const driver = firefox.getDriver();

0 commit comments

Comments
 (0)