Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 21 additions & 6 deletions dwds/test/fixtures/context.dart
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,6 @@ class TestContext {
'--port=$chromeDriverPort',
'--url-base=$chromeDriverUrlBase',
]);
// On windows this takes a while to boot up, wait for the first line
// of stdout as a signal that it is ready.
final stdOutLines =
chromeDriver.stdout
.transform(utf8.decoder)
Expand All @@ -194,14 +192,31 @@ class TestContext {
.transform(const LineSplitter())
.asBroadcastStream();

stdOutLines.listen(
(line) => _logger.finest('ChromeDriver stdout: $line'),
);
// Sometimes ChromeDriver can be slow to startup.
// This was seen on a github actions run:
// > 11:22:59.924700: ChromeDriver stdout: Starting ChromeDriver
// > 139.0.7258.154 ([...]) on port 38107
// > [...]
// > 11:23:00.237350: ChromeDriver stdout: ChromeDriver was started
// > successfully on port 38107.
// Where in the 300+ ms it took before it was actually ready to accept
// a connection we had tried - and failed - to connect.
// We therefore wait until ChromeDriver reports that it has started
// successfully.

final chromeDriverStartup = Completer();
stdOutLines.listen((line) {
if (!chromeDriverStartup.isCompleted &&
line.contains('was started successfully')) {
chromeDriverStartup.complete();
}
_logger.finest('ChromeDriver stdout: $line');
});
stdErrLines.listen(
(line) => _logger.warning('ChromeDriver stderr: $line'),
);

await stdOutLines.first;
await chromeDriverStartup.future;
} catch (e) {
throw StateError(
'Could not start ChromeDriver. Is it installed?\nError: $e',
Expand Down
4 changes: 2 additions & 2 deletions dwds/test/hot_restart_breakpoints_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void main() {
late Stream<Event> stream;
// Fetch the log statements that are sent to console.
final consoleLogs = <String>[];
late StreamSubscription<ConsoleAPIEvent> consoleSubscription;
StreamSubscription<ConsoleAPIEvent>? consoleSubscription;

setUp(() async {
setCurrentLogWriter(debug: debug);
Expand All @@ -71,7 +71,7 @@ void main() {
});

tearDown(() async {
await consoleSubscription.cancel();
await consoleSubscription?.cancel();
consoleLogs.clear();
await context.tearDown();
});
Expand Down
Loading