Reputation: 859
We have a job set up in Github Actions to run the flutter integration tests, however once the tests apparently start to run, they hang on forever, after 20 something minutes I get this output
DriverError: Error while reading FlutterDriver result for command: window.$flutterDriver('{"command":"request_data","timeout":"1200000"}')
Original error: Exception: Expected: not null
Actual: <null>
Original stack trace:
#0 _matcherExpect (package:webdriver/support/async.dart:92:3)
#1 Clock.waitFor (package:webdriver/support/async.dart:60:11)
<asynchronous suspension>
#2 FlutterWebConnection.sendCommand (package:flutter_driver/src/driver/web_driver.dart:327:30)
<asynchronous suspension>
#3 WebFlutterDriver.sendCommand (package:flutter_driver/src/driver/web_driver.dart:123:14)
<asynchronous suspension>
#4 FlutterDriver.requestData (package:flutter_driver/src/driver/driver.dart:549:39)
<asynchronous suspension>
#5 integrationDriver (package:integration_test/integration_test_driver.dart:80:29)
<asynchronous suspension>
the set up is pretty simple
name: Flutter Integration Tests
on:
pull_request:
branches:
- '*'
jobs:
run-tests:
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Create secrets config file
run: |
touch secrets.json && echo ${{ secrets.SECRETS_JSON }} | base64 -d > secrets.json
- name: Cache Chromedriver
uses: actions/cache@v4
with:
path: /usr/local/bin/chromedriver
key: chromedriver-${{ runner.os }}-v123
- name: install chromedriver
uses: nanasess/setup-chromedriver@v2
with:
# Optional: do not specify to match Chrome's version
chromedriver-version: '124.0.6367.60'
- name: Run chrome driver
run: |
chromedriver --version
chromedriver --port=4444 &
- name: Setup Flutter SDK
uses: flutter-actions/setup-flutter@v3
with:
channel: stable
version: 3.19.0
- run: which flutter
- name: flutter steps
run: |
dart pub global activate flutter_cors
fluttercors --disable
flutter config --enable-web
flutter pub get
- name: Run Tests with Chrome
run: |
flutter drive \
--driver=test_driver/integration_test.dart \
--target=integration_test/main_test.dart \
--dart-define=E2E_TESTS=true \
--dart-define-from-file="secrets.json" \
-d web-server \
--browser-name=chrome \
--web-browser-flag="--no-sandbox" \
--web-browser-flag="--disable-audio-input" \
--web-browser-flag="--use-fake-device-for-media-stream" \
--web-browser-flag="--use-fake-ui-for-media-stream" \
--web-browser-flag="--use-file-for-fake-audio-capture=test/testing_audio.wav"
When I run this locally It runs without any problem, completing the tests successfully, why is this happening in the host machine? has anyone had similar issues? Thanks in advance
this is the test for reference:
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:scribe/components/buttons.dart';
import 'package:scribe/main.dart' as app;
void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
const String automationPassword =
String.fromEnvironment('AUTOMATION_PWD', defaultValue: "");
String generateRandomSuffix(int length) {
const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
final random = Random();
return String.fromCharCodes(Iterable.generate(
length, (_) => chars.codeUnitAt(random.nextInt(chars.length))));
}
void disableOverflowErrors() {
FlutterError.onError = (FlutterErrorDetails details) {
final exception = details.exception;
final isOverflowError = exception is FlutterError &&
!exception.diagnostics.any((e) =>
e.value.toString().startsWith("A RenderFlex overflowed by"));
if (isOverflowError) {
print(details);
} else {
FlutterError.presentError(details);
}
};
}
Future<void> desktopLoginFlow(WidgetTester tester) async {
final toggleButton = find.byKey(const ValueKey('desktop_login_button'));
await tester.tap(toggleButton);
await tester.pumpAndSettle();
final emailInput = find.byKey(const ValueKey('email_input'));
await tester.enterText(emailInput, "[email protected]");
final passwordInput = find.byKey(const ValueKey('password_input'));
await tester.enterText(passwordInput, automationPassword);
final confirmLoginButton = find.descendant(
of: find.byKey(const ValueKey('confirm_login_button')),
matching: find.byType(InkWell),
);
await tester.tap(confirmLoginButton);
await tester.pumpAndSettle(const Duration(seconds: 2));
expect(find.text("Start recording"), findsOne);
}
testWidgets("Create main Scribe recording", (WidgetTester tester) async {
disableOverflowErrors();
app.main();
// Trigger a frame.
await tester.pumpAndSettle();
expect(find.text('Login'), findsOne);
await desktopLoginFlow(tester);
});
}
Upvotes: 2
Views: 78