diff --git a/.github/actions/install-chrome/action.yml b/.github/actions/install-chrome/action.yml new file mode 100644 index 00000000000..dfe17ed0674 --- /dev/null +++ b/.github/actions/install-chrome/action.yml @@ -0,0 +1,38 @@ +name: Install Chrome browser and driver for Testing +description: Download and install the latest available Chrome for Testing and Chromedriver + +runs: + using: composite + steps: + - id: cache-chrome-browser + name: Chrome browser cache + uses: actions/cache@v3 + with: + path: ./chrome + key: chrome + + - id: cache-chromedriver + name: Chrome driver cache + uses: actions/cache@v3 + with: + path: ./chromedriver + key: chromedriver + + - id: install-chrome + name: Install Chrome + shell: bash + run: | + sudo apt-get remove google-chrome-stable + npx @puppeteer/browsers install chrome + npx @puppeteer/browsers install chromedriver + # In case there's more than one version of each package, let's use only the latest + LATEST_CHROME=$(ls -td $PWD/chrome/*/ | head -1) + LATEST_CHROMEDRIVER=$(ls -td $PWD/chromedriver/*/ | head -1) + sudo ln -s -f "${LATEST_CHROME}chrome-linux64/chrome" /usr/bin/chrome + sudo cp -u "${LATEST_CHROMEDRIVER}chromedriver-linux64/chromedriver" $CHROMEWEBDRIVER/ + # Remove any older version of browser or driver so we don't keep it in the cache + cd chrome + rm -R $(ls -lt | grep '^d' | tail -1 | tr " " "\n" | tail -1) + cd ../chromedriver + rm -R $(ls -lt | grep '^d' | tail -1 | tr " " "\n" | tail -1) + cd .. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 256db62a260..a3c64206fb9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -428,6 +428,11 @@ jobs: name: Integration test setup uses: ./.github/actions/integration-test-setup + - id: install-chrome + name: Install Chrome browser + uses: ./.github/actions/install-chrome + if: matrix.browser == 'chrome' + - name: Run Account Console IT run: ./mvnw test ${{ env.SUREFIRE_RETRY }} -Pauth-server-quarkus -Dtest=**.account2.**,!SigningInTest#passwordlessWebAuthnTest,!SigningInTest#twoFactorWebAuthnTest -Dbrowser=${{ matrix.browser }} "-Dwebdriver.chrome.driver=$CHROMEWEBDRIVER/chromedriver" "-Dwebdriver.gecko.driver=$GECKOWEBDRIVER/geckodriver" -f testsuite/integration-arquillian/tests/other/base-ui/pom.xml | misc/log/trimmer.sh @@ -458,6 +463,11 @@ jobs: name: Integration test setup uses: ./.github/actions/integration-test-setup + - id: install-chrome + name: Install Chrome browser + uses: ./.github/actions/install-chrome + if: matrix.browser == 'chrome' + - name: Run Forms IT run: | TESTS=`testsuite/integration-arquillian/tests/base/testsuites/suite.sh forms` @@ -493,6 +503,12 @@ jobs: name: Integration test setup uses: ./.github/actions/integration-test-setup + # Don't use Chrome for testing (just regular Chrome) until https://bugs.chromium.org/p/chromedriver/issues/detail?id=4533 is resolved + #- id: install-chrome + # name: Install Chrome browser + # uses: ./.github/actions/install-chrome + # if: matrix.browser == 'chrome' + - name: Run WebAuthn IT run: ./mvnw test ${{ env.SUREFIRE_RETRY }} -Pauth-server-quarkus -Dtest=org.keycloak.testsuite.webauthn.**.*Test -Dbrowser=${{ matrix.browser }} "-Dwebdriver.chrome.driver=$CHROMEWEBDRIVER/chromedriver" "-Dwebdriver.gecko.driver=$GECKOWEBDRIVER/geckodriver" -Pwebauthn -f testsuite/integration-arquillian/tests/other/pom.xml | misc/log/trimmer.sh