Skip to content

Commit cc00549

Browse files
committed
fix: resolve E2E matrix test failures in CI
- Configure Vite dev server with public/ as root - Add WASM file verification in CI workflow - Increase Playwright server timeout to 120s - Enable stdout/stderr logging for debugging - Set fail-fast: false to see all browser failures - Add fs.allow configuration for Vite - Update test count to 49 (47 E2E + 2 Rust) Fixes GitHub Actions E2E test failures by ensuring dev server serves files correctly and provides better debugging output.
1 parent f9b4ebe commit cc00549

File tree

5 files changed

+36
-10
lines changed

5 files changed

+36
-10
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ jobs:
6363
runs-on: ubuntu-latest
6464
needs: build-wasm
6565
strategy:
66+
fail-fast: false
6667
matrix:
6768
browser: [chromium, firefox, webkit]
6869
steps:
@@ -91,8 +92,17 @@ jobs:
9192
mkdir -p public/wasm public/js
9293
cp pkg/terraphim_editor_bg.wasm public/wasm/
9394
cp pkg/terraphim_editor.js public/js/
95+
ls -la public/wasm/ public/js/terraphim_editor.js
96+
97+
- name: Verify WASM files
98+
run: |
99+
test -f public/wasm/terraphim_editor_bg.wasm || (echo "WASM file missing!" && exit 1)
100+
test -f public/js/terraphim_editor.js || (echo "JS file missing!" && exit 1)
101+
echo "✓ WASM files present"
94102
95103
- name: Run Playwright tests
104+
env:
105+
CI: true
96106
run: npx playwright test --project=${{ matrix.browser }}
97107

98108
- name: Upload test results

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,10 @@ npm run test:e2e:ui
8282

8383
### Test Coverage
8484

85-
-**46 automated tests** covering all functionality
85+
-**49 automated tests** covering all functionality (47 E2E + 2 Rust)
8686
-**3 browser engines** (Chromium, Firefox, WebKit)
8787
-**All 3 UI variants** (Shoelace, Vanilla, Web Awesome)
88+
-**Dynamic script loading** tested and verified
8889
-**CI/CD pipeline** with GitHub Actions
8990

9091
📖 **[Read the Testing Guide](TESTING.md)** for detailed documentation

playwright.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ export default defineConfig({
6363
command: 'npm run dev',
6464
url: 'http://127.0.0.1:8080',
6565
reuseExistingServer: !process.env.CI,
66-
stdout: 'ignore',
66+
timeout: 120 * 1000,
67+
stdout: 'pipe',
6768
stderr: 'pipe',
6869
},
6970
});
0 Bytes
Binary file not shown.

vite.config.js

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,39 @@ import { defineConfig } from 'vite'
22
import wasm from 'vite-plugin-wasm'
33
import topLevelAwait from 'vite-plugin-top-level-await'
44
import { resolve } from 'path'
5-
import { copyFileSync, mkdirSync } from 'fs'
5+
import { copyFileSync, mkdirSync, existsSync } from 'fs'
66

7-
// Copy WASM files from pkg to public
7+
// Copy WASM files from pkg to public (only if pkg exists)
88
try {
9-
mkdirSync('public/wasm', { recursive: true });
10-
mkdirSync('public/js', { recursive: true });
11-
copyFileSync('pkg/terraphim_editor_bg.wasm', 'public/wasm/terraphim_editor_bg.wasm');
12-
copyFileSync('pkg/terraphim_editor.js', 'public/js/terraphim_editor.js');
9+
if (existsSync('pkg/terraphim_editor_bg.wasm')) {
10+
mkdirSync('public/wasm', { recursive: true });
11+
mkdirSync('public/js', { recursive: true });
12+
copyFileSync('pkg/terraphim_editor_bg.wasm', 'public/wasm/terraphim_editor_bg.wasm');
13+
copyFileSync('pkg/terraphim_editor.js', 'public/js/terraphim_editor.js');
14+
console.log('✓ WASM files copied to public/');
15+
}
1316
} catch (error) {
14-
console.error('Error copying files:', error);
17+
console.error('Warning: Could not copy WASM files:', error.message);
1518
}
1619

1720
export default defineConfig({
1821
plugins: [
1922
wasm(),
2023
topLevelAwait()
2124
],
25+
// Use public as the root for dev server (for E2E tests)
26+
root: 'public',
27+
server: {
28+
port: 8080,
29+
strictPort: true,
30+
fs: {
31+
// Allow serving files from project root
32+
allow: ['..']
33+
}
34+
},
2235
build: {
23-
outDir: 'dist',
36+
outDir: '../dist',
37+
emptyOutDir: true,
2438
target: 'esnext',
2539
lib: {
2640
entry: resolve(__dirname, 'public/js/terraphim-editor.js'),

0 commit comments

Comments
 (0)