summaryrefslogtreecommitdiffstats
path: root/devtools/client/netmonitor/test/browser_net_server_timings.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /devtools/client/netmonitor/test/browser_net_server_timings.js
parentInitial commit. (diff)
downloadthunderbird-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_server_timings.js')
-rw-r--r--devtools/client/netmonitor/test/browser_net_server_timings.js74
1 files changed, 74 insertions, 0 deletions
diff --git a/devtools/client/netmonitor/test/browser_net_server_timings.js b/devtools/client/netmonitor/test/browser_net_server_timings.js
new file mode 100644
index 0000000000..1ed635168f
--- /dev/null
+++ b/devtools/client/netmonitor/test/browser_net_server_timings.js
@@ -0,0 +1,74 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+/**
+ * Tests if server side timings are displayed
+ */
+add_task(async function () {
+ const { tab, monitor } = await initNetMonitor(HTTPS_CUSTOM_GET_URL, {
+ requestCount: 1,
+ });
+
+ const { document, store, windowRequire } = monitor.panelWin;
+ const Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
+ store.dispatch(Actions.batchEnable(false));
+
+ let wait = waitForNetworkEvents(monitor, 1);
+ await SpecialPowers.spawn(
+ tab.linkedBrowser,
+ [SERVER_TIMINGS_TYPE_SJS],
+ async function (url) {
+ content.wrappedJSObject.performRequests(1, url);
+ }
+ );
+ await wait;
+
+ // There must be 4 timing values (including server side timings).
+ const timingsSelector = "#timings-panel .tabpanel-summary-container.server";
+ wait = waitForDOM(document, timingsSelector, 4);
+
+ AccessibilityUtils.setEnv({
+ // Keyboard users will will see the sidebar when the request row is
+ // selected. Accessibility is handled on the container level.
+ actionCountRule: false,
+ interactiveRule: false,
+ labelRule: false,
+ });
+ EventUtils.sendMouseEvent(
+ { type: "click" },
+ document.querySelectorAll(".request-list-item")[0]
+ );
+ AccessibilityUtils.resetEnv();
+
+ store.dispatch(Actions.toggleNetworkDetails());
+
+ clickOnSidebarTab(document, "timings");
+ await wait;
+
+ // Check the UI contains server side timings and correct values
+ const timings = document.querySelectorAll(timingsSelector, 4);
+ is(
+ timings[0].textContent,
+ "time1123 ms",
+ "The first server-timing must be correct"
+ );
+ is(
+ timings[1].textContent,
+ "time20 ms",
+ "The second server-timing must be correct"
+ );
+ is(
+ timings[2].textContent,
+ "time31.66 min",
+ "The third server-timing must be correct"
+ );
+ is(
+ timings[3].textContent,
+ "time41.11 s",
+ "The fourth server-timing must be correct"
+ );
+
+ await teardown(monitor);
+});