Skip to content

Instantly share code, notes, and snippets.

@juliandescottes
Created November 22, 2018 10:44
Show Gist options
  • Save juliandescottes/0047a7be7a7ef89ee7462fbbe6b13582 to your computer and use it in GitHub Desktop.
Save juliandescottes/0047a7be7a7ef89ee7462fbbe6b13582 to your computer and use it in GitHub Desktop.
diff --git a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_debug-target-pane_collapsibilities_interaction.js b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_debug-target-pane_collapsibilities_interaction.js
--- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_debug-target-pane_collapsibilities_interaction.js
+++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_debug-target-pane_collapsibilities_interaction.js
@@ -8,24 +8,27 @@
*/
add_task(async function() {
prepareCollapsibilitiesTest();
const { document, tab } = await openAboutDebugging();
for (const { title } of TARGET_PANES) {
- const debugTargetPaneEl = getDebugTargetPane(title, document);
+ let debugTargetPaneEl = getDebugTargetPane(title, document);
info("Check whether this pane is collapsed after clicking the title");
await toggleCollapsibility(debugTargetPaneEl);
+ debugTargetPaneEl = getDebugTargetPane(title, document);
+
assertCollapsibility(debugTargetPaneEl, title, true);
-
info("Check whether this pane is expanded after clicking the title again");
await toggleCollapsibility(debugTargetPaneEl);
+
+ debugTargetPaneEl = getDebugTargetPane(title, document);
assertCollapsibility(debugTargetPaneEl, title, false);
}
await removeTab(tab);
});
function assertCollapsibility(debugTargetPaneEl, title, shouldCollapsed) {
info("Check height of list");
diff --git a/devtools/client/aboutdebugging-new/test/browser/debug-target-pane_collapsibilities_head.js b/devtools/client/aboutdebugging-new/test/browser/debug-target-pane_collapsibilities_head.js
--- a/devtools/client/aboutdebugging-new/test/browser/debug-target-pane_collapsibilities_head.js
+++ b/devtools/client/aboutdebugging-new/test/browser/debug-target-pane_collapsibilities_head.js
@@ -29,17 +29,17 @@ const TARGET_PANES = [
title: "Other Workers",
pref: "devtools.aboutdebugging.collapsibilities.otherWorker",
},
];
// eslint-disable-next-line no-unused-vars
function getDebugTargetPane(title, document) {
for (const titleEl of document.querySelectorAll(".js-debug-target-pane-title")) {
- if (titleEl.textContent !== title) {
+ if (!titleEl.textContent.startsWith(title)) {
continue;
}
return titleEl.closest(".js-debug-target-pane");
}
return null;
}
@@ -51,17 +51,16 @@ function prepareCollapsibilitiesTest() {
Services.prefs.setBoolPref(pref, false);
}
}
// eslint-disable-next-line no-unused-vars
async function toggleCollapsibility(debugTargetPane) {
debugTargetPane.querySelector(".js-debug-target-pane-title").click();
// Wait for animation of collapse/expand.
- const animations = debugTargetPane.ownerDocument.getAnimations();
- await Promise.all(animations.map(animation => animation.finished));
+ await new Promise(r => setTimeout(r, 300));
}
registerCleanupFunction(() => {
for (const { pref } of TARGET_PANES) {
Services.prefs.clearUserPref(pref);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment