Bug 1467407 - Fix incorrect usage of ok() in devtools mochitests;r=jryans
authorJulian Descottes <jdescottes@mozilla.com>
Thu, 07 Jun 2018 12:06:20 +0200
changeset 476156 79e6b5e97fed0a861be04fa3635e5033ef9580f4
parent 476155 13714116865dee4843b17d7be7bdac84f0eac0a2
child 476157 39913642590f07aa9350bda3d00e1607baf1194d
push id9374
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:43:20 +0000
treeherdermozilla-beta@160e085dfb0b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjryans
bugs1467407
milestone62.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 1467407 - Fix incorrect usage of ok() in devtools mochitests;r=jryans All the changes here either directly worked when switching from ok() to is() or were straightforward to fix. MozReview-Commit-ID: LEcCu0A4msu
devtools/client/framework/test/browser_menu_api.js
devtools/client/inspector/markup/test/browser_markup_mutation_01.js
devtools/client/inspector/rules/test/browser_rules_completion-new-property_multiline.js
devtools/client/inspector/shared/test/browser_styleinspector_refresh_when_active.js
devtools/client/inspector/test/browser_inspector_search-05.js
devtools/client/netmonitor/test/browser_net_charts-01.js
devtools/client/netmonitor/test/browser_net_charts-02.js
devtools/client/netmonitor/test/browser_net_charts-06.js
devtools/client/shared/test/browser_templater_basic.js
devtools/client/webaudioeditor/test/browser_webaudio-actor-destroy-node.js
--- a/devtools/client/framework/test/browser_menu_api.js
+++ b/devtools/client/framework/test/browser_menu_api.js
@@ -145,17 +145,17 @@ async function testSubmenu(toolbox) {
 
   const menus = toolbox.doc.querySelectorAll("#menu-popup > menu");
   is(menus.length, 2, "Correct number of menus");
   is(menus[0].getAttribute("label"), "Submenu parent", "Correct label");
   ok(!menus[0].hasAttribute("disabled"), "Correct disabled state");
 
   is(menus[1].getAttribute("accesskey"), "A", "Correct accesskey");
   ok(menus[1].hasAttribute("disabled"), "Correct disabled state");
-  ok(menus[1].id, "submenu-parent-with-attrs", "Correct id");
+  is(menus[1].id, "submenu-parent-with-attrs", "Correct id");
 
   const subMenuItems = menus[0].querySelectorAll("menupopup > menuitem");
   is(subMenuItems.length, 1, "Correct number of submenu items");
   is(subMenuItems[0].getAttribute("label"), "Submenu item", "Correct label");
 
   await once(menu, "open");
   const closed = once(menu, "close");
 
--- a/devtools/client/inspector/markup/test/browser_markup_mutation_01.js
+++ b/devtools/client/inspector/markup/test/browser_markup_mutation_01.js
@@ -164,17 +164,17 @@ const TEST_DATA = [
     test: async function(testActor) {
       await testActor.setProperty("#node1", "textContent", "newtext");
     },
     check: async function(inspector) {
       const container = await getContainerForSelector("#node1", inspector);
       ok(container.inlineTextChild, "Has single text child.");
       ok(!container.canExpand, "Can't expand container with inlineTextChild.");
       ok(!container.inlineTextChild.canExpand, "Can't expand inlineTextChild.");
-      ok(container.editor.elt.querySelector(".text").textContent.trim(),
+      is(container.editor.elt.querySelector(".text").textContent.trim(),
          "newtext", "Single text child editor updated.");
     },
   },
   {
     desc: "Removing an only text child",
     test: async function(testActor) {
       await testActor.setProperty("#node1", "innerHTML", "");
     },
@@ -191,17 +191,17 @@ const TEST_DATA = [
     test: async function(testActor) {
       await testActor.setProperty("#node1", "textContent", "newtext");
     },
     check: async function(inspector) {
       const container = await getContainerForSelector("#node1", inspector);
       ok(container.inlineTextChild, "Has single text child.");
       ok(!container.canExpand, "Can't expand container with inlineTextChild.");
       ok(!container.inlineTextChild.canExpand, "Can't expand inlineTextChild.");
-      ok(container.editor.elt.querySelector(".text").textContent.trim(),
+      is(container.editor.elt.querySelector(".text").textContent.trim(),
          "newtext", "Single text child editor updated.");
     },
   },
 
   {
     desc: "Updating the innerHTML",
     test: async function(testActor) {
       await testActor.setProperty("#node2", "innerHTML",
--- a/devtools/client/inspector/rules/test/browser_rules_completion-new-property_multiline.js
+++ b/devtools/client/inspector/rules/test/browser_rules_completion-new-property_multiline.js
@@ -79,19 +79,19 @@ add_task(async function() {
 
   let item = editor.popup.getItemAtIndex(editor.popup.selectedIndex);
   is(item.label, "rebeccapurple",
     "Check autocomplete displays expected value.");
 
   info("Check autocomplete suggestions can be cycled using UP/DOWN arrows.");
 
   await synthesizeKeyForAutocomplete("VK_DOWN", editor, view.styleWindow);
-  ok(editor.popup.selectedIndex, 1, "Using DOWN cycles autocomplete values.");
+  is(editor.popup.selectedIndex, 1, "Using DOWN cycles autocomplete values.");
   await synthesizeKeyForAutocomplete("VK_DOWN", editor, view.styleWindow);
-  ok(editor.popup.selectedIndex, 2, "Using DOWN cycles autocomplete values.");
+  is(editor.popup.selectedIndex, 2, "Using DOWN cycles autocomplete values.");
   await synthesizeKeyForAutocomplete("VK_UP", editor, view.styleWindow);
   is(editor.popup.selectedIndex, 1, "Using UP cycles autocomplete values.");
   item = editor.popup.getItemAtIndex(editor.popup.selectedIndex);
   is(item.label, "red", "Check autocomplete displays expected value.");
 
   info("Select the background-color suggestion with a mouse click.");
   let onRuleviewChanged = view.once("ruleview-changed");
   const onSuggest = editor.once("after-suggest");
--- a/devtools/client/inspector/shared/test/browser_styleinspector_refresh_when_active.js
+++ b/devtools/client/inspector/shared/test/browser_styleinspector_refresh_when_active.js
@@ -21,19 +21,19 @@ add_task(async function() {
     "The rule-view shows the properties for test node one");
 
   info("Switching to the computed-view");
   const onComputedViewReady = inspector.once("computed-view-refreshed");
   selectComputedView(inspector);
   await onComputedViewReady;
   const cView = inspector.getPanel("computedview").computedView;
 
-  ok(getComputedViewPropertyValue(cView, "color"), "#F00",
+  is(getComputedViewPropertyValue(cView, "color"), "rgb(255, 0, 0)",
     "The computed-view shows the properties for test node one");
 
   info("Selecting test node two");
   await selectNode("#two", inspector);
 
-  ok(getComputedViewPropertyValue(cView, "color"), "#00F",
+  is(getComputedViewPropertyValue(cView, "color"), "rgb(0, 0, 255)",
     "The computed-view shows the properties for test node two");
   is(getRuleViewPropertyValue(view, "element", "color"), "blue",
     "The rule-view shows the properties for test node two");
 });
--- a/devtools/client/inspector/test/browser_inspector_search-05.js
+++ b/devtools/client/inspector/test/browser_inspector_search-05.js
@@ -76,18 +76,18 @@ add_task(async function() {
 
   await checkCorrectButton(inspector, "#iframe-1");
 });
 
 const checkCorrectButton = async function(inspector, frameSelector) {
   const {walker} = inspector;
   const node = inspector.selection.nodeFront;
 
-  ok(node.id, "b1", "The selected node is #b1");
-  ok(node.tagName.toLowerCase(), "button",
+  is(node.id, "b1", "The selected node is #b1");
+  is(node.tagName.toLowerCase(), "button",
     "The selected node is <button>");
 
   const selectedNodeDoc = await walker.document(node);
   let iframe = await walker.multiFrameQuerySelectorAll(frameSelector);
   iframe = await iframe.item(0);
   const iframeDoc = (await walker.children(iframe)).nodes[0];
   is(selectedNodeDoc, iframeDoc, "The selected node is in " + frameSelector);
 };
--- a/devtools/client/netmonitor/test/browser_net_charts-01.js
+++ b/devtools/client/netmonitor/test/browser_net_charts-01.js
@@ -54,21 +54,21 @@ add_task(async function() {
     /\s*M 50,50 L 50\.\d+,2\.5\d* A 47\.5,47\.5 0 0 1 91\.\d+,26\.\d+ Z/),
     "The third slice has the correct data.");
 
   ok(slices[0].hasAttribute("largest"),
     "The first slice should be the largest one.");
   ok(slices[2].hasAttribute("smallest"),
     "The third slice should be the smallest one.");
 
-  ok(slices[0].getAttribute("name"), "baz",
+  is(slices[0].getAttribute("name"), "baz",
     "The first slice's name is correct.");
-  ok(slices[1].getAttribute("name"), "bar",
+  is(slices[1].getAttribute("name"), "bar",
     "The first slice's name is correct.");
-  ok(slices[2].getAttribute("name"), "foo",
+  is(slices[2].getAttribute("name"), "foo",
     "The first slice's name is correct.");
 
   is(labels.length, 3,
     "There should be 3 pie chart labels created.");
   is(labels[0].textContent, "baz",
     "The first label's text is correct.");
   is(labels[1].textContent, "bar",
     "The first label's text is correct.");
--- a/devtools/client/netmonitor/test/browser_net_charts-02.js
+++ b/devtools/client/netmonitor/test/browser_net_charts-02.js
@@ -39,16 +39,16 @@ add_task(async function() {
   ok(slices[0].getAttribute("d").match(
     /\s*M 50,50 L 50\.\d+,2\.5\d* A 47\.5,47\.5 0 1 1 49\.\d+,2\.5\d* Z/),
     "The first slice has the correct data.");
 
   ok(slices[0].hasAttribute("largest"),
     "The first slice should be the largest one.");
   ok(slices[0].hasAttribute("smallest"),
     "The first slice should also be the smallest one.");
-  ok(slices[0].getAttribute("name"), L10N.getStr("pieChart.loading"),
+  is(slices[0].getAttribute("name"), L10N.getStr("pieChart.loading"),
     "The first slice's name is correct.");
 
   is(labels.length, 1, "There should be 1 pie chart label created.");
   is(labels[0].textContent, "Loading", "The first label's text is correct.");
 
   await teardown(monitor);
 });
--- a/devtools/client/netmonitor/test/browser_net_charts-06.js
+++ b/devtools/client/netmonitor/test/browser_net_charts-06.js
@@ -35,17 +35,17 @@ add_task(async function() {
   ok(slices[0].getAttribute("d").match(
     /\s*M 50,50 L 50\.\d+,2\.5\d* A 47\.5,47\.5 0 1 1 49\.\d+,2\.5\d* Z/),
     "The slice has the correct data.");
 
   ok(slices[0].hasAttribute("largest"),
     "The slice should be the largest one.");
   ok(slices[0].hasAttribute("smallest"),
     "The slice should also be the smallest one.");
-  ok(slices[0].getAttribute("name"), L10N.getStr("pieChart.unavailable"),
+  is(slices[0].getAttribute("name"), L10N.getStr("pieChart.unavailable"),
     "The slice's name is correct.");
 
   is(labels.length, 1,
     "There should be 1 pie chart label created.");
   is(labels[0].textContent, "Empty",
     "The label's text is correct.");
 
   await teardown(monitor);
--- a/devtools/client/shared/test/browser_templater_basic.js
+++ b/devtools/client/shared/test/browser_templater_basic.js
@@ -152,17 +152,17 @@ var tests = [
   }),
 
   () => ({
     name: "saveElement",
     template: '<p save="${element}">${name}</p>',
     data: { name: "pass 8" },
     result: "<p>pass 8</p>",
     also: function(options) {
-      ok(options.data.element.innerHTML, "pass 9", "saveElement saved");
+      is(options.data.element.innerHTML, "pass 8", "saveElement saved");
       delete options.data.element;
     }
   }),
 
   () => ({
     name: "useElement",
     template: '<p id="pass9">${adjust(__element)}</p>',
     options: { allowEval: true },
--- a/devtools/client/webaudioeditor/test/browser_webaudio-actor-destroy-node.js
+++ b/devtools/client/webaudioeditor/test/browser_webaudio-actor-destroy-node.js
@@ -19,17 +19,17 @@ add_task(async function() {
   const waitUntilDestroyed = getN(front, "destroy-node", 10);
 
   // Force CC so we can ensure it's run to clear out dead AudioNodes
   forceNodeCollection();
 
   const destroyed = await waitUntilDestroyed;
 
   destroyed.forEach((node, i) => {
-    ok(node.type, "AudioBufferSourceNode", "Only buffer nodes are destroyed");
+    is(node.type, "AudioBufferSourceNode", "Only buffer nodes are destroyed");
     ok(actorIsInList(created, destroyed[i]),
       "`destroy-node` called only on AudioNodes in current document.");
   });
 
   await removeTab(target.tab);
 });
 
 function actorIsInList(list, actor) {