diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /devtools/client/netmonitor/test/browser_net_filter-sts-search.js | |
parent | Initial commit. (diff) | |
download | thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/client/netmonitor/test/browser_net_filter-sts-search.js')
-rw-r--r-- | devtools/client/netmonitor/test/browser_net_filter-sts-search.js | 59 |
1 files changed, 59 insertions, 0 deletions
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); +}); |