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 127769 3552a2a5faf702beac010e6e69547d4fb05f9ffb
parent 127768 f134e2c4bb2a3c6fe5343869978e1e98f89551fd
child 127770 7bf86554e74a36654dd72aefc0d4bef7b1005846
push id24512
push userryanvm@gmail.com
push dateFri, 05 Apr 2013 20:13:49 +0000
treeherdermozilla-central@139b6ba547fa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvporof
bugs809424
milestone23.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 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;