File tree Expand file tree Collapse file tree 3 files changed +26
-3
lines changed
Expand file tree Collapse file tree 3 files changed +26
-3
lines changed Original file line number Diff line number Diff line change 1+ import { test , expect } from '@playwright/test' ;
2+
3+ test . describe ( 'SQLite cross-browser compatibility' , ( ) => {
4+ test ( 'worker initializes and generates data' , async ( { page } ) => {
5+ await page . goto ( '/' ) ;
6+
7+ // Worker should become ready
8+ await expect ( page . locator ( '.status.ready' ) ) . toBeVisible ( { timeout : 30000 } ) ;
9+
10+ // Generate data
11+ await page . getByRole ( 'button' , { name : 'Generate' } ) . click ( ) ;
12+ await expect ( page . locator ( '.status' ) ) . toContainText ( 'orders' , { timeout : 30000 } ) ;
13+
14+ // Results table should appear (auto-runs query after generate)
15+ await expect ( page . locator ( '.results-table' ) ) . toBeVisible ( { timeout : 10000 } ) ;
16+ } ) ;
17+ } ) ;
Original file line number Diff line number Diff line change 1- import { defineConfig } from '@playwright/test' ;
1+ import { defineConfig , devices } from '@playwright/test' ;
22
33export default defineConfig ( {
44 testDir : './e2e' ,
@@ -8,6 +8,11 @@ export default defineConfig({
88 baseURL : 'http://localhost:3848' ,
99 headless : true ,
1010 } ,
11+ projects : [
12+ { name : 'chromium' , use : { ...devices [ 'Desktop Chrome' ] } } ,
13+ { name : 'webkit' , use : { ...devices [ 'Desktop Safari' ] } } ,
14+ { name : 'firefox' , use : { ...devices [ 'Desktop Firefox' ] } } ,
15+ ] ,
1116 webServer : {
1217 command : 'pnpm dev --port 3848' ,
1318 port : 3848 ,
Original file line number Diff line number Diff line change 11/// <reference lib="webworker" />
22
33import type { WorkerInMessage , WorkerOutMessage , DataPools } from './types' ;
4+ // Static import prevents WebKit from re-evaluating the worker module
5+ // when a dynamic import chunk loads (which resets module-level state).
6+ import initSqlJs from 'sql.js' ;
47
58declare const self : DedicatedWorkerGlobalScope ;
69
@@ -81,8 +84,6 @@ async function doInit(msg: { type: 'init'; wasmExecText: string; wasmBytes: Arra
8184 return r as string ;
8285 } ;
8386
84- // Load sql.js from installed package (Vite bundles this into the worker)
85- const initSqlJs = ( await import ( 'sql.js' ) ) . default ;
8687 const SQL : SqlJsStatic = await initSqlJs ( {
8788 locateFile : ( f : string ) => 'https://cdn.jsdelivr.net/npm/sql.js@1/dist/' + f ,
8889 } ) ;
You can’t perform that action at this time.
0 commit comments