Skip to content

Enhance GitHub Actions with workflow_dispatch #382

Enhance GitHub Actions with workflow_dispatch

Enhance GitHub Actions with workflow_dispatch #382

Workflow file for this run

name: Magento 2 Playwright Self Test
on:
pull_request:
branches:
- main
workflow_dispatch:
inputs:
ref:
description: 'Git ref, workflow_dispatch'
required: false
default: ''
jobs:
build-and-selftest:
if: github.event_name == 'workflow_dispatch' || github.head_ref != 'gitlab-main'
runs-on: ubuntu-latest
environment: magento-playwright
env:
PLAYWRIGHT_BASE_URL: https://hyva-demo.elgentos.io/
PLAYWRIGHT_PRODUCTION_URL: https://hyva-demo.elgentos.io/
PLAYWRIGHT_STAGING_URL: https://hyva-demo.elgentos.io/
MAGENTO_ADMIN_SLUG: ${{ secrets.MAGENTO_ADMIN_SLUG }}
MAGENTO_ADMIN_USERNAME: ${{ secrets.MAGENTO_ADMIN_USERNAME }}
MAGENTO_ADMIN_PASSWORD: ${{ secrets.MAGENTO_ADMIN_PASSWORD }}
MAGENTO_NEW_ACCOUNT_PASSWORD: ${{ secrets.MAGENTO_NEW_ACCOUNT_PASSWORD }}
MAGENTO_EXISTING_ACCOUNT_EMAIL_CHROMIUM: ${{ secrets.MAGENTO_EXISTING_ACCOUNT_EMAIL_CHROMIUM }}
MAGENTO_EXISTING_ACCOUNT_EMAIL_FIREFOX: ${{ secrets.MAGENTO_EXISTING_ACCOUNT_EMAIL_FIREFOX }}
MAGENTO_EXISTING_ACCOUNT_EMAIL_WEBKIT: ${{ secrets.MAGENTO_EXISTING_ACCOUNT_EMAIL_WEBKIT }}
MAGENTO_EXISTING_ACCOUNT_PASSWORD: ${{ secrets.MAGENTO_EXISTING_ACCOUNT_PASSWORD }}
MAGENTO_EXISTING_ACCOUNT_CHANGED_PASSWORD: ${{ secrets.MAGENTO_EXISTING_ACCOUNT_CHANGED_PASSWORD }}
MAGENTO_COUPON_CODE_CHROMIUM: ${{ secrets.MAGENTO_COUPON_CODE_CHROMIUM }}
MAGENTO_COUPON_CODE_FIREFOX: ${{ secrets.MAGENTO_COUPON_CODE_FIREFOX }}
MAGENTO_COUPON_CODE_WEBKIT: ${{ secrets.MAGENTO_COUPON_CODE_WEBKIT }}
CAPTCHA_BYPASS: true
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: Copy config files
run: |
cp playwright.config.example.ts playwright.config.ts
cp bypass-captcha.config.example.ts bypass-captcha.config.ts
cp tsconfig.example.json tsconfig.json
- name: Create testing suite environment
run: |
set -euo pipefail
echo 'Setting up the testing environment'
mkdir -p base-tests
npm install
npx playwright install-deps
ls -l base-tests
npx playwright test --grep "@setup" --reporter=line --workers=4 --max-failures=1
shell: bash
env:
CI: true
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report
retention-days: 30
- name: Run Playwright tests
run: |
set -euo pipefail
echo "Running tests from testing suite"
npx playwright install --with-deps
npx playwright test --workers=4 --grep-invert "@setup" --max-failures=1
env:
CI: true
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report
retention-days: 30
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: test-results
path: test-results
retention-days: 30