3636  e2e-tests :
3737    runs-on : ubuntu-latest 
3838    timeout-minutes : 15 
39+     container :
40+       image : mcr.microsoft.com/playwright:v1.56.1-jammy 
41+       options : --user 1001 
3942
4043    strategy :
4144      matrix :
@@ -62,117 +65,49 @@ jobs:
6265            ${{ runner.os }}-react-deps- 
6366       - name : Install React example dependencies 
6467        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
73-       - name : Cache Playwright browsers 
74-         uses : actions/cache@v4 
75-         id : playwright-cache 
76-         with :
77-           path : ~/.cache/ms-playwright 
78-           key : ${{ runner.os }}-playwright-v2-${{ matrix.browser }}-${{ hashFiles('react-example/yarn.lock') }} 
79-           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
68+         run : yarn install --frozen-lockfile 
69+ 
8470      - name : Install Playwright browsers 
8571        working-directory : ./react-example 
8672        run : | 
87-           echo "📥 Installing ${{ matrix.browser }} browser..." 
88- 
89-           # Smart installation based on browser type and cache status 
90-           cache_hit="${{ steps.playwright-cache.outputs.cache-hit }}" 
91- 
92-           if [ "$cache_hit" = "true" ]; then 
93-             echo "Cache hit: Installing browser only..." 
94-             yarn playwright install ${{ matrix.browser }} 
95-           elif [ "${{ matrix.browser }}" = "webkit" ]; then 
96-             echo "Cache miss + WebKit: Installing with dependencies..." 
97-             yarn playwright install ${{ matrix.browser }} --with-deps 
98-           elif [ "${{ matrix.browser }}" = "firefox" ]; then 
99-             echo "Cache miss + Firefox: Installing with dependencies..." 
100-             yarn playwright install ${{ matrix.browser }} --with-deps 
101-           else 
102-             echo "Cache miss + Chromium: Installing browser only..." 
103-             yarn playwright install ${{ matrix.browser }} 
104-           fi 
105-        #  WebKit-specific dependency fix (Ubuntu 22.04 compatibility)
106-       - name : Fix WebKit dependencies 
107-         if : matrix.browser == 'webkit' 
108-         run : | 
109-           echo "🔧 Applying WebKit Ubuntu 22.04 fixes..." 
110-           sudo apt-get update -qq 
111-           # Install the exact library versions WebKit needs 
112-           sudo apt-get install -y libwoff2-1.1.0 libwoff2dec1 fonts-liberation || true  
113-           echo "✅ WebKit dependencies updated" 
114- 
115-        #  Browser environment setup (flags now handled by Playwright config)
116-       - name : Setup browser environment 
117-         run : | 
118-           echo "🚀 Browser environment configured via Playwright config" 
119-           echo "✅ CI-optimized browser launch parameters will be applied automatically" 
73+           echo "📥 Installing ${{ matrix.browser }} browser (dependencies already in Docker image)..." 
74+           yarn playwright install ${{ matrix.browser }} 
75+           echo "✅ Browser installed" 
12076       - name : Create environment configuration 
12177        working-directory : ./react-example 
12278        run : | 
12379          cat > .env << 'EOF' 
124-           API_KEY=${{ secrets.ITERABLE_API_KEY }} 
125-           JWT_SECRET=${{ secrets.JWT_SECRET }} 
126-           USE_JWT=true 
127-           JWT_GENERATOR=https://jwt-generator.stg-itbl.co/generate 
80+           API_KEY=${{ secrets.ITERABLE_NO_JWT_API_KEY }} 
81+           USE_JWT=false 
1288212983          EOF 
13084       - name : Build React example app 
13185        working-directory : ./react-example 
13286        run : yarn build 
133-       #  Enhanced server startup with better resource management
13487      - name : Start React example server 
13588        working-directory : ./react-example 
13689        run : | 
13790          echo "🚀 Starting React server..." 
138- 
139-           # Set Node.js memory limits for better stability 
140-           export NODE_OPTIONS="--max-old-space-size=4096" 
141- 
142-           # Start server with optimized settings 
14391          yarn webpack serve --config webpack.config.js --port 8080 --host 0.0.0.0 & 
144-           SERVER_PID=$! 
145-           echo "Server started with PID: $SERVER_PID" 
14692
147-           # Enhanced health check with better error reporting  
148-           for i in {1..20 }; do 
93+           # Wait for server to be ready  
94+           for i in {1..30 }; do 
14995            if curl -f http://localhost:8080 >/dev/null 2>&1; then 
150-               echo "✅ Server ready after ${i} attempts ($(($i*3)) seconds) " 
96+               echo "✅ Server ready after ${i} attempts" 
15197              break 
15298            fi 
153-             if [ $i -eq 20 ]; then 
154-               echo "❌ Server startup failed after 60 seconds" 
155-               echo "📋 Debug information:" 
156-               ps aux | grep webpack || true  
157-               netstat -tulpn | grep 8080 || true  
158-               curl -v http://localhost:8080 || true  
99+             if [ $i -eq 30 ]; then 
100+               echo "❌ Server startup failed" 
159101              exit 1 
160102            fi 
161-             sleep 3 
162-             echo "Server startup attempt $i/20..." 
103+             sleep 2 
163104          done 
164-        #  Enhanced test execution with browser-specific optimizations
165105       - name : Run Playwright tests 
166106        working-directory : ./react-example 
167-         run : | 
168-           yarn playwright test --project=${{ matrix.browser }} 
107+         run : yarn playwright test --project=${{ matrix.browser }} 
169108        env :
170109          CI : true 
171-           #  Browser-specific environment variables
172-           DISPLAY : :99  #  Virtual display for browsers
173-           #  WebKit library path configuration
174-           LD_LIBRARY_PATH : $HOME/.cache/ms-playwright/${{ matrix.browser }}-*/minibrowser-wpe/lib:$LD_LIBRARY_PATH 
175-       #  Enhanced artifact management
110+ 
176111      - name : Upload Playwright report 
177112        uses : actions/upload-artifact@v4 
178113        if : always() 
@@ -188,7 +123,7 @@ jobs:
188123          name : test-results-${{ matrix.browser }}-${{ github.run_number }} 
189124          path : react-example/test-results/ 
190125          retention-days : 7 
191-        #  Comprehensive cleanup with port management 
126+ 
192127      - name : Cleanup server processes 
193128        if : always() 
194129        run : | 
0 commit comments