Skip to content

Commit d2b0c5a

Browse files
committed
test: Reduce E2E test timeouts from 30s to 5s
Reduce test timeouts to fail faster: - waitForSelector timeouts: 30s/20s -> 5s - waitForTimeout delays: 3s/2s -> 1s, 1s -> 500ms Tests were taking too long to fail when issues occurred. With 5-second timeouts, failures are detected quickly while still allowing enough time for WebGPU initialization in working scenarios.
1 parent 5355bad commit d2b0c5a

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

examples/webgpu-cube/tests/webgpu-cube.spec.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ test.describe('WebGPU Rotating Cube', () => {
1717
await page.goto('http://localhost:8080');
1818

1919
// Wait for canvas to be rendered (indicates WebGPU initialization)
20-
await page.waitForSelector('canvas', { timeout: 30000 });
20+
await page.waitForSelector('canvas', { timeout: 5000 });
2121

2222
// Wait a bit more for messages
23-
await page.waitForTimeout(1000);
23+
await page.waitForTimeout(500);
2424

2525
// Print all console messages for debugging
2626
console.log('=== Console Messages ===');
@@ -62,7 +62,7 @@ test.describe('WebGPU Rotating Cube', () => {
6262
});
6363

6464
// Wait a bit for any errors to appear
65-
await page.waitForTimeout(2000);
65+
await page.waitForTimeout(1000);
6666

6767
// Filter out known acceptable errors
6868
const criticalErrors = errors.filter(err =>
@@ -86,7 +86,7 @@ test.describe('WebGPU Rotating Cube', () => {
8686
});
8787

8888
// Wait for initialization
89-
await page.waitForTimeout(3000);
89+
await page.waitForTimeout(1000);
9090

9191
// Check for key initialization messages
9292
const hasWebGPUMessage = initMessages.some(msg =>
@@ -123,10 +123,10 @@ test.describe('WebGPU Rotating Cube', () => {
123123
await page.goto('http://localhost:8080');
124124

125125
// Wait for canvas to be rendered
126-
await page.waitForSelector('canvas', { timeout: 30000 });
126+
await page.waitForSelector('canvas', { timeout: 5000 });
127127

128128
// Wait for either controls or error to appear
129-
await page.waitForSelector('#controls, div[style*="background: #ff4444"]', { timeout: 20000 });
129+
await page.waitForSelector('#controls, div[style*="background: #ff4444"]', { timeout: 5000 });
130130

131131
// Check that no error occurred
132132
const errorDivs = await page.locator('div[style*="background: #ff4444"]');
@@ -152,10 +152,10 @@ test.describe('WebGPU Rotating Cube', () => {
152152
await page.goto('http://localhost:8080');
153153

154154
// Wait for canvas to be rendered
155-
await page.waitForSelector('canvas', { timeout: 30000 });
155+
await page.waitForSelector('canvas', { timeout: 5000 });
156156

157157
// Wait for either controls or error to appear
158-
await page.waitForSelector('#btn-toggle, div[style*="background: #ff4444"]', { timeout: 20000 });
158+
await page.waitForSelector('#btn-toggle, div[style*="background: #ff4444"]', { timeout: 5000 });
159159

160160
// Check that no error occurred
161161
const errorDivs = await page.locator('div[style*="background: #ff4444"]');
@@ -188,10 +188,10 @@ test.describe('WebGPU Rotating Cube', () => {
188188
await page.goto('http://localhost:8080');
189189

190190
// Wait for canvas to be rendered
191-
await page.waitForSelector('canvas', { timeout: 30000 });
191+
await page.waitForSelector('canvas', { timeout: 5000 });
192192

193193
// Wait for either controls or error to appear
194-
await page.waitForSelector('#speed-control, div[style*="background: #ff4444"]', { timeout: 20000 });
194+
await page.waitForSelector('#speed-control, div[style*="background: #ff4444"]', { timeout: 5000 });
195195

196196
// Check that no error occurred
197197
const errorDivs = await page.locator('div[style*="background: #ff4444"]');
@@ -219,10 +219,10 @@ test.describe('WebGPU Rotating Cube', () => {
219219
await page.goto('http://localhost:8080');
220220

221221
// Wait for canvas to be rendered
222-
await page.waitForSelector('canvas', { timeout: 30000 });
222+
await page.waitForSelector('canvas', { timeout: 5000 });
223223

224224
// Wait for either controls or error to appear
225-
await page.waitForSelector('#btn-toggle, div[style*="background: #ff4444"]', { timeout: 20000 });
225+
await page.waitForSelector('#btn-toggle, div[style*="background: #ff4444"]', { timeout: 5000 });
226226

227227
// Check that no error occurred
228228
const errorDivs = await page.locator('div[style*="background: #ff4444"]');
@@ -254,10 +254,10 @@ test.describe('WebGPU Rotating Cube', () => {
254254
await page.goto('http://localhost:8080');
255255

256256
// Wait for canvas to be rendered
257-
await page.waitForSelector('canvas', { timeout: 30000 });
257+
await page.waitForSelector('canvas', { timeout: 5000 });
258258

259259
// Wait a bit more for animation
260-
await page.waitForTimeout(2000);
260+
await page.waitForTimeout(1000);
261261

262262
// Take full page screenshot for debugging
263263
await page.screenshot({ path: 'test-results/webgpu-rendering.png', fullPage: true });
@@ -278,7 +278,7 @@ test.describe('WebGPU Rotating Cube', () => {
278278
await page.goto('http://localhost:8080');
279279

280280
// Wait for page to load
281-
await page.waitForTimeout(3000);
281+
await page.waitForTimeout(1000);
282282

283283
// Check that no error divs are present
284284
const errorDivs = await page.locator('div[style*="background: #ff4444"]');

0 commit comments

Comments
 (0)