Skip to content
Merged
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
29 changes: 21 additions & 8 deletions dwds/test/debug_extension_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,23 @@ final context = TestContext();
final devToolsLoadTime = const Duration(seconds: 4);

void main() async {
Future<void> waitForDartDevToolsWithRetry({
int retryCount = 6,
Duration retryWait = const Duration(seconds: 1),
}) async {
if (retryCount == 0) return;
var windows = await context.webDriver.windows.toList();
await context.webDriver.driver.switchTo.window(windows.last);
final title = await context.webDriver.title;
if (title == 'Dart DevTools') return;

await Future.delayed(retryWait);
return waitForDartDevToolsWithRetry(
retryCount: retryCount--,
retryWait: retryWait,
);
}

for (var useSse in [true, false]) {
group(useSse ? 'SSE' : 'WebSockets', () {
group('Without encoding', () {
Expand Down Expand Up @@ -76,11 +93,9 @@ void main() async {
await context.extensionConnection.sendCommand('Runtime.evaluate', {
'expression': 'fakeClick()',
});
await Future.delayed(devToolsLoadTime);
var windows = await context.webDriver.windows.toList();
await context.webDriver.driver.switchTo.window(windows.last);
await waitForDartDevToolsWithRetry();
expect(await context.webDriver.title, 'Dart DevTools');
}, skip: 'https://github.com/dart-lang/webdev/issues/1512');
});
});

group('With a sharded Dart app', () {
Expand Down Expand Up @@ -154,11 +169,9 @@ void main() async {
await context.extensionConnection.sendCommand('Runtime.evaluate', {
'expression': 'fakeClick()',
});
await Future.delayed(devToolsLoadTime);
var windows = await context.webDriver.windows.toList();
await context.webDriver.driver.switchTo.window(windows.last);
await waitForDartDevToolsWithRetry();
expect(await context.webDriver.title, 'Dart DevTools');
}, skip: 'https://github.com/dart-lang/webdev/issues/1512');
});
});
});
}
Expand Down