|
| 1 | +name: Debug Widget Tests |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + branches: [main] |
| 7 | + paths: |
| 8 | + - 'tests/**' |
| 9 | + - 'src/widget/**' |
| 10 | + - 'playwright.config.ts' |
| 11 | + - '.github/workflows/debug-tests.yml' |
| 12 | + |
| 13 | +jobs: |
| 14 | + debug: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v4 |
| 19 | + |
| 20 | + - name: Setup Node.js |
| 21 | + uses: actions/setup-node@v4 |
| 22 | + with: |
| 23 | + node-version: '18' |
| 24 | + cache: 'npm' |
| 25 | + |
| 26 | + - name: Install dependencies |
| 27 | + run: npm ci |
| 28 | + |
| 29 | + - name: Build widget |
| 30 | + run: npm run build:widget |
| 31 | + |
| 32 | + - name: List built files |
| 33 | + run: | |
| 34 | + echo "=== Contents of dist directory ===" |
| 35 | + ls -la dist/ |
| 36 | + echo "=== Size of widget.umd.js ===" |
| 37 | + wc -c dist/widget.umd.js |
| 38 | +
|
| 39 | + - name: Test serve command |
| 40 | + run: | |
| 41 | + echo "=== Testing serve command ===" |
| 42 | + npx serve --version |
| 43 | + npx serve -s . -p 3000 & |
| 44 | + SERVER_PID=$! |
| 45 | + echo "Server started with PID: $SERVER_PID" |
| 46 | + sleep 5 |
| 47 | +
|
| 48 | + echo "=== Testing server responses ===" |
| 49 | + curl -I http://localhost:3000/test-widget-embed.html || echo "Failed to access HTML" |
| 50 | + curl -I http://localhost:3000/dist/widget.umd.js || echo "Failed to access JS" |
| 51 | + curl -I http://localhost:3000/dist/style.css || echo "Failed to access CSS" |
| 52 | +
|
| 53 | + kill $SERVER_PID |
| 54 | +
|
| 55 | + - name: Run single test with debug |
| 56 | + run: | |
| 57 | + echo "=== Running test with debug output ===" |
| 58 | + DEBUG=pw:api npx playwright test tests/widget-embed.spec.ts:9:3 --reporter=list || true |
| 59 | +
|
| 60 | + - name: Check widget content |
| 61 | + run: | |
| 62 | + echo "=== First 50 lines of widget.umd.js ===" |
| 63 | + head -n 50 dist/widget.umd.js |
| 64 | + echo "=== Last 50 lines of widget.umd.js ===" |
| 65 | + tail -n 50 dist/widget.umd.js |
| 66 | + echo "=== Searching for WidgetLoader in widget.umd.js ===" |
| 67 | + grep -n "WidgetLoader" dist/widget.umd.js | head -20 || echo "WidgetLoader not found" |
| 68 | +
|
| 69 | + - name: Upload test results |
| 70 | + if: always() |
| 71 | + uses: actions/upload-artifact@v4 |
| 72 | + with: |
| 73 | + name: debug-results |
| 74 | + path: | |
| 75 | + test-results/ |
| 76 | + playwright-report/ |
| 77 | + retention-days: 7 |
0 commit comments