Skip to content

CharlVS is running UI tests on PR πŸš€ #30

CharlVS is running UI tests on PR πŸš€

CharlVS is running UI tests on PR πŸš€ #30

# Runs UI tests on PRs to ensure the app is working as expected
name: UI Integration tests on PR
run-name: ${{ github.actor }} is running UI tests on PR πŸš€
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
ui_tests:
name: Test ${{ matrix.name }}
runs-on: ${{ matrix.os }}
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
name: [web-app-linux-profile, web-app-macos]
include:
- name: web-app-linux-profile
os: [self-hosted, linux]
browser: chrome
display: "headless"
resolution: "1600,1024"
mode: profile
# memory_profile.json should be generated in profile mode
driver_logs: |
./*.log
./memory_profile.json
- name: web-app-macos
os: [self-hosted, macos]
browser: safari
display: "headless" # has no affect with safaridriver
resolution: "1600,1024" # has no affect with safaridriver
mode: release
driver_logs: |
./*.log
~/Library/Logs/com.apple.WebDriver/**/*.log
~/Library/Logs/com.apple.WebDriver/**/*.txt
steps:
- name: Setup GH Actions
uses: actions/checkout@v4
# Flutter integration test setup
- name: Install Chrome and chromedriver
if: ${{ matrix.browser == 'chrome' }}
uses: browser-actions/setup-chrome@v1
id: setup-chrome
with:
chrome-version: 116.0.5845.96
install-chromedriver: true
install-dependencies: true
- name: Enable safaridriver (sudo) (MacOS)
if: ${{ matrix.browser == 'safari' }}
timeout-minutes: 1
run: |
defaults write com.apple.Safari IncludeDevelopMenu YES
defaults write com.apple.Safari AllowRemoteAutomation 1
sudo /usr/bin/safaridriver --enable || echo "Failed to enable safaridriver!"
- name: Install Flutter and dependencies
uses: ./.github/actions/flutter-deps
- name: Fetch packages and generate assets
uses: ./.github/actions/generate-assets
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Validate build
uses: ./.github/actions/validate-build
# Run integration tests
- name: Test air_dex ${{ matrix.browser }}
id: integration-tests
continue-on-error: true
env:
GITHUB_API_PUBLIC_READONLY_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
dart run_integration_tests.dart \
-d ${{ matrix.display }} \
-b ${{ matrix.resolution }} \
-n ${{ matrix.browser }} \
-m ${{ matrix.mode }}
# Post-test steps (upload logs, coverage, and failure check)
- name: Upload driver logs
uses: actions/upload-artifact@v4
with:
name: ${{ runner.os }}-${{ matrix.browser }}-logs
path: ${{ matrix.driver_logs }}
if-no-files-found: warn
# TODO: re-enable once integration test coverage is fixed.
# there are errors related to Hive and other storage providers
# that will likely need to be mocked to support the new
# flutter integration test structure (flutter drive is deprecated)
# - name: Generate coverage report
# if: ${{ matrix.browser == 'chrome' }}
# continue-on-error: true
# uses: ./.github/actions/code-coverage
# with:
# test_file: 'test_integration'
- name: Fail workflow if tests failed
if: ${{ steps.integration-tests.outcome == 'failure' }}
run: exit 1