Playwright Test #65
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Playwright Test | |
on: | |
deployment_status: | |
env: | |
HUSKY: 0 | |
jobs: | |
playwright-test: | |
name: Test | |
if: github.event.deployment_status.state == 'success' && github.event.deployment_status.environment == 'Preview' | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.node-version' | |
cache: 'npm' | |
- name: Install dependencies | |
run: npm ci | |
- name: Install Playwright browsers | |
run: npx playwright install --with-deps | |
- name: Run Playwright tests | |
run: npx playwright test | |
env: | |
PLAYWRIGHT_TEST_BASE_URL: ${{ github.event.deployment_status.target_url }} | |
PLAYWRIGHT_PRODUCT_NAME_INSTOCK: ${{ vars.PLAYWRIGHT_PRODUCT_NAME_INSTOCK }} | |
PLAYWRIGHT_PRODUCT_SIZE_INSTOCK: ${{ vars.PLAYWRIGHT_PRODUCT_SIZE_INSTOCK }} | |
PLAYWRIGHT_PRODUCT_COLOR_INSTOCK: ${{ vars.PLAYWRIGHT_PRODUCT_COLOR_INSTOCK }} | |
PLAYWRIGHT_COLLECTION_NAME: ${{ vars.PLAYWRIGHT_COLLECTION_NAME }} | |
PLAYWRIGHT_PRODUCT_NAME_OUTOFSTOCK: ${{ vars.PLAYWRIGHT_PRODUCT_NAME_OUTOFSTOCK }} | |
PLAYWRIGHT_PRODUCT_SIZE_OUTOFSTOCK: ${{ vars.PLAYWRIGHT_PRODUCT_SIZE_OUTOFSTOCK }} | |
PLAYWRIGHT_PRODUCT_COLOR_OUTOFSTOCK: ${{ vars.PLAYWRIGHT_PRODUCT_COLOR_OUTOFSTOCK }} | |
PLAYWRIGHT_BRAND_NAME: ${{ vars.PLAYWRIGHT_BRAND_NAME }} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: playwright-report | |
path: playwright-report/ | |
retention-days: 30 | |
# If configured, host your playwright report on S3 | |
report: | |
name: Report | |
if: ${{ vars.PLAYWRIGHT_S3_URL != '' && (success() || failure()) }} | |
runs-on: ubuntu-latest | |
needs: | |
- playwright-test | |
env: | |
HTML_REPORT_URL_PATH: reports/${{ github.sha }}/${{ github.run_attempt }} | |
steps: | |
- name: Download results | |
uses: actions/download-artifact@v3 | |
with: | |
name: playwright-report | |
path: playwright/${{ env.HTML_REPORT_URL_PATH }} | |
- name: Upload to S3 | |
run: | | |
aws s3 sync playwright s3://$S3_BUCKET | |
env: | |
S3_BUCKET: ${{ vars.PLAYWRIGHT_S3_BUCKET }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.PLAYWRIGHT_AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.PLAYWRIGHT_AWS_SECRET_ACCESS_KEY }} | |
AWS_DEFAULT_REGION: ${{ vars.PLAYWRIGHT_S3_REGION }} | |
- name: Add link to summary | |
env: | |
REPORT_URL: ${{ vars.PLAYWRIGHT_S3_URL }}${{ env.HTML_REPORT_URL_PATH }}/index.html | |
shell: bash | |
run: | | |
echo "[Playwright Report]($REPORT_URL)" >> $GITHUB_STEP_SUMMARY | |
- name: Post status | |
if: ${{ success() || failure() }} | |
uses: Sibz/github-status-action@v1 | |
with: | |
authToken: ${{ secrets.GITHUB_TOKEN }} | |
context: Playwright Report | |
state: ${{ needs.playwright-test.result }} | |
sha: ${{ github.sha }} | |
target_url: ${{ vars.PLAYWRIGHT_S3_URL }}${{ env.HTML_REPORT_URL_PATH }}/index.html |