forked from mozilla/gecko-dev
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1767702 - [devtools] Split browser_dbg-features-source-tree.js an…
…d re-enable it. r=bomsy Let move Browser Toolbox checks in a distinct file as it can get flaky. Differential Revision: https://phabricator.services.mozilla.com/D149417
- Loading branch information
Showing
4 changed files
with
128 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
devtools/client/debugger/test/mochitest/browser_dbg-features-browser-toolbox-source-tree.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */ | ||
|
||
/** | ||
* This test focuses on the SourceTree component, within the browser toolbox. | ||
*/ | ||
|
||
"use strict"; | ||
|
||
requestLongerTimeout(2); | ||
|
||
/* import-globals-from ../../../framework/browser-toolbox/test/helpers-browser-toolbox.js */ | ||
Services.scriptloader.loadSubScript( | ||
"chrome://mochitests/content/browser/devtools/client/framework/browser-toolbox/test/helpers-browser-toolbox.js", | ||
this | ||
); | ||
|
||
// Test that the Web extension name is shown in source tree rather than | ||
// the extensions internal UUID. This checks both the web toolbox and the | ||
// browser toolbox. | ||
add_task(async function testSourceTreeNamesForWebExtensions() { | ||
await pushPref("devtools.chrome.enabled", true); | ||
await pushPref("devtools.browsertoolbox.fission", true); | ||
const extension = await installAndStartContentScriptExtension(); | ||
|
||
const dbg = await initDebugger("doc-content-script-sources.html"); | ||
await waitForSourcesInSourceTree(dbg, [], { | ||
noExpand: true, | ||
}); | ||
|
||
is( | ||
getSourceTreeLabel(dbg, 2), | ||
"Test content script extension", | ||
"Test content script extension is labeled properly" | ||
); | ||
|
||
await dbg.toolbox.closeToolbox(); | ||
await extension.unload(); | ||
|
||
// Make sure the toolbox opens with the debugger selected. | ||
await pushPref("devtools.browsertoolbox.panel", "jsdebugger"); | ||
|
||
const ToolboxTask = await initBrowserToolboxTask(); | ||
await ToolboxTask.importFunctions({ | ||
createDebuggerContext, | ||
waitUntil, | ||
findSourceNodeWithText, | ||
findAllElements, | ||
getSelector, | ||
findAllElementsWithSelector, | ||
assertSourceTreeNode, | ||
}); | ||
|
||
await ToolboxTask.spawn(selectors, async _selectors => { | ||
this.selectors = _selectors; | ||
}); | ||
|
||
await ToolboxTask.spawn(null, async () => { | ||
try { | ||
/* global gToolbox */ | ||
// Wait for the debugger to finish loading. | ||
await gToolbox.getPanelWhenReady("jsdebugger"); | ||
const dbgx = createDebuggerContext(gToolbox); | ||
let rootNodeForExtensions = null; | ||
await waitUntil(() => { | ||
rootNodeForExtensions = findSourceNodeWithText(dbgx, "extension"); | ||
return !!rootNodeForExtensions; | ||
}); | ||
// Find the root node for extensions and expand it if needed | ||
if ( | ||
!!rootNodeForExtensions && | ||
!rootNodeForExtensions.querySelector(".arrow.expanded") | ||
) { | ||
rootNodeForExtensions.querySelector(".arrow").click(); | ||
} | ||
|
||
// Assert that extensions are displayed in the source tree | ||
// with their extension name. | ||
await assertSourceTreeNode(dbgx, "Picture-In-Picture"); | ||
await assertSourceTreeNode(dbgx, "Form Autofill"); | ||
} catch (e) { | ||
console.log("Caught exception in spawn", e); | ||
throw e; | ||
} | ||
}); | ||
|
||
await ToolboxTask.destroy(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters