Bug 809424 - Fix for intermittent browser_webconsole_bug_611795.js | The unknown CSS property warning is displayed only once - Got 1, expected 2; r=vporof
authorMihai Sucan <mihai.sucan@gmail.com>
Thu, 04 Apr 2013 15:41:11 +0300
changeset 134544 3552a2a5faf702beac010e6e69547d4fb05f9ffb
parent 134543 f134e2c4bb2a3c6fe5343869978e1e98f89551fd
child 134545 7bf86554e74a36654dd72aefc0d4bef7b1005846
push idunknown
push userunknown
push dateunknown
reviewersvporof
bugs809424
milestone23.0a1
Bug 809424 - Fix for intermittent browser_webconsole_bug_611795.js | The unknown CSS property warning is displayed only once - Got 1, expected 2; r=vporof
browser/devtools/webconsole/test/browser_webconsole_bug_611795.js
--- a/browser/devtools/webconsole/test/browser_webconsole_bug_611795.js
+++ b/browser/devtools/webconsole/test/browser_webconsole_bug_611795.js
@@ -9,34 +9,46 @@ function onContentLoaded()
 {
   browser.removeEventListener("load", onContentLoaded, true);
 
   let HUD = HUDService.getHudByWindow(content);
   let jsterm = HUD.jsterm;
   let outputNode = HUD.outputNode;
 
   let cssWarning = "Unknown property '-moz-opacity'.  Declaration dropped.";
+  let textFound = false;
+  let repeats = 0;
+
+  function displayResults()
+  {
+    ok(textFound, "css warning was found");
+    is(repeats, 2, "The unknown CSS property warning is displayed only once");
+  }
 
   waitForSuccess({
     name: "2 repeated CSS warnings",
-    validatorFn: function()
-    {
-      return outputNode.textContent.indexOf(cssWarning) > -1;
+    validatorFn: () => {
+      let node = outputNode.querySelector(".webconsole-msg-cssparser");
+      if (!node) {
+        return false;
+      }
+
+      textFound = node.textContent.indexOf(cssWarning) > -1;
+      repeats = node.querySelector(".webconsole-msg-repeat")
+                .getAttribute("value");
+      return textFound && repeats == 2;
     },
-    successFn: function()
-    {
-      let msg = "The unknown CSS property warning is displayed only once";
-      let node = outputNode.firstChild;
-
-      is(node.childNodes[2].textContent, cssWarning, "correct node");
-      is(node.childNodes[3].firstChild.getAttribute("value"), 2, msg);
-
+    successFn: () => {
+      displayResults();
       testConsoleLogRepeats();
     },
-    failureFn: finishTest,
+    failureFn: () => {
+      displayResults();
+      finishTest();
+    },
   });
 }
 
 function testConsoleLogRepeats()
 {
   let HUD = HUDService.getHudByWindow(content);
   let jsterm = HUD.jsterm;
   let outputNode = HUD.outputNode;