Run Playwright tests #3
This file contains hidden or 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: Run Playwright tests | |
| on: | |
| push: | |
| pull_request: | |
| schedule: | |
| - cron: '30 3 * * 1-5' | |
| workflow_dispatch: | |
| jobs: | |
| run-tests: | |
| name: Run Playwright shards | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| shardIndex: [1,2,3,4,5] | |
| shardTotal: [5] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: 17 | |
| cache: maven | |
| - name: Create .env file | |
| run: | | |
| echo "USERNAME=${{ secrets.USERNAME }}" >> .env | |
| echo "PASSWORD=${{ secrets.PASSWORD }}" >> .env | |
| echo "PASSWORD=${{ secrets.PASSWORD }}" >> .env | |
| echo "NEW_PASSWORD=${{ secrets.NEW_PASSWORD }}" >> .env | |
| echo "FIRST_NAME=${{ secrets.FIRST_NAME }}" >> .env | |
| echo "STREET_NAME=${{ secrets.STREET_NAME }}" >> .env | |
| echo "CITY=${{ secrets.CITY }}" >> .env | |
| echo "STATE=${{ secrets.STATE }}" >> .env | |
| echo "COUNTRY=${{ secrets.COUNTRY }}" >> .env | |
| echo "ZIP_CODE=${{ secrets.ZIP_CODE }}" >> .env | |
| - name: Cache Maven dependencies | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-maven- | |
| - name: Install Playwright dependencies | |
| run: sudo mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="install-deps" | |
| - name: Run shard ${{ matrix.shardIndex }} | |
| run: mvn -B test -DHEADLESS=true -Dsurefire.forkCount=1 -Dsurefire.skipAfterFailureCount=1 -DtestShardIndex=${{ matrix.shardIndex }} -DtestShardTotal=${{ matrix.shardTotal }} | |
| - name: Upload shard Playwright report | |
| if: ${{ !cancelled() }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: playwright-report-${{ matrix.shardIndex }} | |
| path: ./playwright-report | |
| retention-days: 7 | |
| merge-reports: | |
| name: Merge Reports | |
| needs: run-tests | |
| if: always() | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download all shard reports | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: ./playwright-report | |
| pattern: playwright-report-* | |
| merge-multiple: true | |
| - name: Setup Node.js for TestDino upload | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '18' | |
| - name: Send TestDino report | |
| if: always() | |
| run: | | |
| npx --yes tdpw ./playwright-report \ | |
| --token="trx_production_640fb2dab1b126eae0b8e9b956c98b8d980bc90a2ae4a4ead9cf07a1faddb854" \ | |
| --upload-html \ | |
| --verbose | |
| - name: Upload combined Playwright report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: playwright-report | |
| path: ./playwright-report | |
| retention-days: 14 |