🏡 index : quine-global/webdriverio.git

name: Cloud Connection Tests

on:
  workflow_call:
    # Make this a reusable workflow, no value needed
    # https://docs.github.com/en/actions/using-workflows/reusing-workflows

jobs:
  cloud_check:
    name: Cloud Connection Tests
    permissions:
      contents: read
    runs-on: 'ubuntu-latest'
    if: github.ref == 'refs/heads/main'
    steps:
      - name: ⬇️ Checkout Code
        uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0

      - name: 🧑‍🔧 Get Core Dependencies
        uses: ./.github/workflows/actions/get-core-dependencies

      - name: Download Build Archive
        uses: ./.github/workflows/actions/download-archive
        with:
          name: webdriverio
          path: .
          filename: webdriverio-build.zip

      - name: E2E Connection Test
        run: pnpm run test:e2e:cloud
        if: github.ref == 'refs/heads/main'
        env:
          SAUCE_USERNAME: ${{secrets.SAUCE_USERNAME}}
          SAUCE_ACCESS_KEY: ${{secrets.SAUCE_ACCESS_KEY}}

      - name: E2E Connection Test w/ Params
        run: pnpm run test:e2e:cloud --user $SAUCE_USERNAME_PARAM --key $SAUCE_ACCESS_KEY_PARAM
        if: github.ref == 'refs/heads/main'
        env:
          SAUCE_USERNAME_PARAM: ${{secrets.SAUCE_USERNAME}}
          SAUCE_ACCESS_KEY_PARAM: ${{secrets.SAUCE_ACCESS_KEY}}

      - name: E2E Connection AWS Device Farm
        run: pnpm run test:e2e:launch
        if: github.ref == 'refs/heads/main'
        env:
          AWS_ACCESS_KEY_ID: ${{secrets.AWS_ACCESS_KEY_ID}}
          AWS_SECRET_ACCESS_KEY: ${{secrets.AWS_SECRET_ACCESS_KEY}}
          AWS_DEVICE_FARM_ARN: ${{secrets.AWS_DEVICE_FARM_ARN}}

      - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
        if: failure()
        with:
          name: e2e-cloud-connection-tests-logs
          path: e2e/wdio/*.log

      - name: Check Git Context
        uses: ./.github/workflows/actions/check-git-context