Bug 1356786 - Add waitUntil in browser_webconsole_shows_reqs_in_netmonitor.js. r=ntim, a=test-only
authorRicky Chien <ricky060709@gmail.com>
Sat, 15 Apr 2017 19:38:00 +0800
changeset 375941 659b949948787450acaf0466acea822f2cbfc169
parent 375940 44f6061a5dc639a61fdd43cd88b03bba475b1cb0
child 375942 e984689093ed389415affc819776a6eede5d44d2
push id11063
push userryanvm@gmail.com
push dateMon, 17 Apr 2017 14:39:33 +0000
treeherdermozilla-aurora@d68c89ad6e51 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersntim, test-only
bugs1356786
milestone54.0a2
Bug 1356786 - Add waitUntil in browser_webconsole_shows_reqs_in_netmonitor.js. r=ntim, a=test-only MozReview-Commit-ID: 1cLwVeaortC
devtools/client/webconsole/test/browser_webconsole_shows_reqs_in_netmonitor.js
--- a/devtools/client/webconsole/test/browser_webconsole_shows_reqs_in_netmonitor.js
+++ b/devtools/client/webconsole/test/browser_webconsole_shows_reqs_in_netmonitor.js
@@ -25,17 +25,17 @@ add_task(function* () {
   let target = TargetFactory.forTab(tab);
   let toolbox = yield gDevTools.showToolbox(target, "netmonitor");
   info("Network panel is open.");
 
   yield loadDocument(browser);
   info("Document loaded.");
 
   // Test that the request appears in the network panel.
-  testNetmonitor(toolbox);
+  yield testNetmonitor(toolbox);
 
   // Test that the request appears in the console.
   let hud = yield openConsole();
   info("Web console is open");
 
   yield waitForMessages({
     webconsole: hud,
     messages: [
@@ -55,23 +55,21 @@ function loadDocument(browser) {
   browser.addEventListener("load", function () {
     deferred.resolve();
   }, {capture: true, once: true});
   BrowserTestUtils.loadURI(gBrowser.selectedBrowser, TEST_PATH);
 
   return deferred.promise;
 }
 
-function testNetmonitor(toolbox) {
+function* testNetmonitor(toolbox) {
   let monitor = toolbox.getCurrentPanel();
-
   let { gStore, windowRequire } = monitor.panelWin;
-  let Actions = windowRequire("devtools/client/netmonitor/actions/index");
   let { getSortedRequests } = windowRequire("devtools/client/netmonitor/selectors/index");
 
-  gStore.dispatch(Actions.batchEnable(false));
+  yield waitUntil(() => gStore.getState().requests.requests.size > 0);
 
   is(gStore.getState().requests.requests.size, 1, "Network request appears in the network panel");
 
   let item = getSortedRequests(gStore.getState()).get(0);
   is(item.method, "GET", "The request method is correct.");
   is(item.url, TEST_PATH, "The request url is correct.");
 }