Playwright Tests for Digital Research Books #414
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 Tests for Digital Research Books | |
on: | |
deployment_status: | |
jobs: | |
tests: | |
if: github.event_name == 'deployment_status' && github.event.deployment_status.state == 'success' | |
name: Run Tests | |
runs-on: ubuntu-latest | |
env: | |
BASE_URL: ${{ github.event.deployment_status.target_url }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: ".nvmrc" | |
- name: Install Test Dependencies | |
run: npm i @cucumber/[email protected] @playwright/[email protected] | |
- name: Install Playwright | |
run: npx playwright install --with-deps | |
- name: Build app | |
run: NODE_ENV=test npm run build | |
- name: Run your tests | |
run: npm run playwright | |
- name: Set the world parameters as an env var | |
# WORLD_PARAMETERS set here will override anything set in cucumber.json | |
run: | | |
echo "WORLD_PARAMETERS={\"appUrl\": \"$BASE_URL\", \"headless\": true}" >> $GITHUB_ENV | |
- name: Run Cucumber tests | |
run: npm run cucumber -- playwright/features --world-parameters '${{ env.WORLD_PARAMETERS }}' | |
env: | |
CATALOG_USERNAME: ${{ secrets.CATALOG_USERNAME }} | |
CATALOG_USER_PIN: ${{ secrets.CATALOG_USER_PIN }} | |
CUCUMBER_PUBLISH_TOKEN: ${{ secrets.CUCUMBER_PUBLISH_TOKEN }} | |
CUCUMBER_PUBLISH_ENABLED: true | |
# - name: Slack Notification | |
# if: ${{ always() }} | |
# uses: rtCamp/action-slack-notify@v2 | |
# env: | |
# SLACK_CHANNEL: test_reports | |
# SLACK_MESSAGE: https://reports.cucumber.io/report-collections/01dbd6e8-653b-4597-b901-6caf2e653b07 | |
# SLACK_TITLE: DRB Cucumber/Playwright Test Results | |
# SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
# SLACK_USERNAME: nyplorgBot |