michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: /** michael@0: * Tests if the POST requests display the correct information in the UI, michael@0: * for raw payloads with attached content-type headers. michael@0: */ michael@0: michael@0: function test() { michael@0: initNetMonitor(POST_RAW_URL).then(([aTab, aDebuggee, aMonitor]) => { michael@0: info("Starting test... "); michael@0: michael@0: let { document, L10N, NetMonitorView } = aMonitor.panelWin; michael@0: let { RequestsMenu, NetworkDetails } = NetMonitorView; michael@0: michael@0: RequestsMenu.lazyUpdate = false; michael@0: NetworkDetails._params.lazyEmpty = false; michael@0: michael@0: waitForNetworkEvents(aMonitor, 0, 1).then(() => { michael@0: NetMonitorView.toggleDetailsPane({ visible: true }, 2) michael@0: RequestsMenu.selectedIndex = 0; michael@0: michael@0: let TAB_UPDATED = aMonitor.panelWin.EVENTS.TAB_UPDATED; michael@0: waitFor(aMonitor.panelWin, TAB_UPDATED).then(() => { michael@0: let tab = document.querySelectorAll("#event-details-pane tab")[2]; michael@0: let tabpanel = document.querySelectorAll("#event-details-pane tabpanel")[2]; michael@0: michael@0: is(tab.getAttribute("selected"), "true", michael@0: "The params tab in the network details pane should be selected."); michael@0: michael@0: is(tabpanel.querySelector("#request-params-box") michael@0: .hasAttribute("hidden"), false, michael@0: "The request params box doesn't have the indended visibility."); michael@0: is(tabpanel.querySelector("#request-post-data-textarea-box") michael@0: .hasAttribute("hidden"), true, michael@0: "The request post data textarea box doesn't have the indended visibility."); michael@0: michael@0: is(tabpanel.querySelectorAll(".variables-view-scope").length, 1, michael@0: "There should be 1 param scopes displayed in this tabpanel."); michael@0: is(tabpanel.querySelectorAll(".variables-view-empty-notice").length, 0, michael@0: "The empty notice should not be displayed in this tabpanel."); michael@0: michael@0: let postScope = tabpanel.querySelectorAll(".variables-view-scope")[0]; michael@0: is(postScope.querySelector(".name").getAttribute("value"), michael@0: L10N.getStr("paramsFormData"), michael@0: "The post scope doesn't have the correct title."); michael@0: michael@0: is(postScope.querySelectorAll(".variables-view-variable").length, 2, michael@0: "There should be 2 param values displayed in the post scope."); michael@0: is(postScope.querySelectorAll(".variables-view-variable .name")[0].getAttribute("value"), michael@0: "foo", "The first query param name was incorrect."); michael@0: is(postScope.querySelectorAll(".variables-view-variable .value")[0].getAttribute("value"), michael@0: "\"bar\"", "The first query param value was incorrect."); michael@0: is(postScope.querySelectorAll(".variables-view-variable .name")[1].getAttribute("value"), michael@0: "baz", "The second query param name was incorrect."); michael@0: is(postScope.querySelectorAll(".variables-view-variable .value")[1].getAttribute("value"), michael@0: "\"123\"", "The second query param value was incorrect."); michael@0: michael@0: teardown(aMonitor).then(finish); michael@0: }); michael@0: }); michael@0: michael@0: aDebuggee.performRequests(); michael@0: }); michael@0: }