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
13 changes: 13 additions & 0 deletions dwds/test/devtools_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ final context = TestContext(
path: 'append_body/index.html',
);

Future<void> _waitForPageReady(TestContext context) async {
var attempt = 100;
while (attempt-- > 0) {
var content = await context.webDriver.pageSource;
if (content.contains('Hello World!')) return;
await Future.delayed(const Duration(milliseconds: 100));
}
throw StateError('Page never initialized');
}

void main() {
group('Injected client', () {
setUp(() async {
Expand Down Expand Up @@ -47,6 +57,9 @@ void main() {
var devToolsWindow = windows[2];
await newAppWindow.setAsActive();

// Wait for the page to be ready before trying to open DevTools again.
await _waitForPageReady(context);

// Try to open devtools and check for the alert.
await context.webDriver.driver.keyboard.sendChord([Keyboard.alt, 'd']);
await Future.delayed(const Duration(seconds: 2));
Expand Down