Bug 1200896 - Force frame flushes when needed to fix browser pioneer test r=rhelmer

When a modal dialog is cancelled, the inertness for other elements
is reverted. However, in order to have the new state (non-inert)
effective, Firefox needs to do a frame flush. This flush is taken
place when it's really needed.

In browser_pioneer_us.js, we have some usage of some buttons when
the flush hasn't taken place yet, so the test fails because the
buttons are not clickable. To fix the test, we add a
getBoundingClientRect() call to force frame flushes to the
corresponding buttons.

Differential Revision: https://phabricator.services.mozilla.com/D86877
This commit is contained in:
Sean Feng 2020-08-13 19:05:37 +00:00
Родитель 3f16476b10
Коммит ab723a1ca1
1 изменённых файлов: 10 добавлений и 0 удалений

Просмотреть файл

@ -202,6 +202,13 @@ add_task(async function testAboutPage() {
"after cancelling enrollment, Pioneer is not enrolled."
);
// When a modal dialog is cancelled, the inertness for other elements
// is reverted. However, in order to have the new state (non-inert)
// effective, Firefox needs to do a frame flush. This flush is taken
// place when it's really needed.
// getBoundingClientRect forces a frame flush here to ensure the
// following click is going to work properly.
enrollmentButton.getBoundingClientRect();
enrollmentButton.click();
ok(dialog.open, "after retrying enrollment, consent dialog is open.");
@ -276,6 +283,9 @@ add_task(async function testAboutPage() {
"After canceling study enrollment, join button is enabled."
);
// Similar to the getBoundingClientRect call we did for
// enrollmentButton, we are forcing a frame flush here.
joinButton.getBoundingClientRect();
joinButton.click();
await waitForAnimationFrame();