Bug 1701173, wait for notificationbars to close more reliably by waiting for the notification node to be removed, r=mconley

Differential Revision: https://phabricator.services.mozilla.com/D110000
This commit is contained in:
Neil Deakin 2021-03-29 18:58:26 +00:00
parent 2d3955cf38
commit 0f2a4484d4

View File

@ -174,22 +174,23 @@ async function testFrameCrash(numTabs) {
// Press the ignore button on the visible notification.
let notificationBox = gBrowser.getNotificationBox(gBrowser.selectedBrowser);
let notification = notificationBox.currentNotification;
notification.dismiss();
// Make sure all of the notifications were closed when one of them was closed.
let closedPromises = [];
for (let count = 1; count <= numTabs; count++) {
let nb = gBrowser.getNotificationBox(gBrowser.browsers[count]);
await TestUtils.waitForCondition(
() => !nb.currentNotification,
"notification closed"
);
ok(
!nb.currentNotification,
"notification " + count + " closed when dismiss button is pressed"
closedPromises.push(
BrowserTestUtils.waitForMutationCondition(
nb.stack,
{ childList: true },
() => !nb.currentNotification
)
);
}
notification.dismiss();
await Promise.all(closedPromises);
for (let count = 1; count <= numTabs; count++) {
BrowserTestUtils.removeTab(gBrowser.selectedTab);
}