From 6bf0a5cb5034a7e684dcc3500e841785237ce2dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:32:43 +0200 Subject: Adding upstream version 1:115.7.0. Signed-off-by: Daniel Baumann --- .../test/browser_net_filter-sts-search.js | 59 ++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 devtools/client/netmonitor/test/browser_net_filter-sts-search.js (limited to 'devtools/client/netmonitor/test/browser_net_filter-sts-search.js') diff --git a/devtools/client/netmonitor/test/browser_net_filter-sts-search.js b/devtools/client/netmonitor/test/browser_net_filter-sts-search.js new file mode 100644 index 0000000000..d8de156cb6 --- /dev/null +++ b/devtools/client/netmonitor/test/browser_net_filter-sts-search.js @@ -0,0 +1,59 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +/** + * Test incomplete status-code search + */ +const REQUESTS = [ + { url: "sjs_status-codes-test-server.sjs?sts=400" }, + { url: "sjs_status-codes-test-server.sjs?sts=300" }, + { url: "sjs_status-codes-test-server.sjs?sts=304" }, +]; + +add_task(async function () { + const { monitor } = await initNetMonitor(FILTERING_URL, { requestCount: 1 }); + const { document, store, windowRequire } = monitor.panelWin; + const Actions = windowRequire("devtools/client/netmonitor/src/actions/index"); + + const { getDisplayedRequests } = windowRequire( + "devtools/client/netmonitor/src/selectors/index" + ); + + store.dispatch(Actions.batchEnable(false)); + + info("Starting test... "); + + // Let the requests load completely before the incomplete search tests begin + // because we are searching for the status code in these requests. + const waitNetwork = waitForNetworkEvents(monitor, REQUESTS.length); + await performRequestsInContent(REQUESTS); + await waitNetwork; + + document.querySelector(".devtools-filterinput").focus(); + + EventUtils.sendString("status-code:3"); + + let visibleItems = getDisplayedRequests(store.getState()); + + // Results will be updated asynchronously, so we should wait until + // displayed requests reach final state. + await waitUntil(() => { + visibleItems = getDisplayedRequests(store.getState()); + return visibleItems.length === 2; + }); + + is( + Number(visibleItems[0].status), + 303, + "First visible item has expected status" + ); + is( + Number(visibleItems[1].status), + 304, + "Second visible item has expected status" + ); + + await teardown(monitor); +}); -- cgit v1.2.3