Skip to content

Run UI Tests

Run UI Tests #122

Workflow file for this run

# GitHub Actions Workflow for launching UI tests on Linux, Windows, and Mac in the following steps:
# - prepare and launch IDE with your plugin and robot-server plugin, which is needed to interact with UI
# - wait for IDE to start
# - run UI tests with separate Gradle task
#
# Please check https://github.com/JetBrains/intellij-ui-test-robot for information about UI tests with IntelliJ Platform
#
# Workflow is triggered manually.
name: Run UI Tests
on:
workflow_dispatch
jobs:
getPlugin:
name: Download the plugin
outputs:
path: ${{ steps.path.outputs.path }}
runs-on: ubuntu-latest
steps:
- uses: dawidd6/action-download-artifact@v2
with:
workflow: build.yml
commit: ${{ env.GITHUB_SHA }}
name: ".+[Ss]urveyor-\\d.+"
name_is_regexp: true
path: plugin-artifact
- name: Get full path
id: path
run: |
echo "path=$(find plugin-artifact/*/*.zip)" >> $GITHUB_OUTPUT
- name: Upload artifact for testUI
uses: actions/upload-artifact@v3
with:
name: plugin
path: plugin-artifact/*/*.zip
testUI:
runs-on: ${{ matrix.os }}
timeout-minutes: 60
needs: getPlugin
strategy:
fail-fast: false
matrix:
os: [ macos-13, ubuntu-latest, windows-latest ]
ideDate: # Up to 2 versions per year, initial major ver release date should be not older than a year
# - IC-LATEST_EAP # TODO: Run this variant weekly
- IC-2023.3.2 # released on 20.12.2023, major from 06.12.2023
- IC-2023.1.5 # released on 25.07.2023, major from 28.03.2023
- IC-2022.3.3 # released on 8.03.2023, major from 30.11.2022
# - PC-LATEST_EAP # TODO: Run this variant weekly
- PC-2023.3.2 # released on 20.12.2023, major from 06.12.2023
- PC-2023.1.4 # released on 13.07.2023, major from 30.03.2023
- PC-2022.3.3 # released on 10.03.2023, major from 01.12.2022
# Versions should match https://jb.gg/android-studio-releases-list.xml
include:
- os: ubuntu-latest
runTests: |
export DISPLAY=:99.0
Xvfb -ac :99 -screen 0 1920x1080x24 &
sleep 10
./gradlew :plugin-test:test
reportName: ui-tests-linux
- os: macos-13
runTests: |
./gradlew :plugin-test:test
reportName: ui-tests-mac
- os: windows-latest
runTests: ./gradlew :plugin-test:test
reportName: ui-tests-windows
env:
PLUGIN_PATH: "${{ github.workspace }}/${{ needs.getPlugin.outputs.path }}"
steps:
- uses: actions/github-script@v7
id: prepare-IDE_CODE
with:
script: return "${{ matrix.ideDate }}".split("-", 2)[0]
result-encoding: string
- uses: actions/github-script@v7
id: prepare-IDE_VERSION
with:
script: return "${{ matrix.ideDate }}".split("-", 2)[1]
result-encoding: string
- name: Setup FFmpeg via action
uses: FedericoCarboni/setup-ffmpeg@v2
with:
# Not strictly necessary, but it may prevent rate limit
# errors especially on GitHub-hosted macos machines.
token: ${{ secrets.GITHUB_TOKEN }}
# Uncomment when migrating to version 14
# - name: Install homebrew (for FFmpeg)
# uses: Homebrew/actions/setup-homebrew@e05416b42376bcda221f9102c4f595f4994016be
# if: ${{ startsWith(matrix.os, 'macos-') }}
# - name: Setup FFmpeg via homebrew
# if: ${{ startsWith(matrix.os, 'macos-') }}
# run: brew install ffmpeg
# Setup Java environment for the next steps
- name: Setup Java
uses: actions/setup-java@v4
env:
IDE_CODE: ${{ steps.prepare-IDE_CODE.outputs.result }}
IDE_VERSION: ${{ steps.prepare-IDE_VERSION.outputs.result }}
with:
distribution: zulu
java-version: 11
# Setup Gradle
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
env:
IDE_CODE: ${{ steps.prepare-IDE_CODE.outputs.result }}
IDE_VERSION: ${{ steps.prepare-IDE_VERSION.outputs.result }}
with:
gradle-home-cache-cleanup: true
# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v4
- name: Disable artifact verification
run: rm gradle/verification-metadata.xml
- uses: actions/download-artifact@v3
with:
name: plugin
path: plugin-artifact
# Run tests
- name: Tests
env:
IDE_CODE: ${{ steps.prepare-IDE_CODE.outputs.result }}
IDE_VERSION: ${{ steps.prepare-IDE_VERSION.outputs.result }}
run: ${{ matrix.runTests }}
# Collect Tests Result of failed tests
- name: Move screenshot files
if: ${{ always() }}
run: |
mv plugin-test/screenshot plugin-test/build/reports
- name: Move video files
if: ${{ always() }}
run: |
mv plugin-test/video plugin-test/build/reports
- name: Collect Tests Result
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.reportName }}-${{ matrix.ideDate }}
path: |
plugin-test/build/reports