LibWeb+WebContent+WebDriver: Asynchronously wait for dialog dismissal

There was a timing issue here where WebDriver would dismiss a dialog,
and then invoke another endpoint before the dialog was actually closed.
This is because the dismissal first has to hop over to the UI process to
close the graphical dialog, which then asynchronously informs WebContent
of the result. It's not until WebContent receives that result that the
dialog is considered closed, thus those subsequent endpoints would abort
due a dialog being "open".

We now wait for dialogs to be fully closed before returning from the
dismissal endpoints.
This commit is contained in:
Timothy Flynn 2024-10-25 12:31:07 -04:00 committed by Andreas Kling
commit 0722a3b1c0
Notes: github-actions[bot] 2024-10-26 09:26:38 +00:00
9 changed files with 60 additions and 14 deletions

View file

@ -243,4 +243,18 @@ Web::WebDriver::Response Session::perform_actions(JsonValue payload) const
});
}
Web::WebDriver::Response Session::dismiss_alert() const
{
return perform_async_action(web_content_connection().on_dialog_closed, [&]() {
return web_content_connection().dismiss_alert();
});
}
Web::WebDriver::Response Session::accept_alert() const
{
return perform_async_action(web_content_connection().on_dialog_closed, [&]() {
return web_content_connection().accept_alert();
});
}
}