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

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!



Solution 1:[1]

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 User Rebo