Bug 1436431 Part 4: Disable and update an existing mochitest of find-in-page. draft
authorBrad Werth <bwerth@mozilla.com>
Fri, 27 Apr 2018 10:56:39 -0700
changeset 790315 0744aa5900a8cc6100b1d47919d1492e22c90c59
parent 790314 b62cce2bb2727c389642b50d115c4bacbc788bbd
push id108493
push userbwerth@mozilla.com
push dateTue, 01 May 2018 23:23:11 +0000
bugs1436431, 1458393
milestone61.0a1
Bug 1436431 Part 4: Disable and update an existing mochitest of find-in-page. The changes made to this test make the test failure messages more useful. The test is disabled because the test fails on some platforms. The failures seem to indicate that, after a Find for text with multiple matches, the match that is selected is not the first match after the currently highlighted text. Other expected success indicators like total number of matches are correct. Bug 1458393 has been opened to investigate this differing behavior and re-enable the test. MozReview-Commit-ID: 8Jwr9mKNzGr
dom/browser-element/mochitest/browserElement_Find.js
dom/browser-element/mochitest/chrome.ini
--- a/dom/browser-element/mochitest/browserElement_Find.js
+++ b/dom/browser-element/mochitest/browserElement_Find.js
@@ -18,127 +18,131 @@ function runTest() {
     return new Promise((resolve) => {
       iframe.addEventListener(eventName, function(...args) {
         resolve(...args);
       }, {once: true});
     });
   }
 
   // Test if all key=>value pairs in o1 are present in o2.
-  const c = (o1, o2) => Object.keys(o1).every(k => o1[k] == o2[k]);
+  const c = (o1, o2, i) => {
+    for (let k of Object.keys(o1)) {
+      is(o1[k], o2[k], `Test ${i} should match for key ${k}`);
+    }
+  }
 
   let testCount = 0;
 
   once('mozbrowserloadend').then(() => {
     iframe.findAll('foo', 'case-insensitive');
     return once('mozbrowserfindchange');
   }).then(({detail}) => {
-    ok(c(detail, {
+    c(detail, {
       msg_name: "findchange",
       active: true,
       searchString: 'foo',
       searchLimit: 1000,
       activeMatchOrdinal: 1,
       numberOfMatches: 5,
-    }), `test ${testCount++}`);
+    }, testCount++);
     iframe.findNext('forward');
     return once('mozbrowserfindchange');
   }).then(({detail}) => {
-    ok(c(detail, {
+    c(detail, {
       msg_name: "findchange",
       active: true,
       searchString: 'foo',
       searchLimit: 1000,
       activeMatchOrdinal: 2,
       numberOfMatches: 5,
-    }), `test ${testCount++}`);
+    }, testCount++);
     iframe.findNext('backward');
     return once('mozbrowserfindchange');
   }).then(({detail}) => {
-    ok(c(detail, {
+    c(detail, {
       msg_name: "findchange",
       active: true,
       searchString: 'foo',
       searchLimit: 1000,
       activeMatchOrdinal: 1,
       numberOfMatches: 5,
-    }), `test ${testCount++}`);
+    }, testCount++);
     iframe.findAll('xxx', 'case-sensitive');
     return once('mozbrowserfindchange');
   }).then(({detail}) => {
-    ok(c(detail, {
+    c(detail, {
       msg_name: "findchange",
       active: true,
       searchString: 'xxx',
       searchLimit: 1000,
       activeMatchOrdinal: 0,
       numberOfMatches: 0,
-    }), `test ${testCount++}`);
+    }, testCount++);
     iframe.findAll('bar', 'case-insensitive');
     return once('mozbrowserfindchange');
   }).then(({detail}) => {
-    ok(c(detail, {
+    c(detail, {
       msg_name: "findchange",
       active: true,
       searchString: 'bar',
       searchLimit: 1000,
       activeMatchOrdinal: 1,
       numberOfMatches: 4,
-    }), `test ${testCount++}`);
+    }, testCount++);
     iframe.findNext('forward');
     return once('mozbrowserfindchange');
   }).then(({detail}) => {
-    ok(c(detail, {
+    c(detail, {
       msg_name: "findchange",
       active: true,
       searchString: 'bar',
       searchLimit: 1000,
       activeMatchOrdinal: 2,
       numberOfMatches: 4,
-    }), `test ${testCount++}`);
+    }, testCount++);
     iframe.findNext('forward');
     return once('mozbrowserfindchange');
   }).then(({detail}) => {
-    ok(c(detail, {
+    c(detail, {
       msg_name: "findchange",
       active: true,
       searchString: 'bar',
       searchLimit: 1000,
       activeMatchOrdinal: 3,
       numberOfMatches: 4,
-    }), `test ${testCount++}`);
+    }, testCount++);
     iframe.findNext('forward');
     return once('mozbrowserfindchange');
   }).then(({detail}) => {
-    ok(c(detail, {
+    c(detail, {
       msg_name: "findchange",
       active: true,
       searchString: 'bar',
       searchLimit: 1000,
       activeMatchOrdinal: 4,
       numberOfMatches: 4,
-    }), `test ${testCount++}`);
+    }, testCount++);
     iframe.findNext('forward');
     return once('mozbrowserfindchange');
   }).then(({detail}) => {
-    ok(c(detail, {
+    c(detail, {
       msg_name: "findchange",
       active: true,
       searchString: 'bar',
       searchLimit: 1000,
       activeMatchOrdinal: 1,
       numberOfMatches: 4,
-    }), `test ${testCount++}`);
+    }, testCount++);
     iframe.clearMatch();
     return once('mozbrowserfindchange');
   }).then(({detail}) => {
-    ok(c(detail, {
+    c(detail, {
       msg_name: "findchange",
       active: false
-    }), `test ${testCount++}`);
+    }, testCount++);
     SimpleTest.finish();
   });
 
   document.body.appendChild(iframe);
 
 }
 
 addEventListener('testready', runTest);
--- a/dom/browser-element/mochitest/chrome.ini
+++ b/dom/browser-element/mochitest/chrome.ini
@@ -31,16 +31,17 @@ support-files =
   file_illegal_web_manifest.html
 
 [test_browserElement_inproc_BackForward.html]
 [test_browserElement_inproc_BadScreenshot.html]
 [test_browserElement_inproc_DocumentFirstPaint.html]
 [test_browserElement_inproc_DOMRequestError.html]
 [test_browserElement_inproc_ExecuteScript.html]
 [test_browserElement_inproc_Find.html]
+disabled = Bug 1458393
 [test_browserElement_inproc_GetContentDimensions.html]
 [test_browserElement_inproc_GetScreenshot.html]
 [test_browserElement_inproc_GetScreenshotDppx.html]
 [test_browserElement_inproc_getWebManifest.html]
 [test_browserElement_inproc_NextPaint.html]
 [test_browserElement_inproc_PurgeHistory.html]
 [test_browserElement_inproc_ReloadPostRequest.html]
 disabled = no modal prompt on POST reload for chrome window