Bug 1441376 - Stop the Syncing animation manually in browser_remote_tabs_button.js test. r=Paolo
authorEdouard Oger <eoger@fastmail.com>
Fri, 09 Mar 2018 16:03:48 -0500
changeset 407808 39b4ff73882ca7e6368347da67454cdd37b13a97
parent 407807 7ce340e02ccca784a9e848cfbd3d6957a583355b
child 407809 22799a03347149a6e2449ac8662c021ebfb8bbca
push id61057
push usereoger@mozilla.com
push dateTue, 13 Mar 2018 14:07:40 +0000
treeherderautoland@39b4ff73882c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersPaolo
bugs1441376
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1441376 - Stop the Syncing animation manually in browser_remote_tabs_button.js test. r=Paolo The UIState.ON_UPDATE notification should be enough to reset the state of the panel every time the test is about to be executed. Wrong. In response to this notification, gSync.onActivityStop() is called, which disables the syncing animation immediately ONLY if it has been running for at least 1.5sec (which is almost never happening in tests), otherwise we get a setTimeout with the remaining time. When the sync animation is running, we also do not react to clicks (disabled), hence the test failing. We fix this by stopping the animation ourselves manually at the end of the test, so any subsequent test will start with a correct UI state. MozReview-Commit-ID: CrEb82Tw5SO
browser/components/customizableui/test/browser_remote_tabs_button.js
--- a/browser/components/customizableui/test/browser_remote_tabs_button.js
+++ b/browser/components/customizableui/test/browser_remote_tabs_button.js
@@ -41,16 +41,20 @@ add_task(async function testSyncRemoteTa
   ok(remoteTabsPanel.getAttribute("visible"), "Sync Panel is in view");
 
   // Find and click the "setup" button.
   let syncNowButton = document.getElementById("PanelUI-remotetabs-syncnow");
   syncNowButton.click();
   info("The sync now button was clicked");
 
   await waitForCondition(() => syncWasCalled);
+
+  // We need to stop the Syncing animation manually otherwise the button
+  // will be disabled at the beginning of a next test.
+  gSync._onActivityStop();
 });
 
 add_task(async function asyncCleanup() {
   // reset the panel UI to the default state
   await resetCustomization();
   ok(CustomizableUI.inDefaultState, "The panel UI is in default state again.");
 
   if (isOverflowOpen()) {
@@ -64,20 +68,20 @@ add_task(async function asyncCleanup() {
 
 function mockFunctions() {
   // mock UIState.get()
   UIState.get = () => ({
     status: UIState.STATUS_SIGNED_IN,
     email: "user@mozilla.com"
   });
 
-  service.sync = mocked_syncAndReportErrors;
+  service.sync = mocked_sync;
 }
 
-function mocked_syncAndReportErrors() {
+function mocked_sync() {
   syncWasCalled = true;
 }
 
 function restoreValues() {
   UIState.get = getState;
   service.sync = originalSync;
 }