Electron Playwright Tests #2311
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: Electron Playwright Tests | |
| on: | |
| push: | |
| branches: [master] | |
| pull_request: | |
| types: [labeled] | |
| workflow_dispatch: | |
| inputs: | |
| version_name: | |
| type: string | |
| description: "Desktop Version name eg: v5.11.0" | |
| required: true | |
| instance_details: | |
| type: string | |
| description: "JSON array of platform details" | |
| required: false | |
| MM_TEST_USER_NAME: | |
| description: "The admin username of the test instance" | |
| required: false | |
| type: string | |
| MM_TEST_PASSWORD: | |
| description: "The admin password of the test instance" | |
| required: false | |
| type: string | |
| MM_SERVER_VERSION: | |
| type: string | |
| description: "The server version to test against" | |
| required: false | |
| default: "10.5.0" | |
| jobs: | |
| determine-platforms: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| matrix: ${{ steps.set-matrix.outputs.matrix }} | |
| steps: | |
| - id: set-matrix | |
| run: | | |
| if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | |
| if [[ -n "${{ inputs.instance_details }}" ]]; then | |
| MATRIX=$(echo '${{ inputs.instance_details }}' | jq -c '[.[] | {os: .runner, platform: .platform, url: .url, installation_id: .installation_id}]') | |
| echo "matrix=$MATRIX" >> $GITHUB_OUTPUT | |
| else | |
| MATRIX='[{"os":"ubuntu-24.04","platform":"linux","url":"${{ secrets.MM_TEST_SERVER_URL }}","installation_id":"unknown"}, | |
| {"os":"macos-13","platform":"macos","url":"${{ secrets.MM_TEST_SERVER_URL }}","installation_id":"unknown"}, | |
| {"os":"windows-2022","platform":"windows","url":"${{ secrets.MM_TEST_SERVER_URL }}","installation_id":"unknown"}]' | |
| echo "matrix=$MATRIX" >> $GITHUB_OUTPUT | |
| fi | |
| elif [[ "${{ github.event_name }}" == "push" ]] || [[ "${{ contains(github.event.pull_request.labels.*.name, 'E2E/Run') }}" == "true" ]]; then | |
| MATRIX='[{"os":"ubuntu-24.04","platform":"linux","url":"${{ secrets.MM_TEST_SERVER_URL }}","installation_id":"unknown"}, | |
| {"os":"macos-13","platform":"macos","url":"${{ secrets.MM_TEST_SERVER_URL }}","installation_id":"unknown"}, | |
| {"os":"windows-2022","platform":"windows","url":"${{ secrets.MM_TEST_SERVER_URL }}","installation_id":"unknown"}]' | |
| echo "matrix=$MATRIX" >> $GITHUB_OUTPUT | |
| else | |
| echo "matrix=[]" >> $GITHUB_OUTPUT | |
| fi | |
| e2e-tests: | |
| needs: determine-platforms | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Update initial commit status | |
| uses: mattermost/actions/delivery/update-commit-status@main | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| with: | |
| repository_full_name: ${{ github.repository }} | |
| commit_sha: ${{ github.event.pull_request.head.sha || github.sha }} | |
| context: e2e/multi-platform | |
| description: E2E tests for Mattermost desktop app on all platforms have started... | |
| status: pending | |
| - name: Run E2E tests for all platforms | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| run: | | |
| echo "Starting E2E tests for all instances..." | |
| INSTANCE_LIST=$(echo '${{ inputs.instance_details }}' | jq -c '.[]') | |
| for instance in $INSTANCE_LIST; do | |
| platform=$(echo "$instance" | jq -r '.platform') | |
| installation_id=$(echo "$instance" | jq -r '.installation_id') | |
| echo "Triggering E2E tests for platform: $platform, installation_id: $installation_id" | |
| gh workflow run e2e-functional-template.yml \ | |
| -f runs-on="ubuntu-24.04" \ | |
| -f MM_TEST_SERVER_URL="https://provisioner/instances/$installation_id" \ | |
| -f MM_TEST_USER_NAME="${{ inputs.MM_TEST_USER_NAME || secrets.MM_DESKTOP_E2E_USER_NAME }}" \ | |
| -f MM_TEST_PASSWORD="${{ inputs.MM_TEST_PASSWORD || secrets.MM_DESKTOP_E2E_USER_CREDENTIALS }}" \ | |
| -f DESKTOP_VERSION="${{ inputs.version_name || github.head_ref || github.ref }}" \ | |
| -f MM_SERVER_VERSION="${{ inputs.MM_SERVER_VERSION || '10.5.0' }}" | |
| done | |
| - name: Update final commit status | |
| if: always() | |
| uses: mattermost/actions/delivery/update-commit-status@main | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| with: | |
| repository_full_name: ${{ github.repository }} | |
| commit_sha: ${{ github.event.pull_request.head.sha || github.sha }} | |
| context: e2e/${{ matrix.platform.platform }} | |
| description: Completed with ${{ steps.run-tests.outputs.NEW_FAILURES }} failures | |
| status: ${{ steps.run-tests.outputs.STATUS }} | |
| target_url: ${{ steps.run-tests.outputs.REPORT_LINK }} |