Bug 1520693 - Add test for the About Dialog policyDisabled panel. r=Felipe
authorRobert Strong <robert.bugzilla@gmail.com>
Mon, 21 Jan 2019 15:50:17 -0800
changeset 514780 d94203c1f6b52716801969622868a56361af7cb5
parent 514779 754481bfbe992e8754ce9af79b5a33f9412d186f
child 514781 956bd26eec5a9174753b63931d1a927a59cd4716
child 514786 8ad35cea96d9c6c64c7f6c5e9e8f57a6b04f161a
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersFelipe
bugs1520693
milestone66.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 1520693 - Add test for the About Dialog policyDisabled panel. r=Felipe
browser/components/enterprisepolicies/tests/browser/disable_app_update/browser_policy_disable_app_update.js
--- a/browser/components/enterprisepolicies/tests/browser/disable_app_update/browser_policy_disable_app_update.js
+++ b/browser/components/enterprisepolicies/tests/browser/disable_app_update/browser_policy_disable_app_update.js
@@ -19,8 +19,52 @@ add_task(async function test_update_pref
   await ContentTask.spawn(tab.linkedBrowser, null, async function() {
     let updateRadioGroup = content.document.getElementById("updateRadioGroup");
     is(updateRadioGroup.hidden, true,
        "Update choices should be diabled when app update is locked by policy");
   });
 
   BrowserTestUtils.removeTab(tab);
 });
+
+add_task(async function test_update_about_ui() {
+  let aboutDialog = await waitForAboutDialog();
+  let panelId = "policyDisabled";
+
+  await BrowserTestUtils.waitForCondition(() =>
+    (aboutDialog.document.getElementById("updateDeck").selectedPanel &&
+     aboutDialog.document.getElementById("updateDeck").selectedPanel.id == panelId),
+    "Waiting for expected panel ID - expected \"" + panelId + "\"");
+  is(aboutDialog.document.getElementById("updateDeck").selectedPanel.id, panelId,
+     "The About Dialog panel Id should equal " + panelId);
+
+  aboutDialog.close();
+});
+
+/**
+ * Waits for the About Dialog to load.
+ *
+ * @return A promise that returns the domWindow for the About Dialog and
+ *         resolves when the About Dialog loads.
+ */
+function waitForAboutDialog() {
+  return new Promise(resolve => {
+    var listener = {
+      onOpenWindow: aXULWindow => {
+        Services.wm.removeListener(listener);
+
+         async function aboutDialogOnLoad() {
+          domwindow.removeEventListener("load", aboutDialogOnLoad, true);
+          let chromeURI = "chrome://browser/content/aboutDialog.xul";
+          is(domwindow.document.location.href, chromeURI, "About dialog appeared");
+          resolve(domwindow);
+        }
+
+        var domwindow = aXULWindow.docShell.domWindow;
+        domwindow.addEventListener("load", aboutDialogOnLoad, true);
+      },
+      onCloseWindow: aXULWindow => {},
+    };
+
+    Services.wm.addListener(listener);
+    openAboutDialog();
+  });
+}