5151 cache : " yarn"
5252 - run : yarn install --frozen-lockfile
5353 - run : yarn prepublishOnly
54+ - name : Cache React dependencies
55+ uses : actions/cache@v4
56+ with :
57+ path : react-example/node_modules
58+ key : ${{ runner.os }}-react-deps-${{ hashFiles('react-example/yarn.lock') }}
59+ restore-keys : |
60+ ${{ runner.os }}-react-deps-
5461 - name : Install React example dependencies
5562 working-directory : ./react-example
5663 run : |
@@ -64,15 +71,17 @@ jobs:
6471 uses : actions/cache@v4
6572 id : playwright-cache
6673 with :
67- path : |
68- ~/.cache/ms-playwright
69- key : ${{ runner.os }}-playwright-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**/playwright.config.ts') }}
74+ path : ~/.cache/ms-playwright
75+ key : ${{ runner.os }}-playwright-${{ hashFiles('react-example/package.json', 'react-example/playwright.config.ts') }}
7076 restore-keys : |
71- ${{ runner.os }}-playwright-${{ hashFiles('** /package-lock .json', '**/yarn.lock ') }}-
77+ ${{ runner.os }}-playwright-${{ hashFiles('react-example /package.json') }}-
7278 ${{ runner.os }}-playwright-
7379 - name : Install Playwright browsers
7480 working-directory : ./react-example
7581 run : yarn playwright:install --with-deps
82+ - name : Install server management tools
83+ working-directory : ./react-example
84+ run : yarn add -D wait-on
7685 - name : Create environment configuration
7786 working-directory : ./react-example
7887 run : |
@@ -89,28 +98,45 @@ jobs:
8998 - name : Start React example server
9099 working-directory : ./react-example
91100 run : |
92- yarn webpack serve --config webpack.config.js --port 8080 &
93- for i in {1..15}; do
94- if curl -f http://localhost:8080 >/dev/null 2>&1; then
95- echo "Server is ready"
96- break
97- fi
98- if [ $i -eq 15 ]; then
99- echo "Server failed to start after 75 seconds"
100- exit 1
101- fi
102- echo "Waiting for server... (attempt $i/15)"
103- sleep 5
104- done
101+ yarn webpack serve --config webpack.config.js --port 8080 --host 0.0.0.0 &
102+ SERVER_PID=$!
103+ echo "Started server with PID: $SERVER_PID"
104+
105+ # Wait for server to be ready with proper health check
106+ yarn wait-on http://localhost:8080 --timeout 60000
107+
108+ # Verify server health
109+ curl -f http://localhost:8080 > /dev/null || {
110+ echo "❌ Server health check failed"
111+ ps aux | grep webpack
112+ exit 1
113+ }
114+ echo "✅ Server is ready and healthy"
105115 - name : Run Playwright tests
106116 working-directory : ./react-example
107- run : yarn playwright test --project=${{ matrix.browser }}
117+ run : |
118+ yarn playwright test --project=${{ matrix.browser }} --reporter=github
108119 env :
109120 CI : true
121+ PLAYWRIGHT_TIMEOUT : 30000
110122 - name : Upload Playwright report
111123 uses : actions/upload-artifact@v4
112124 if : always()
113125 with :
114126 name : playwright-report-${{ matrix.browser }}
115127 path : react-example/playwright-report/
116128 retention-days : 30
129+ - name : Upload test results
130+ uses : actions/upload-artifact@v4
131+ if : always()
132+ with :
133+ name : test-results-${{ matrix.browser }}
134+ path : react-example/test-results/
135+ retention-days : 7
136+ - name : Cleanup server processes
137+ if : always()
138+ run : |
139+ echo "🧹 Cleaning up server processes..."
140+ pkill -f "webpack serve" || true
141+ pkill -f "node.*webpack" || true
142+ echo "✅ Cleanup completed"
0 commit comments