Skip to content

Commit

Permalink
Add Playwright tests to CI pipeline via GitHub Actions (#422)
Browse files Browse the repository at this point in the history
* added to changelog

* added language filter test

* update changelog

* removed stray console.log

* added playwright yml

* typo

* playwright gha

* playwright env

* yml

* yml

* yaml

* yml

* added headless is true in setup.ts

* minor edit to yml file

* Added Slack notification step

* Uncommented cron and added Cucumber env

* Added run options

* Deleted cucumber.js since cucumber.json already exists

* Uncommented Cucumber publish

* Updated run schedule

* Uncommented push to test Slack notif

* Added feature folder to command line

* Commented out push and waiting till notif on schedule

* Removed run on push

* Updated changelog

---------

Co-authored-by: Chris Mulholland <[email protected]>
  • Loading branch information
clarissarichard and chrismulholland authored Aug 11, 2023
1 parent 318460d commit 99a3b2b
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 7 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/Playwright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Playwright Tests for Digital Research Books

on:
schedule:
- cron: "00 14 * * 1-5"
pull_request:
branches: [production]
types: [opened, synchronize, reopened]


jobs:
tests:
name: Run Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- uses: actions/setup-node@v2
with:
node-version-file: ".nvmrc"

- name: Install Deps
run: npm i @cucumber/[email protected] @playwright/[email protected]

- name: Install Playwright Browser Utils
run: npx playwright install --with-deps

- name: Set the world parameters as an env var
run: |
echo "WORLD_PARAMETERS={\"appUrl\": \"https://digital-research-books-beta.nypl.org\", \"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 password": ${{ 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
7 changes: 1 addition & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- Add: SFR-1749: Verify the footers and the respecting landing pages (homepage)
- Add: SFR-1750: Verify the Back to Search Results button is available on Item Details page
- SFR-1750: Verify the header links of home page
- SFR-1745: Add Playwright tests to GitHub Actions

## [0.17.3]

Expand Down Expand Up @@ -46,12 +47,6 @@

## [0.16.1]

- add features and tests for publication year filter
- add features and tests for language filter
- Upgrade dgx-header-component to v2.8.0-r16-rc-3

## [0.16.0]

- add features and tests for government docs filter
- Add github actions to automate tag and release
- Replace DS Header component with dgx-header-component v2.8.0-r16-rc-2
Expand Down
1 change: 1 addition & 0 deletions playwright/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@ to target the nth:
to run test on qa site instead of prod, change the url here:
npm run cucumber -- playwright/features/ReadOnlineTargets.feature --world-parameters '{"appUrl": "https://drb-qa.nypl.org/"}'


https://digital-research-books-beta.nypl.org/
2 changes: 1 addition & 1 deletion playwright/support/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class CustomWorld extends World {

private newBrowser = async (): Promise<Browser> => {
return await chromium.launch({
headless: false,
headless: true,
// slowMo: 1200,
});
};
Expand Down

1 comment on commit 99a3b2b

@vercel
Copy link

@vercel vercel bot commented on 99a3b2b Aug 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.