I’m trying to get the matrix I created to run two different commands. I’ve tried a bunch of different syntax and I can’t seem to get it. It always runs the first command but I only want it to run “If All Tests, Run UI Playwright Tests” on matrix = UI and then run “If All Tests, Run API Playwright Test”` on matrix = API. And I want them to run in parallel. Can someone help?
name: Run Automation On Demand
on:
workflow_dispatch:
inputs:
URL:
description: 'Which url do you want to run this one?'
required: true
default: 'xxxx'
choice:
type: choice
description: Which suite do you want to run?
options:
- All Tests
- All UI
- All API
- Login
jobs:
build:
runs-on: macos-latest-xlarge
strategy:
matrix:
node-version: [21.x]
automation-type: [UI, API]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- run: npx playwright install chromium
- name: If All Tests, Run UI Playwright Tests
if: ${{ github.event.inputs.choice == 'All Tests' }} && ${{ matrix.automation-type.UI }}
run: URL=${{ github.event.inputs.URL }} npx playwright test playwright/dashboard --workers=8
- name: If All Tests, Run API Playwright Tests
if: ${{ github.event.inputs.choice == 'All Tests' }} && ${{ matrix.automation-type.API }}
run: npx playwright test playwright/api --workers=20
Also tried:
- name: If All Tests, Run UI Playwright Tests
if: ${{ github.event.inputs.choice == 'All Tests' }} && ${{ matrix.automation-type == 'UI' }}
run: URL=${{ github.event.inputs.URL }} npx playwright test playwright/dashboard --workers=8
- name: If All Tests, Run API Playwright Tests
if: ${{ github.event.inputs.choice == 'All Tests' }} && ${{ matrix.automation-type == 'API' }}
run: npx playwright test playwright/api --workers=20
Also tried:
- name: If All Tests, Run All Playwright Tests
if: ${{ github.event.inputs.choice == 'All Tests' }}
run: |
${{ matrix.automation-type.UI }} URL=${{ github.event.inputs.URL }} npx playwright test playwright/dashboard --workers=8
${{ matrix.automation-type.API }} npx playwright test playwright/api --workers=20
2