Bug 1567373 - Fix intermittent, check for element before visibility. r=johannh, a=test-only
authorErica Wright <ewright@mozilla.com>
Mon, 09 Sep 2019 17:10:44 +0000
changeset 554997 68adb97cc0f86c757c2f115c1af2e9108bf08c14
parent 554996 33cab47601b031d835bd7ec22fa281f5d1da509c
child 554998 6249300e94a498cb8c3fb9425bf89e76f6d1e055
push id2165
push userffxbld-merge
push dateMon, 14 Oct 2019 16:30:58 +0000
treeherdermozilla-release@0eae18af659f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjohannh, test-only
bugs1567373
milestone70.0
Bug 1567373 - Fix intermittent, check for element before visibility. r=johannh, a=test-only Differential Revision: https://phabricator.services.mozilla.com/D44247
browser/components/protections/test/browser/browser_protections_monitor.js
--- a/browser/components/protections/test/browser/browser_protections_monitor.js
+++ b/browser/components/protections/test/browser/browser_protections_monitor.js
@@ -71,20 +71,20 @@ add_task(async function() {
   Services.logins.addLogin(TEST_LOGIN1);
   AboutProtectionsHandler.getMonitorData = mockGetMonitorData(
     fakeDataWithNoError
   );
   await reloadTab(tab);
 
   await ContentTask.spawn(tab.linkedBrowser, {}, async function() {
     await ContentTaskUtils.waitForCondition(() => {
-      const noLogins = content.document.querySelector(
+      const hasLogins = content.document.querySelector(
         ".monitor-card.has-logins"
       );
-      return ContentTaskUtils.is_visible(noLogins);
+      return hasLogins && ContentTaskUtils.is_visible(hasLogins);
     }, "Monitor card for user with stored logins is shown.");
 
     const hasLoginsHeaderContent = content.document.querySelector(
       "#monitor-header-content span"
     );
     const cardBody = content.document.querySelector(".monitor-card .card-body");
 
     ok(
@@ -130,20 +130,20 @@ add_task(async function() {
   AboutProtectionsHandler.getMonitorData = mockGetMonitorData(
     noBreachedLoginsData
   );
 
   await reloadTab(tab);
 
   await ContentTask.spawn(tab.linkedBrowser, {}, async function() {
     await ContentTaskUtils.waitForCondition(() => {
-      const noLogins = content.document.querySelector(
+      const hasLogins = content.document.querySelector(
         ".monitor-card.has-logins"
       );
-      return ContentTaskUtils.is_visible(noLogins);
+      return hasLogins && ContentTaskUtils.is_visible(hasLogins);
     }, "Monitor card for user with stored logins is shown.");
 
     const lockwiseSection = content.document.querySelector(
       ".monitor-breached-passwords"
     );
 
     ok(
       ContentTaskUtils.is_hidden(lockwiseSection),
@@ -195,17 +195,17 @@ add_task(async function() {
 });
 
 async function checkNoLoginsContentIsDisplayed(tab, expectedLinkContent) {
   await ContentTask.spawn(tab.linkedBrowser, null, async function() {
     await ContentTaskUtils.waitForCondition(() => {
       const noLogins = content.document.querySelector(
         ".monitor-card.no-logins"
       );
-      return ContentTaskUtils.is_visible(noLogins);
+      return noLogins && ContentTaskUtils.is_visible(noLogins);
     }, "Monitor card for user with no logins is shown.");
 
     const noLoginsHeaderContent = content.document.querySelector(
       "#monitor-header-content span"
     );
     const cardBody = content.document.querySelector(".monitor-card .card-body");
 
     ok(