Skip to content

Commit

Permalink
try running tests on local with updated hostname
Browse files Browse the repository at this point in the history
  • Loading branch information
jackiequach committed Dec 19, 2024
1 parent e98041a commit f22d161
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions .github/workflows/Playwright.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
name: Playwright Tests for Digital Research Books

on:
deployment_status:
pull_request:

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
Expand All @@ -18,6 +15,19 @@ jobs:
with:
node-version-file: ".nvmrc"

- name: Set environment for branch
run: |
if [[ $GITHUB_REF_NAME == 'production' ]]; then
echo "BASE_URL=https://drb-qa.nypl.org/" >> "$GITHUB_ENV"
else
echo "BASE_URL=http://local.nypl.org:3000/" >> "$GITHUB_ENV"
fi
- name: Add hosts to /etc/hosts
if: github.ref != 'production'
run: |
sudo echo "127.0.0.1 local.nypl.org" | sudo tee -a /etc/hosts
- name: Install Test Dependencies
run: npm i @cucumber/[email protected] @playwright/[email protected]

Expand All @@ -27,6 +37,13 @@ jobs:
- name: Build app
run: NODE_ENV=test npm run build

- name: Start the app
if: github.ref != 'production'
run: |
NODE_ENV=test npm start &
sleep 5
shell: bash

- name: Run your tests
run: npm run playwright

Expand Down

0 comments on commit f22d161

Please sign in to comment.