Bug 1924993 - [devtools] Debugger tests wait before typing in conditional panel r...
[gecko.git] / devtools / client / netmonitor / test / browser_net_server_timings.js
blob1ed635168fbd537343ee538fa21fe5eacd71c8d9
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
4 "use strict";
6 /**
7 * Tests if server side timings are displayed
8 */
9 add_task(async function () {
10 const { tab, monitor } = await initNetMonitor(HTTPS_CUSTOM_GET_URL, {
11 requestCount: 1,
12 });
14 const { document, store, windowRequire } = monitor.panelWin;
15 const Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
16 store.dispatch(Actions.batchEnable(false));
18 let wait = waitForNetworkEvents(monitor, 1);
19 await SpecialPowers.spawn(
20 tab.linkedBrowser,
21 [SERVER_TIMINGS_TYPE_SJS],
22 async function (url) {
23 content.wrappedJSObject.performRequests(1, url);
26 await wait;
28 // There must be 4 timing values (including server side timings).
29 const timingsSelector = "#timings-panel .tabpanel-summary-container.server";
30 wait = waitForDOM(document, timingsSelector, 4);
32 AccessibilityUtils.setEnv({
33 // Keyboard users will will see the sidebar when the request row is
34 // selected. Accessibility is handled on the container level.
35 actionCountRule: false,
36 interactiveRule: false,
37 labelRule: false,
38 });
39 EventUtils.sendMouseEvent(
40 { type: "click" },
41 document.querySelectorAll(".request-list-item")[0]
43 AccessibilityUtils.resetEnv();
45 store.dispatch(Actions.toggleNetworkDetails());
47 clickOnSidebarTab(document, "timings");
48 await wait;
50 // Check the UI contains server side timings and correct values
51 const timings = document.querySelectorAll(timingsSelector, 4);
52 is(
53 timings[0].textContent,
54 "time1123 ms",
55 "The first server-timing must be correct"
57 is(
58 timings[1].textContent,
59 "time20 ms",
60 "The second server-timing must be correct"
62 is(
63 timings[2].textContent,
64 "time31.66 min",
65 "The third server-timing must be correct"
67 is(
68 timings[3].textContent,
69 "time41.11 s",
70 "The fourth server-timing must be correct"
73 await teardown(monitor);
74 });