info("Swith to the webconsole and wait for network logs"); const onWebConsole = monitor.toolbox.once("webconsole-selected"); const { hud } = await monitor.toolbox.selectTool("webconsole");
await onWebConsole;
info("Wait for request");
await waitFor(() => findMessageByType(hud, HTTPS_SIMPLE_URL, ".network"));
info("Switch back the the netmonitor");
await monitor.toolbox.selectTool("netmonitor");
// Click clear and make sure the requests are gone
let waitRequestListCleared = waitForEmptyRequestList(document);
EventUtils.sendMouseEvent({ type: "click" }, clearButton);
await waitRequestListCleared;
// Make sure we can now open the network details panel
store.dispatch(Actions.toggleNetworkDetails()); const detailsPanelToggleButton = document.querySelector(".sidebar-toggle"); // Wait for the details panel to finish fetching the headers information
await waitForRequestData(store, ["requestHeaders", "responseHeaders"]);
ok(
detailsPanelToggleButton &&
!detailsPanelToggleButton.classList.contains("pane-collapsed"), "The details pane should be visible."
);
// Click clear and make sure the details pane closes
waitRequestListCleared = waitForEmptyRequestList(document);
EventUtils.sendMouseEvent({ type: "click" }, clearButton);
await waitRequestListCleared;
ok(
!document.querySelector(".network-details-bar"), "The details pane should not be visible clicking 'clear'."
);
return teardown(monitor);
/** * Asserts the state of the network monitor when one request has loaded
*/ function assertSingleRequestState() {
is(
store.getState().requests.requests.length,
1, "The request menu should have one item at this point."
);
}
/** * Asserts the state of the network monitor when no requests have loaded
*/ function assertNoRequestState() {
is(
store.getState().requests.requests.length,
0, "The request menu should be empty at this point."
);
}
function assertNetworkEventResourceState(expectedNoOfNetworkEventResources) { const actualNoOfNetworkEventResources =
toolbox.resourceCommand.getAllResources(
toolbox.resourceCommand.TYPES.NETWORK_EVENT
).length;
is(
actualNoOfNetworkEventResources,
expectedNoOfNetworkEventResources,
`The expected number of network resources is correctly ${actualNoOfNetworkEventResources}`
);
}
function waitForEmptyRequestList(doc) {
info("Wait for request list to clear"); return waitFor(() => !!doc.querySelector(".request-list-empty-notice"));
}
});
¤ Dauer der Verarbeitung: 0.15 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.