@@ -3,6 +3,10 @@ description: 'Run Playwright E2E tests with intelligent browser caching'
33author : ' yacosta738'
44
55inputs :
6+ app :
7+ description : ' App to test (portfolio/blog)'
8+ required : false
9+ default : ' portfolio'
610 browser :
711 description : ' Browser to test (chromium/firefox/webkit/all)'
812 required : false
@@ -22,22 +26,22 @@ outputs:
2226 value : ${{ steps.run-tests.outputs.status }}
2327 report-path :
2428 description : ' Path to test report'
25- value : ' apps/portfolio /playwright-report'
29+ value : apps/${{ inputs.app }} /playwright-report
2630
2731runs :
2832 using : " composite"
2933 steps :
3034 - name : Get Playwright version
3135 id : playwright-version
3236 shell : bash
33- working-directory : apps/portfolio
37+ working-directory : apps/${{ inputs.app }}
3438 run : |
3539 VERSION=$(jq -r '.devDependencies["@playwright/test"] // .dependencies["@playwright/test"] // "latest"' package.json)
3640 echo "version=$VERSION" >> $GITHUB_OUTPUT
3741 echo "🎭 Playwright version: $VERSION"
3842 - name : Install dependencies
3943 shell : bash
40- working-directory : apps/portfolio
44+ working-directory : apps/${{ inputs.app }}
4145 run : pnpm install --frozen-lockfile
4246 - name : Cache Playwright browsers
4347 id : playwright-cache
5256 - name : Install Playwright browsers
5357 if : steps.playwright-cache.outputs.cache-hit != 'true'
5458 shell : bash
55- working-directory : apps/portfolio
59+ working-directory : apps/${{ inputs.app }}
5660 run : |
5761 echo "📥 Installing Playwright browsers..."
5862
6569 - name : Ensure Playwright browsers (cached)
6670 if : steps.playwright-cache.outputs.cache-hit == 'true'
6771 shell : bash
68- working-directory : apps/portfolio
72+ working-directory : apps/${{ inputs.app }}
6973 run : |
7074 echo "♻️ Using cached browsers, validating browser binaries and dependencies..."
7175
8084 - name : Run Playwright tests
8185 id : run-tests
8286 shell : bash
83- working-directory : apps/portfolio
87+ working-directory : apps/${{ inputs.app }}
8488 env :
8589 CI : true
8690 PW_USE_PREVIEW : ' 1'
@@ -113,17 +117,17 @@ runs:
113117 if : always() && inputs.upload-results == 'true'
114118 uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
115119 with :
116- name : playwright-report-${{ inputs.browser }}-${{ github.run_number }}
117- path : apps/portfolio /playwright-report/
120+ name : playwright-report-${{ inputs.app }}-${{ inputs. browser }}-${{ github.run_number }}
121+ path : apps/${{ inputs.app }} /playwright-report/
118122 retention-days : 30
119123 if-no-files-found : warn
120124
121125 - name : Upload test traces
122126 if : failure() && inputs.upload-results == 'true'
123127 uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
124128 with :
125- name : playwright-traces-${{ inputs.browser }}-${{ github.run_number }}
126- path : apps/portfolio /test-results/
129+ name : playwright-traces-${{ inputs.app }}-${{ inputs. browser }}-${{ github.run_number }}
130+ path : apps/${{ inputs.app }} /test-results/
127131 retention-days : 30
128132 if-no-files-found : warn
129133
@@ -133,11 +137,12 @@ runs:
133137 run : |
134138 echo "## 🎭 E2E Tests Summary" >> $GITHUB_STEP_SUMMARY
135139 echo "" >> $GITHUB_STEP_SUMMARY
140+ echo "- **App**: ${{ inputs.app }}" >> $GITHUB_STEP_SUMMARY
136141 echo "- **Browser**: ${{ inputs.browser }}" >> $GITHUB_STEP_SUMMARY
137142 echo "- **Status**: ${{ steps.run-tests.outputs.status == 'success' && '✅ Passed' || '❌ Failed' }}" >> $GITHUB_STEP_SUMMARY
138143 echo "- **Mode**: ${{ inputs.headed == 'true' && 'Headed' || 'Headless' }}" >> $GITHUB_STEP_SUMMARY
139144
140145 # Try to extract test statistics
141- if [ -f "apps/portfolio /playwright-report/index.html" ]; then
146+ if [ -f "apps/${{ inputs.app }} /playwright-report/index.html" ]; then
142147 echo "- **Report**: Available in artifacts" >> $GITHUB_STEP_SUMMARY
143148 fi
0 commit comments