website icon indicating copy to clipboard operation
website copied to clipboard

Flutter Integration Step in Build Pipeline Failing

Open Sushant2171993 opened this issue 1 year ago • 2 comments

Page URL

https://docs.flutter.dev/testing/integration-tests/

Page source

https://github.com/flutter/website/tree/main/src/content/testing/integration-tests/index.md

Describe the problem

Hi Team,

I'm encountering issues with the integration step in our build pipeline for Flutter applications, which has been running smoothly for the past few months but has recently stopped working. Below is the relevant configuration and script details:

Build Pipeline Configuration:

  • task: ShellScript@2 displayName: Integration Tests condition: eq(${{parameters.runTests}}, True) inputs: scriptPath: 'distribution/ado/test_container/run-integration-tests.sh' disableAutoCwd: true

ChromeDriver Installation Script:

#!/bin/bash set -e

Fetch the latest stable ChromeDriver version

CHROMEDRIVER_VERSION=$(curl -sS https://googlechromelabs.github.io/chrome-for-testing/LATEST_RELEASE_STABLE)

echo "Installing ChromeDriver version: $CHROMEDRIVER_VERSION"

CHROMEDRIVER_DIR=/usr/local/bin

Download and install ChromeDriver (for versions 115 and newer)

npx @puppeteer/browsers install chromedriver@$CHROMEDRIVER_VERSION

cp chromedriver/mac-$CHROMEDRIVER_VERSION/chromedriver-mac-x64/chromedriver $CHROMEDRIVER_DIR/. chmod 755 $CHROMEDRIVER_DIR/chromedriver rm -rf chromedriver/

echo "ChromeDriver installed successfully."

Integration Test Runner Script:

#!/bin/bash set -e

Install ChromeDriver

sh ./distribution/ado/test_container/install-chrome-driver.sh

Launch ChromeDriver

chromedriver --port=4444 & CHDR_PID=$!

directoriesToRunTests=("applications")

for directory in "${directoriesToRunTests[@]}" do
cd "$directory" for subDirectory in */ do
cd "$subDirectory"

# Run tests if integration_test directory exists
if [ -d "./integration_test" ]; then
  echo "Running integration tests for: $directory/$subDirectory"
  
  for testFile in $(find integration_test -type f -name '*_test.dart'); do
    $FLUTTER drive --driver=test_driver/integration_test.dart --target=$testFile -d web-server
  done
fi

cd ..

done cd .. done kill $CHDR_PID

Error Logs:

integration_test/daily_deals_test.dart is being served at http://localhost:49327 Unhandled exception: DriverError: Error while reading FlutterDriver result for command: window.$flutterDriver('{"command":"request_data","timeout":"1200000"}') Original error: Exception: Expected: not null Actual: ... The STDIO streams did not close within 10 seconds of the exit event from process '/bin/bash'. This may indicate a child process inherited the STDIO streams and has not yet exited. ##[error]Bash exited with code '1'. Finishing: Run Integration test for the changes

The integration tests were working fine until recently. Now, I’m seeing the DriverError and STDIO streams did not close within 10 seconds errors, causing the pipeline to fail. Could you please advise on the best way to resolve this issue?

There is similar issue open - https://github.com/flutter/flutter/issues/148982

Any insights or suggestions would be greatly appreciated asap.

Expected fix

No response

Additional context

No response

I would like to fix this problem.

  • [ ] I will try and fix this problem on docs.flutter.dev.

Sushant2171993 avatar Sep 09 '24 23:09 Sushant2171993