Bug 1435048 - Wait for async UI update; r=ochameau draft
authorJan Odvarko <odvarko@gmail.com>
Fri, 09 Feb 2018 17:29:30 +0100
changeset 753089 f162c0bce3bb0fe92bd3044036b7888bed799887
parent 752848 35dfa0882568c06f2d81b6749179815cd4f82886
push id98479
push userjodvarko@mozilla.com
push dateFri, 09 Feb 2018 16:33:02 +0000
reviewersochameau
bugs1435048
milestone60.0a1
Bug 1435048 - Wait for async UI update; r=ochameau MozReview-Commit-ID: Co3WyAIzOLg
devtools/client/netmonitor/test/browser_net_status-bar.js
--- a/devtools/client/netmonitor/test/browser_net_status-bar.js
+++ b/devtools/client/netmonitor/test/browser_net_status-bar.js
@@ -27,16 +27,24 @@ add_task(async () => {
   let onLoad = statusBar.querySelector(".load");
 
   // All expected labels should be there
   ok(requestCount, "There must be request count label");
   ok(size, "There must be size label");
   ok(onContentLoad, "There must be DOMContentLoaded label");
   ok(onLoad, "There must be load label");
 
-  // The content should not be empty
-  ok(requestCount.textContent, "There must be request count label text");
-  ok(size.textContent, "There must be size label text");
-  ok(onContentLoad.textContent, "There must be DOMContentLoaded label text");
-  ok(onLoad.textContent, "There must be load label text");
+  // The content should not be empty. The UI update can also be async,
+  // so use waitUntil.
+  await waitUntil(() => requestCount.textContent);
+  ok(true, "There must be request count label text");
+
+  await waitUntil(() => size.textContent);
+  ok(true, "There must be size label text");
+
+  await waitUntil(() => onContentLoad.textContent);
+  ok(true, "There must be DOMContentLoaded label text");
+
+  await waitUntil(() => onLoad.textContent);
+  ok(true, "There must be load label text");
 
   return teardown(monitor);
 });