How to automate testing of Flutter application on Linux-Desktop via Github Actions CI

672 views Asked by At

We want to make our integration tests work on Linux desktop (ubuntu-latest) via Github Actions.

The command is

flutter config --enable-linux-desktop
flutter test -d linux integration_test

But we always get an error:

Error waiting for a debug connection: The log reader stopped unexpectedly, or never started.
//...
TestDeviceException(Unable to start the app on the device.)
  package:flutter_tools/src/test/integration_test_device.dart 61:7  IntegrationTestTestDevice.start

Can Github Actions not handle the GPU / GUI related stuff fast enough on the CPU or what is going on. Is this even possible? I found only one repository which call similar command for a linux environment.

Thanks!

3

There are 3 answers

0
User Rebo On BEST ANSWER

I saw this question, where Xvfb was mentioned in an answer, it worked:

jobs:
  linux:
    runs-on: ubuntu-latest
    ...
    steps:
        run: |
          export DISPLAY=:99
          sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 &
          flutter test -d linux integration_test
0
Hrishikesh Kadam On

This was enough for me -

xvfb-run flutter test -d linux integration_test

xvfb is pre-installed on Ubuntu 22.04 Runner Image.

Credits -

  1. FrBrGeorge's answer to another question
0
pubkey On

I am using the GabrielBB/[email protected] github action to enable xvfb.

      - name: flutter test
        uses: GabrielBB/[email protected]
        with:
          working-directory: ./examples/flutter
          run: |
            flutter config --enable-linux-desktop
            flutter test integration_test/basics_test.dart -d linux