Bug 1455496 - Part 2. Add test of existence of scratchpad's menu bar. r=jdescottes
authorMantaroh Yoshinaga <mantaroh@gmail.com>
Mon, 23 Apr 2018 09:26:15 +0900
changeset 468557 997646442b819b521f25e79020e22cdc5f6fe324
parent 468556 dd464b3666b155e8b1dda1d7652db27a3e64f9ba
child 468558 4ac461885d8c424010d4e442e649d06acb9d2d60
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdescottes
bugs1455496
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 1455496 - Part 2. Add test of existence of scratchpad's menu bar. r=jdescottes
devtools/client/scratchpad/test/browser.ini
devtools/client/scratchpad/test/browser_scratchpad_menubar.js
--- a/devtools/client/scratchpad/test/browser.ini
+++ b/devtools/client/scratchpad/test/browser.ini
@@ -40,8 +40,9 @@ support-files = NS_ERROR_ILLEGAL_INPUT.t
 [browser_scratchpad_pprint.js]
 [browser_scratchpad_pprint_error_goto_line.js]
 [browser_scratchpad_restore.js]
 [browser_scratchpad_tab_switch.js]
 [browser_scratchpad_ui.js]
 [browser_scratchpad_close_toolbox.js]
 [browser_scratchpad_remember_view_options.js]
 [browser_scratchpad_disable_view_menu_items.js]
+[browser_scratchpad_menubar.js]
new file mode 100644
--- /dev/null
+++ b/devtools/client/scratchpad/test/browser_scratchpad_menubar.js
@@ -0,0 +1,36 @@
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+// Sanity test that menu bar is displayed. If open the scratchpad as toolbox panel,
+// this menu should be hidden.
+
+var {TargetFactory} = require("devtools/client/framework/target");
+
+add_task(async function() {
+  // Now open the scratchpad as window.
+  info("Test existence of menu bar of scratchpad.");
+  const options = {
+    tabContent: "Sanity test for scratchpad panel."
+  };
+
+  info("Open scratchpad.");
+  let [win] = await openTabAndScratchpad(options);
+
+  let menuToolbar = win.document.getElementById("sp-menu-toolbar");
+  ok(menuToolbar, "The scratchpad should have a menu bar.");
+});
+
+add_task(async function() {
+  // Now open the scratchpad panel after setting visibility preference.
+  info("Test existence of menu bar of scratchpad panel.");
+  await new Promise(resolve => {
+    SpecialPowers.pushPrefEnv({"set": [["devtools.scratchpad.enabled", true]]}, resolve);
+  });
+
+  info("Open devtools on the Scratchpad.");
+  let target = TargetFactory.forTab(gBrowser.selectedTab);
+  let toolbox = await gDevTools.showToolbox(target, "scratchpad");
+
+  let menuToolbar = toolbox.doc.getElementById("sp-menu-toolbar");
+  ok(!menuToolbar, "The scratchpad panel should not have a menu bar.");
+});