name: CI - Java

on:
  workflow_call:
  workflow_dispatch:

permissions:
  contents: read

jobs:
  browser-tests-windows:
    name: Browser Tests
    uses: ./.github/workflows/bazel.yml
    strategy:
      fail-fast: false
      matrix:
        include:
          - os: windows
    with:
      name: Browser Tests (chrome, ${{ matrix.os }})
      os: ${{ matrix.os }}
      needs-display: true
      rerun-with-debug: true
      run: >
        bazel test --flaky_test_attempts 2
        //java/test/org/openqa/selenium/chrome:ChromeDriverFunctionalTest
        //java/test/org/openqa/selenium/federatedcredentialmanagement:FederatedCredentialManagementTest
        //java/test/org/openqa/selenium/firefox:FirefoxDriverBuilderTest
        //java/test/org/openqa/selenium/grid/router:RemoteWebDriverDownloadTest
        //java/test/org/openqa/selenium/remote:RemoteWebDriverBuilderTest
        //java/test/org/openqa/selenium/grid/router:RemoteWebDriverDownloadTest
        //java/test/org/openqa/selenium/devtools:NetworkInterceptorRestTest

  browser-tests-macos:
    name: Browser Tests
    uses: ./.github/workflows/bazel.yml
    strategy:
      fail-fast: false
      matrix:
        include:
          - os: macos
    with:
      name: Browser Tests (chrome, ${{ matrix.os }})
      os: ${{ matrix.os }}
      needs-display: true
      rerun-with-debug: true
      run: >
        bazel test --flaky_test_attempts 2
        //java/test/org/openqa/selenium/chrome:ChromeDriverFunctionalTest-remote
        //java/test/org/openqa/selenium/federatedcredentialmanagement:FederatedCredentialManagementTest
        //java/test/org/openqa/selenium/firefox:FirefoxDriverBuilderTest
        //java/test/org/openqa/selenium/grid/router:RemoteWebDriverDownloadTest
        //java/test/org/openqa/selenium/remote:RemoteWebDriverBuilderTest
        //java/test/org/openqa/selenium/grid/router:RemoteWebDriverDownloadTest

  remote-tests:
    name: Remote Tests
    uses: ./.github/workflows/bazel.yml
    strategy:
      fail-fast: false
      matrix:
        include:
          - os: macos
    with:
      name: Remote Tests (chrome, ${{ matrix.os }})
      os: ${{ matrix.os }}
      needs-display: true
      rerun-with-debug: true
      run: >
        bazel test --flaky_test_attempts 2
        //java/test/org/openqa/selenium/chrome:ChromeDriverFunctionalTest-remote
