summaryrefslogtreecommitdiffstats
path: root/devtools/client/aboutdebugging/test/browser/helper-collapsibilities.js
diff options
context:
space:
mode:
Diffstat (limited to 'devtools/client/aboutdebugging/test/browser/helper-collapsibilities.js')
-rw-r--r--devtools/client/aboutdebugging/test/browser/helper-collapsibilities.js54
1 files changed, 54 insertions, 0 deletions
diff --git a/devtools/client/aboutdebugging/test/browser/helper-collapsibilities.js b/devtools/client/aboutdebugging/test/browser/helper-collapsibilities.js
new file mode 100644
index 0000000000..0f0d28da1d
--- /dev/null
+++ b/devtools/client/aboutdebugging/test/browser/helper-collapsibilities.js
@@ -0,0 +1,54 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+const TARGET_PANES = [
+ {
+ title: "Temporary Extensions",
+ pref: "devtools.aboutdebugging.collapsibilities.temporaryExtension",
+ },
+ {
+ title: "Extensions",
+ pref: "devtools.aboutdebugging.collapsibilities.installedExtension",
+ },
+ {
+ title: "Tabs",
+ pref: "devtools.aboutdebugging.collapsibilities.tab",
+ },
+ {
+ title: "Service Workers",
+ pref: "devtools.aboutdebugging.collapsibilities.serviceWorker",
+ },
+ {
+ title: "Shared Workers",
+ pref: "devtools.aboutdebugging.collapsibilities.sharedWorker",
+ },
+ {
+ title: "Other Workers",
+ pref: "devtools.aboutdebugging.collapsibilities.otherWorker",
+ },
+];
+/* exported TARGET_PANES */
+
+function prepareCollapsibilitiesTest() {
+ // Make all collapsibilities to be expanded.
+ for (const { pref } of TARGET_PANES) {
+ Services.prefs.setBoolPref(pref, false);
+ }
+}
+/* exported prepareCollapsibilitiesTest */
+
+async function toggleCollapsibility(debugTargetPane) {
+ debugTargetPane.querySelector(".qa-debug-target-pane-title").click();
+ // Wait for animation of collapse/expand.
+ const animations = debugTargetPane.ownerDocument.getAnimations();
+ await Promise.all(animations.map(animation => animation.finished));
+}
+/* exported toggleCollapsibility */
+
+registerCleanupFunction(() => {
+ for (const { pref } of TARGET_PANES) {
+ Services.prefs.clearUserPref(pref);
+ }
+});