Files
sousa-gecko/devtools/startup/aboutdevtools/test/browser_aboutdevtools_enables_devtools.js
T
2018-03-12 14:41:48 +01:00

37 lines
1.3 KiB
JavaScript

/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/* eslint-env browser */
add_task(async function() {
pushPref("devtools.enabled", false);
let {tab, doc, win} = await openAboutDevTools();
let installPage = doc.getElementById("install-page");
let welcomePage = doc.getElementById("welcome-page");
info("Check that about:devtools is in the correct state with devtools.enabled=false");
ok(!installPage.hasAttribute("hidden"), "install screen is visible");
ok(welcomePage.hasAttribute("hidden"), "welcome screen is hidden");
info("Click on the install button to enable DevTools.");
let installButton = doc.getElementById("install");
EventUtils.synthesizeMouseAtCenter(installButton, {}, win);
info("Wait until the UI updates");
await waitUntil(() => installPage.hasAttribute("hidden") === true);
ok(!welcomePage.hasAttribute("hidden"), "welcome screen is visible");
ok(Services.prefs.getBoolPref("devtools.enabled"),
"The preference devtools.enabled has been flipped to true.");
// Flip the devtools.enabled preference back to false, otherwise the pushPref cleanup
// times out.
Services.prefs.setBoolPref("devtools.enabled", false);
await removeTab(tab);
});