-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
try running tests on local with updated hostname
- Loading branch information
1 parent
e98041a
commit f22d161
Showing
1 changed file
with
21 additions
and
4 deletions.
There are no files selected for viewing
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
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 | ||
|
@@ -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] | ||
|
||
|
@@ -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 | ||
|
||
|