fune/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_thisfirefox.js
Julian Descottes 7efda3d02e Bug 1487581 - Stop using hardcoded Firefox string in aboutdebugging;r=flod,ladybenko
Depends on D23879

Differential Revision: https://phabricator.services.mozilla.com/D23907

--HG--
extra : moz-landing-system : lando
2019-03-20 18:08:36 +00:00

46 lines
1.6 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/**
* Check that the This Firefox page is displayed by default when opening the new
* about:debugging and that it contains the expected categories.
*/
const EXPECTED_TARGET_PANES = [
"Temporary Extensions",
"Extensions",
"Tabs",
"Service Workers",
"Shared Workers",
"Other Workers",
];
add_task(async function() {
const { document, tab, window } = await openAboutDebugging();
await selectThisFirefoxPage(document, window.AboutDebugging.store);
// Check that the selected sidebar item is "This Firefox"/"This Nightly"/...
const selectedSidebarItem = document.querySelector(".js-sidebar-item-selected");
ok(selectedSidebarItem, "An item is selected in the sidebar");
const thisFirefoxString = getThisFirefoxString(window);
is(selectedSidebarItem.textContent, thisFirefoxString,
"The selected sidebar item is " + thisFirefoxString);
const paneTitlesEls = document.querySelectorAll(".js-debug-target-pane-title");
is(paneTitlesEls.length, EXPECTED_TARGET_PANES.length,
"This Firefox has the expecte number of debug target categories");
const paneTitles = [...paneTitlesEls].map(el => el.textContent);
for (let i = 0; i < EXPECTED_TARGET_PANES.length; i++) {
const expectedPaneTitle = EXPECTED_TARGET_PANES[i];
const actualPaneTitle = paneTitles[i];
ok(actualPaneTitle.startsWith(expectedPaneTitle),
`Expected debug target category found: ${ expectedPaneTitle }`);
}
await removeTab(tab);
});