Testing browserstack githubactions #8
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 | |
on: | |
push: | |
branches: [ main, master ] | |
pull_request: | |
branches: [ main, master ] | |
jobs: | |
test: | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install dependencies | |
run: npm ci | |
- name: Install Playwright Browsers | |
run: npx playwright install --with-deps | |
- name: 'BrowserStack Env Setup' | |
uses: 'browserstack/github-actions/setup-env@master' | |
with: | |
username: ${{ secrets.BROWSERSTACK_USERNAME }} | |
access-key: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} | |
- name: 'BrowserStack Local Tunnel Setup' # Invokes the setup-local action | |
uses: browserstack/github-actions/setup-local@master | |
with: | |
local-testing: start | |
local-identifier: random | |
- name: Run Playwright tests | |
run: npx browserstack-node-sdk playwright test | |
env: | |
BROWSERSTACK_USERNAME: ${{secrets.BROWSERSTACK_USERNAME}} | |
BROWSERSTACK_ACCESS_KEY: ${{secrets.BROWSERSTACK_ACCESS_KEY}} | |
- name: 'BrowserStackLocal Stop' # Terminating the BrowserStackLocal tunnel connection | |
uses: browserstack/github-actions/setup-local@master | |
with: | |
local-testing: stop | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: playwright-report | |
path: playwright-report/ | |
retention-days: 30 |