11import { test , expect } from '@playwright/test' ;
22
3- // Helper function to get URL with cache buster
4- function getTestUrl ( ) : string {
5- return `http://localhost:8080?t=${ Date . now ( ) } ` ;
6- }
7-
83test . describe ( 'WebGPU Rotating Cube' , ( ) => {
9- test . beforeEach ( async ( { page, context } ) => {
10- // Clear cookies between tests
11- await context . clearCookies ( ) ;
12- } ) ;
13-
144 test ( 'should show initialization logs' , async ( { page } ) => {
155 // Collect all console messages - set up BEFORE navigation
166 const consoleMessages : string [ ] = [ ] ;
177 page . on ( 'console' , msg => {
188 consoleMessages . push ( `[${ msg . type ( ) } ] ${ msg . text ( ) } ` ) ;
199 } ) ;
2010
21- // NOW navigate to the page with cache buster
22- await page . goto ( getTestUrl ( ) ) ;
11+ // Navigate and reload to ensure fresh WASM
12+ await page . goto ( 'http://localhost:8080' ) ;
13+ await page . reload ( { waitUntil : 'networkidle' } ) ;
2314
2415 // Wait for canvas to be rendered (indicates WebGPU initialization)
2516 await page . waitForSelector ( 'canvas' , { timeout : 5000 } ) ;
@@ -53,7 +44,7 @@ test.describe('WebGPU Rotating Cube', () => {
5344
5445 test ( 'should load without errors' , async ( { page } ) => {
5546 // Navigate to the page
56- await page . goto ( getTestUrl ( ) ) ;
47+ await page . goto ( 'http://localhost:8080' ) ;
5748
5849 // Wait for the page to load
5950 await page . waitForLoadState ( 'networkidle' ) ;
@@ -80,7 +71,7 @@ test.describe('WebGPU Rotating Cube', () => {
8071
8172 test ( 'should display WebGPU support message' , async ( { page } ) => {
8273 // Navigate to the page
83- await page . goto ( getTestUrl ( ) ) ;
74+ await page . goto ( 'http://localhost:8080' ) ;
8475
8576 // Check that WebGPU initialization messages appear in console
8677 const initMessages : string [ ] = [ ] ;
@@ -108,7 +99,7 @@ test.describe('WebGPU Rotating Cube', () => {
10899
109100 test ( 'should render canvas element' , async ( { page } ) => {
110101 // Navigate to the page
111- await page . goto ( getTestUrl ( ) ) ;
102+ await page . goto ( 'http://localhost:8080' ) ;
112103
113104 // Wait for canvas to be created
114105 await page . waitForSelector ( 'canvas' , { timeout : 5000 } ) ;
@@ -125,7 +116,7 @@ test.describe('WebGPU Rotating Cube', () => {
125116
126117 test ( 'should display control buttons' , async ( { page } ) => {
127118 // Navigate to the page
128- await page . goto ( getTestUrl ( ) ) ;
119+ await page . goto ( 'http://localhost:8080' ) ;
129120
130121 // Wait for canvas to be rendered
131122 await page . waitForSelector ( 'canvas' , { timeout : 5000 } ) ;
@@ -154,7 +145,7 @@ test.describe('WebGPU Rotating Cube', () => {
154145
155146 test ( 'should respond to button clicks' , async ( { page } ) => {
156147 // Navigate to the page
157- await page . goto ( getTestUrl ( ) ) ;
148+ await page . goto ( 'http://localhost:8080' ) ;
158149
159150 // Wait for canvas to be rendered
160151 await page . waitForSelector ( 'canvas' , { timeout : 5000 } ) ;
@@ -190,7 +181,7 @@ test.describe('WebGPU Rotating Cube', () => {
190181
191182 test ( 'should show speed control when auto-rotate is enabled' , async ( { page } ) => {
192183 // Navigate to the page
193- await page . goto ( getTestUrl ( ) ) ;
184+ await page . goto ( 'http://localhost:8080' ) ;
194185
195186 // Wait for canvas to be rendered
196187 await page . waitForSelector ( 'canvas' , { timeout : 5000 } ) ;
@@ -221,7 +212,7 @@ test.describe('WebGPU Rotating Cube', () => {
221212
222213 test ( 'should handle keyboard controls' , async ( { page } ) => {
223214 // Navigate to the page
224- await page . goto ( getTestUrl ( ) ) ;
215+ await page . goto ( 'http://localhost:8080' ) ;
225216
226217 // Wait for canvas to be rendered
227218 await page . waitForSelector ( 'canvas' , { timeout : 5000 } ) ;
@@ -256,7 +247,7 @@ test.describe('WebGPU Rotating Cube', () => {
256247
257248 test ( 'should render scene and capture screenshot' , async ( { page } ) => {
258249 // Navigate to the page
259- await page . goto ( getTestUrl ( ) ) ;
250+ await page . goto ( 'http://localhost:8080' ) ;
260251
261252 // Wait for canvas to be rendered
262253 await page . waitForSelector ( 'canvas' , { timeout : 5000 } ) ;
@@ -280,7 +271,7 @@ test.describe('WebGPU Rotating Cube', () => {
280271
281272 test ( 'should not show error messages' , async ( { page } ) => {
282273 // Navigate to the page
283- await page . goto ( getTestUrl ( ) ) ;
274+ await page . goto ( 'http://localhost:8080' ) ;
284275
285276 // Wait for page to load
286277 await page . waitForTimeout ( 1000 ) ;
0 commit comments