From ab723a1ca15e3aa895b2ba9a4eabd17e4b396bcb Mon Sep 17 00:00:00 2001 From: Sean Feng Date: Thu, 13 Aug 2020 19:05:37 +0000 Subject: [PATCH] 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 --- .../pioneer/test/browser/browser_pioneer_ui.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/browser/components/pioneer/test/browser/browser_pioneer_ui.js b/browser/components/pioneer/test/browser/browser_pioneer_ui.js index dfe711ff86d3..a6f93116e415 100644 --- a/browser/components/pioneer/test/browser/browser_pioneer_ui.js +++ b/browser/components/pioneer/test/browser/browser_pioneer_ui.js @@ -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();