automation testing using playwright #12
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: Generate lighthouse test report on PR | |
on: | |
pull_request: | |
branches: [ main ] | |
repository_dispatch: | |
types: [call] | |
jobs: | |
automation-test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- run: npm install | |
- name: install playwright | |
run: npx playwright install | |
- name: run playwright | |
id: tests | |
run: TESTPARAM='${{ secrets.TESTING_MAIL_PASSWORD }}' npx playwright test --project=firefox | |
continue-on-error: true | |
- name: Notify on Google Chat | |
uses: Co-qn/google-chat-notification@v1 | |
with: | |
name: test | |
url: ${{ secrets.TEST_GOOGLE_CHAT_WEBHOOK_URL }} | |
status: ${{ steps.tests.outcome }} | |
# - name: Check test result and comment | |
# uses: peter-evans/create-or-update-comment@v1 | |
# with: | |
# token: ${{ secrets.GITHUB_APP_TOKEN }} | |
# issue-number: ${{ github.event.pull_request.number }} | |
# body: | | |
# ${{ steps.tests.outcome == 'failed' && 'Test failed, Please check logs for details.' || 'Test passed :heavy_check_mark:' }} | |
- uses: actions/checkout@master | |
- run: mkdir -p ${{ github.workspace }}/tmp/artifacts | |
- name: Lighthouse | |
uses: foo-software/lighthouse-check-action@master | |
with: | |
outputDirectory: ${{ github.workspace }}/tmp/artifacts | |
gitHubAccessToken: ${{ secrets.POST_DEPLOY_TARGET_GITHUB_APP_TOKEN }} | |
urls: 'https://yral.com/' | |
- name: Upload artifacts | |
uses: actions/upload-artifact@master | |
with: | |
name: Lighthouse reports | |
path: ${{ github.workspace }}/tmp/artifacts | |
- name: Trigger a workflow in another repo | |
uses: actions/github-script@v5 | |
with: | |
script: | | |
github.rest.repos.createDispatchEvent({ | |
owner: 'shreybaz', | |
repo: 'test_automation', | |
event_type: 'call', | |
client_payload: { key: "value" } | |
}); | |
github-token: ${{ secrets.POST_DEPLOY_TARGET_GITHUB_APP_TOKEN }} |