Files
sousa-gecko/devtools/client/netmonitor/test/browser_net_pane-collapse.js
T
Alexandre Poirot 25c8ad77e8 Bug 2007539 - [devtools] Reload pages as Firefox does in DevTools tests. r=devtools-reviewers,nchevobbe
The `gBrowser.reloadTab` method was doing a very light reload,
which could preserve iframe overriden locations.
The new method ensures we load the original HTML content back,
this seems to also have an impact on keep-alive which is not longer guaranteed.

Only supports reloading the currently selected tab, to better replicate
real user scenarios. But also to comply to `BrowserCommands.reload`,
which only supports reloading the selected tab.

Also tune the har test, now that requests are really cancelled
and we may try to fetch reponse content for such request.

Differential Revision: https://phabricator.services.mozilla.com/D277433
2026-01-20 20:44:46 +00:00

69 lines
1.9 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/**
* Tests if the network monitor panes collapse properly.
*/
add_task(async function () {
const { monitor } = await initNetMonitor(SIMPLE_URL, {
requestCount: 1,
});
info("Starting test... ");
const { document, store, windowRequire } = monitor.panelWin;
const Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
const { Prefs } = windowRequire("devtools/client/netmonitor/src/utils/prefs");
const wait = waitForNetworkEvents(monitor, 1);
await reloadSelectedTab();
await wait;
ok(
!document.querySelector(".network-details-bar") &&
!document.querySelector(".sidebar-toggle"),
"The details panel should initially be hidden."
);
store.dispatch(Actions.toggleNetworkDetails());
is(
~~document.querySelector(".network-details-bar").clientWidth,
Prefs.networkDetailsWidth,
"The details panel has an incorrect width."
);
ok(
document.querySelector(".network-details-bar") &&
document.querySelector(".sidebar-toggle"),
"The details panel should at this point be visible."
);
EventUtils.sendMouseEvent(
{ type: "click" },
document.querySelector(".sidebar-toggle")
);
ok(
!document.querySelector(".network-details-bar") &&
!document.querySelector(".sidebar-toggle"),
"The details panel should not be visible after collapsing."
);
store.dispatch(Actions.toggleNetworkDetails());
is(
~~document.querySelector(".network-details-bar").clientWidth,
Prefs.networkDetailsWidth,
"The details panel has an incorrect width after uncollapsing."
);
ok(
document.querySelector(".network-details-bar") &&
document.querySelector(".sidebar-toggle"),
"The details panel should be visible again after uncollapsing."
);
await teardown(monitor);
});