Bug 1582865 - Add test case in inspector extension sidebar test. r=rpl.
authorNicolas Chevobbe <nchevobbe@mozilla.com>
Fri, 27 Sep 2019 12:07:00 +0000
changeset 495333 2d51047995e2a1a88c95867cf917decdabb49007
parent 495332 3777d827866b44c766b23c74e5d1e986fdd87ea4
child 495334 a093d517fc880a84ef49e50478b5078f84134975
push id36627
push userdluca@mozilla.com
push dateFri, 27 Sep 2019 21:57:13 +0000
treeherdermozilla-central@d23a0a0ffa93 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrpl
bugs1582865
milestone71.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
devtools/client/inspector/extensions/test/browser_inspector_extension_sidebar.js
--- a/devtools/client/inspector/extensions/test/browser_inspector_extension_sidebar.js
+++ b/devtools/client/inspector/extensions/test/browser_inspector_extension_sidebar.js
@@ -178,16 +178,58 @@ add_task(async function testSidebarSetOb
   sidebar.setObjectValueGrip(evalResult.valueGrip);
 
   // Wait the ObjectInspector component to be rendered and test its content.
   await testSetExpressionSidebarPanel(sidebarPanelContent, {
     nodesLength: 4,
     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();
 });
 
 add_task(async function testSidebarDOMNodeHighlighting() {
   const inspectedWindowFront = await toolbox.target.getFront(
     "webExtensionInspectedWindow"
   );
   const sidebar = inspector.getPanel(SIDEBAR_ID);