commit 1139cba1a7eff8f5f62e842f5dfc359fdda8a6e4
parent fd819177d0564ffb361a84dac6a1340e5d555423
Author: Hubert Boma Manilla <hmanilla@mozilla.com>
Date: Mon, 20 Oct 2025 13:42:25 +0000
Bug 1994114 - [devtools] Assert the expected number of displayed inline previews r=devtools-reviewers,ochameau
This patch starts asserting that the expected number of inline previews (across various lines)
are displayed correctly.
This exposed a displayed inline preview which was not check, so that is also fixed.
Differential Revision: https://phabricator.services.mozilla.com/D268676
Diffstat:
2 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-inline-preview.js b/devtools/client/debugger/test/mochitest/browser_dbg-inline-preview.js
@@ -247,6 +247,15 @@ add_task(async function testInlinePreviewsWithExplicitResourceManagement() {
],
line: 3,
},
+ {
+ previews: [
+ {
+ identifier: "erm.foo:",
+ value: "42",
+ },
+ ],
+ line: 7,
+ },
],
});
diff --git a/devtools/client/debugger/test/mochitest/shared-head.js b/devtools/client/debugger/test/mochitest/shared-head.js
@@ -3533,20 +3533,29 @@ async function toggleJsTracerMenuItem(dbg, selector) {
}
/**
- * Asserts that the contents of the inline previews and the lines
- * that they are displayed on are accurate
+ * Asserts that the number of displayed inline previews, the contents of the inline previews and the lines
+ * that they are displayed on, are accurate
*
* @param {Object} dbg
* @param {Array} expectedInlinePreviews
* @param {String} fnName
*/
async function assertInlinePreviews(dbg, expectedInlinePreviews, fnName) {
- await waitForAllElements(
+ // Accumulate all the previews over the various lines
+ let expectedNumberOfInlinePreviews = 0;
+ for (const { previews } of expectedInlinePreviews) {
+ expectedNumberOfInlinePreviews += previews.length;
+ }
+
+ const inlinePreviews = await waitForAllElements(
dbg,
"visibleInlinePreviews",
- expectedInlinePreviews.length
+ expectedNumberOfInlinePreviews,
+ true
);
+ ok(true, `Displayed ${inlinePreviews.length} inline previews`);
+
for (const expectedInlinePreview of expectedInlinePreviews) {
const { previews, line } = expectedInlinePreview;