-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-wasm-fallback.js
More file actions
54 lines (43 loc) Β· 1.92 KB
/
test-wasm-fallback.js
File metadata and controls
54 lines (43 loc) Β· 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/**
* WASM Fallback Test Script
*
* This script temporarily disables WASM loading to test fallback behavior.
* Run this in the browser console to test the fallback mechanism.
*/
console.log('π§ͺ Testing WASM Fallback Behavior...');
// Test 1: Check if WASM loader is available
if (typeof window !== 'undefined') {
// Override the WASM loader to simulate failure
const originalConsoleWarn = console.warn;
let wasmLoadAttempts = 0;
console.warn = (...args) => {
if (args[0] && args[0].includes('WASM')) {
wasmLoadAttempts++;
console.log(`π WASM Load Attempt #${wasmLoadAttempts}:`, args[0]);
}
originalConsoleWarn.apply(console, args);
};
// Test 2: Try to load WASM and see fallback behavior
console.log('π Attempting to load WASM...');
// Check if WASM modules are available in the DOM
const wasmFiles = document.querySelectorAll('script[src*="portfolio_engine"], script[src*="wasm"]');
console.log('π WASM Files found in DOM:', wasmFiles.length);
// Test 3: Check Performance Drawer for WASM status
console.log('π Checking Performance Drawer for WASM status...');
// Look for WASM status elements
const wasmStatusElements = document.querySelectorAll('[class*="perf-metric"], [class*="wasm"]');
console.log('π Performance elements found:', wasmStatusElements.length);
// Test 4: Check if analytics are working (should work with JS fallback)
console.log('π Testing analytics functionality...');
// Simulate some analytics events
if (window.analytics) {
console.log('β
Analytics object found');
} else {
console.log('β οΈ Analytics object not found');
}
console.log('β
WASM Fallback Test Complete!');
console.log('π Check the Performance Drawer for WASM status indicators');
console.log('π Look for console messages about WASM loading/fallback');
} else {
console.log('β This test must be run in a browser environment');
}