@@ -62,49 +62,30 @@ jobs:
6262 ${{ runner.os }}-react-deps-
6363 - name : Install React example dependencies
6464 working-directory : ./react-example
65- run : |
66- # Try frozen lockfile first, fallback to regeneration if corrupted
67- yarn install --frozen-lockfile || {
68- echo "Lockfile corrupted, regenerating..."
69- rm yarn.lock
70- yarn install
71- }
72- # Advanced browser caching strategy
65+ run : yarn install --frozen-lockfile
66+
7367 - name : Cache Playwright browsers
7468 uses : actions/cache@v4
7569 id : playwright-cache
7670 with :
7771 path : ~/.cache/ms-playwright
78- key : ${{ runner.os }}-playwright-v2- ${{ matrix.browser }}-${{ hashFiles('react-example/yarn.lock') }}
72+ key : ${{ runner.os }}-playwright-${{ hashFiles('react-example/package.json', 'react-example/yarn.lock') }}
7973 restore-keys : |
80- ${{ runner.os }}-playwright-v2-${{ matrix.browser }}-
81- ${{ runner.os }}-playwright-${{ matrix.browser }}-
82- ${{ runner.os }}-playwright-v2-
83- # Browser-specific installation strategy
84- # Install system dependencies FIRST (requires sudo)
74+ ${{ runner.os }}-playwright-
75+
8576 - name : Install browser system dependencies
86- if : matrix.browser == 'webkit' || matrix.browser == 'firefox'
8777 working-directory : ./react-example
8878 run : |
8979 echo "🔧 Installing ${{ matrix.browser }} system dependencies..."
90- # install-deps must run with sudo to install system packages
9180 sudo npx playwright install-deps ${{ matrix.browser }}
9281 echo "✅ System dependencies installed"
9382
94- # Then install browser binaries (no sudo needed)
9583 - name : Install Playwright browsers
9684 working-directory : ./react-example
9785 run : |
9886 echo "📥 Installing ${{ matrix.browser }} browser binary..."
99- # Install browser only - dependencies already installed above
10087 yarn playwright install ${{ matrix.browser }}
10188 echo "✅ Browser installed"
102-
103- # Browser environment setup (flags now handled by Playwright config)
104- - name : Setup browser environment
105- run : |
106- echo "🚀 Browser environment configured via Playwright config"
107- echo "✅ CI-optimized browser launch parameters will be applied automatically"
10889 - name : Create environment configuration
10990 working-directory : ./react-example
11091 run : |
@@ -116,49 +97,30 @@ jobs:
11697 - name : Build React example app
11798 working-directory : ./react-example
11899 run : yarn build
119- # Enhanced server startup with better resource management
120100 - name : Start React example server
121101 working-directory : ./react-example
122102 run : |
123103 echo "🚀 Starting React server..."
124-
125- # Set Node.js memory limits for better stability
126- export NODE_OPTIONS="--max-old-space-size=4096"
127-
128- # Start server with optimized settings
129104 yarn webpack serve --config webpack.config.js --port 8080 --host 0.0.0.0 &
130- SERVER_PID=$!
131- echo "Server started with PID: $SERVER_PID"
132105
133- # Enhanced health check with better error reporting
134- for i in {1..20 }; do
106+ # Wait for server to be ready
107+ for i in {1..30 }; do
135108 if curl -f http://localhost:8080 >/dev/null 2>&1; then
136- echo "✅ Server ready after ${i} attempts ($(($i*3)) seconds) "
109+ echo "✅ Server ready after ${i} attempts"
137110 break
138111 fi
139- if [ $i -eq 20 ]; then
140- echo "❌ Server startup failed after 60 seconds"
141- echo "📋 Debug information:"
142- ps aux | grep webpack || true
143- netstat -tulpn | grep 8080 || true
144- curl -v http://localhost:8080 || true
112+ if [ $i -eq 30 ]; then
113+ echo "❌ Server startup failed"
145114 exit 1
146115 fi
147- sleep 3
148- echo "Server startup attempt $i/20..."
116+ sleep 2
149117 done
150- # Enhanced test execution with browser-specific optimizations
151118 - name : Run Playwright tests
152119 working-directory : ./react-example
153- run : |
154- yarn playwright test --project=${{ matrix.browser }}
120+ run : yarn playwright test --project=${{ matrix.browser }}
155121 env :
156122 CI : true
157- # Browser-specific environment variables
158- DISPLAY : :99 # Virtual display for browsers
159- # WebKit library path configuration
160- LD_LIBRARY_PATH : $HOME/.cache/ms-playwright/${{ matrix.browser }}-*/minibrowser-wpe/lib:$LD_LIBRARY_PATH
161- # Enhanced artifact management
123+
162124 - name : Upload Playwright report
163125 uses : actions/upload-artifact@v4
164126 if : always()
@@ -174,7 +136,7 @@ jobs:
174136 name : test-results-${{ matrix.browser }}-${{ github.run_number }}
175137 path : react-example/test-results/
176138 retention-days : 7
177- # Comprehensive cleanup with port management
139+
178140 - name : Cleanup server processes
179141 if : always()
180142 run : |
0 commit comments