From d65db3d1af0373b5cb357123fd10e056e591992e Mon Sep 17 00:00:00 2001 From: Nicolas Chevobbe Date: Fri, 27 Sep 2019 12:07:00 +0000 Subject: [PATCH] Bug 1582865 - Add test case in inspector extension sidebar test. r=rpl. In the existing test, we also check expanding a node, as well as navigating with the keyboard. Differential Revision: https://phabricator.services.mozilla.com/D47272 --HG-- extra : moz-landing-system : lando --- .../browser_inspector_extension_sidebar.js | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/devtools/client/inspector/extensions/test/browser_inspector_extension_sidebar.js b/devtools/client/inspector/extensions/test/browser_inspector_extension_sidebar.js index 4197ee74453c..88f7081d4af0 100644 --- a/devtools/client/inspector/extensions/test/browser_inspector_extension_sidebar.js +++ b/devtools/client/inspector/extensions/test/browser_inspector_extension_sidebar.js @@ -183,6 +183,48 @@ add_task(async function testSidebarSetObjectValueGrip() { propertiesNames: ["cyclic", "prop1", "Symbol(sym1)"], }); + info("Test expanding the object"); + const oi = sidebarPanelContent.querySelector(".tree"); + const cyclicNode = oi.querySelectorAll(".node")[1]; + ok(cyclicNode.innerText.includes("cyclic"), "Found the expected node"); + cyclicNode.click(); + + await ContentTaskUtils.waitForCondition( + () => oi.querySelectorAll(".node").length === 7, + "Wait for the 'cyclic' node to be expanded" + ); + + await ContentTaskUtils.waitForCondition( + () => oi.querySelector(".tree-node.focused"), + "Wait for the 'cyclic' node to be focused" + ); + ok( + oi.querySelector(".tree-node.focused").innerText.includes("cyclic"), + "'cyclic' node is focused" + ); + + info("Test keyboard navigation"); + EventUtils.synthesizeKey("KEY_ArrowLeft", {}, oi.ownerDocument.defaultView); + await ContentTaskUtils.waitForCondition( + () => oi.querySelectorAll(".node").length === 4, + "Wait for the 'cyclic' node to be collapsed" + ); + ok( + oi.querySelector(".tree-node.focused").innerText.includes("cyclic"), + "'cyclic' node is still focused" + ); + + EventUtils.synthesizeKey("KEY_ArrowDown", {}, oi.ownerDocument.defaultView); + await ContentTaskUtils.waitForCondition( + () => oi.querySelectorAll(".tree-node")[2].classList.contains("focused"), + "Wait for the 'prop1' node to be focused" + ); + + ok( + oi.querySelector(".tree-node.focused").innerText.includes("prop1"), + "'prop1' node is focused" + ); + inspectedWindowFront.destroy(); });