diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /devtools/client/aboutdebugging/test/browser/browser_aboutdebugging_debug-target-pane_collapsibilities_interaction.js | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/client/aboutdebugging/test/browser/browser_aboutdebugging_debug-target-pane_collapsibilities_interaction.js')
-rw-r--r-- | devtools/client/aboutdebugging/test/browser/browser_aboutdebugging_debug-target-pane_collapsibilities_interaction.js | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/devtools/client/aboutdebugging/test/browser/browser_aboutdebugging_debug-target-pane_collapsibilities_interaction.js b/devtools/client/aboutdebugging/test/browser/browser_aboutdebugging_debug-target-pane_collapsibilities_interaction.js new file mode 100644 index 0000000000..7b25e02a9b --- /dev/null +++ b/devtools/client/aboutdebugging/test/browser/browser_aboutdebugging_debug-target-pane_collapsibilities_interaction.js @@ -0,0 +1,62 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +/* import-globals-from helper-collapsibilities.js */ +Services.scriptloader.loadSubScript( + CHROME_URL_ROOT + "helper-collapsibilities.js", + this +); + +/** + * Test that collapsibilities of DebugTargetPane on RuntimePage by mouse clicking. + */ + +add_task(async function () { + prepareCollapsibilitiesTest(); + + const { document, tab, window } = await openAboutDebugging(); + await selectThisFirefoxPage(document, window.AboutDebugging.store); + + for (const { title } of TARGET_PANES) { + info("Check whether this pane is collapsed after clicking the title"); + await toggleCollapsibility(getDebugTargetPane(title, document)); + assertDebugTargetCollapsed(getDebugTargetPane(title, document), title); + + info("Check whether this pane is expanded after clicking the title again"); + await toggleCollapsibility(getDebugTargetPane(title, document)); + await assertDebugTargetExpanded(getDebugTargetPane(title, document), title); + } + + await removeTab(tab); +}); + +async function assertDebugTargetCollapsed(paneEl, title) { + info("Check debug target is collapsed"); + + // check list height + const targetEl = paneEl.querySelector(".qa-debug-target-pane__collapsable"); + is(targetEl.clientHeight, 0, "Height of list element is zero"); + // check title + const titleEl = paneEl.querySelector(".qa-debug-target-pane-title"); + const expectedTitle = `${title} (${ + targetEl.querySelectorAll(".qa-debug-target-item").length + })`; + is(titleEl.textContent, expectedTitle, "Collapsed title is correct"); +} + +async function assertDebugTargetExpanded(paneEl, title) { + info("Check debug target is expanded"); + + // check list height + const targetEl = paneEl.querySelector(".qa-debug-target-pane__collapsable"); + await waitUntil(() => targetEl.clientHeight > 0); + ok(true, "Height of list element is greater than zero"); + // check title + const titleEl = paneEl.querySelector(".qa-debug-target-pane-title"); + const expectedTitle = `${title} (${ + targetEl.querySelectorAll(".qa-debug-target-item").length + })`; + is(titleEl.textContent, expectedTitle, "Expanded title is correct"); +} |