Bug 1406610 - Implementing test; r=nchevobbe
authorJan Odvarko <odvarko@gmail.com>
Mon, 30 Oct 2017 16:04:28 +0100
changeset 389018 7b41783886cc11f0becfece31a367ddc14d03771
parent 389017 bb0c71d42196c92af8a7d018dc1f53265c08ab25
child 389019 7cf89a00757687c8cf06d53e041485eea48e8eb0
push id32777
push userarchaeopteryx@coole-files.de
push dateMon, 30 Oct 2017 22:44:45 +0000
treeherdermozilla-central@dd0f265a1300 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnchevobbe
bugs1406610
milestone58.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 1406610 - Implementing test; r=nchevobbe MozReview-Commit-ID: 16GTk18AbcZ
devtools/client/webconsole/new-console-output/test/mochitest/browser.ini
devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_network_attach.js
--- a/devtools/client/webconsole/new-console-output/test/mochitest/browser.ini
+++ b/devtools/client/webconsole/new-console-output/test/mochitest/browser.ini
@@ -376,16 +376,17 @@ skip-if = true #	Bug 1404384
 tags = mcb
 skip-if = true #	Bug 1404886
 [browser_webconsole_multiline_input.js]
 skip-if = true # Bug 1408941
 [browser_webconsole_multiple_windows_and_tabs.js]
 skip-if = true # Bug 1408942
 [browser_webconsole_netlogging_reset_filter.js]
 skip-if = true #	Bug 1405636
+[browser_webconsole_network_attach.js]
 [browser_webconsole_network_exceptions.js]
 skip-if = true # Bug 1408943
 [browser_webconsole_network_messages_expand.js]
 [browser_webconsole_network_messages_openinnet.js]
 [browser_webconsole_network_requests_from_chrome.js]
 skip-if = true # Bug 1408944
 [browser_webconsole_nodes_highlight.js]
 [browser_webconsole_nodes_select.js]
new file mode 100644
--- /dev/null
+++ b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_network_attach.js
@@ -0,0 +1,63 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+const TEST_FILE = "test-network-request.html";
+const TEST_PATH = "http://example.com/browser/devtools/client/webconsole/new-console-output/test/mochitest/";
+const TEST_URI = TEST_PATH + TEST_FILE;
+
+add_task(async function task() {
+  await pushPref("devtools.webconsole.filter.net", false);
+  await pushPref("devtools.webconsole.filter.netxhr", true);
+  await openNewTabAndToolbox(TEST_URI, "netmonitor");
+
+  const currentTab = gBrowser.selectedTab;
+  let target = TargetFactory.forTab(currentTab);
+  let toolbox = gDevTools.getToolbox(target);
+
+  let monitor = toolbox.getCurrentPanel();
+  let netReady = monitor.panelWin.once("NetMonitor:PayloadReady");
+
+  // Fire an XHR POST request.
+  await ContentTask.spawn(gBrowser.selectedBrowser, null, function () {
+    content.wrappedJSObject.testXhrGet();
+  });
+
+  info("XHR executed");
+
+  await netReady;
+
+  info("NetMonitor:PayloadReady received");
+
+  let webconsolePanel = await toolbox.selectTool("webconsole");
+  let { hud } = webconsolePanel;
+
+  let xhrUrl = TEST_PATH + "test-data.json";
+  let messageNode = await waitFor(() => findMessage(hud, xhrUrl));
+  let urlNode = messageNode.querySelector(".url");
+  info("Network message found.");
+
+  let ui = hud.ui;
+  let consoleReady = ui.jsterm.hud.once("network-request-payload-ready");
+
+  // Expand network log
+  urlNode.click();
+
+  await consoleReady;
+
+  info("network-request-payload-ready received");
+
+  await testNetworkMessage(messageNode);
+});
+
+async function testNetworkMessage(messageNode) {
+  let headersTab = messageNode.querySelector("#headers-tab");
+
+  ok(headersTab, "Headers tab is available");
+
+  // Headers tab should be selected by default, so just check its content.
+  let headersContent = messageNode.querySelector(
+    "#headers-panel .headers-overview");
+  ok(headersContent, "Headers content is available");
+}