|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 /** |
|
5 * Tests if requests are handled correctly. |
|
6 */ |
|
7 |
|
8 function test() { |
|
9 initNetMonitor(SIMPLE_URL).then(([aTab, aDebuggee, aMonitor]) => { |
|
10 info("Starting test... "); |
|
11 |
|
12 let { document, NetMonitorView } = aMonitor.panelWin; |
|
13 let { RequestsMenu } = NetMonitorView; |
|
14 |
|
15 RequestsMenu.lazyUpdate = false; |
|
16 |
|
17 is(document.querySelector("#details-pane-toggle") |
|
18 .hasAttribute("disabled"), true, |
|
19 "The pane toggle button should be disabled when the frontend is opened."); |
|
20 is(document.querySelector("#requests-menu-empty-notice") |
|
21 .hasAttribute("hidden"), false, |
|
22 "An empty notice should be displayed when the frontend is opened."); |
|
23 is(RequestsMenu.itemCount, 0, |
|
24 "The requests menu should be empty when the frontend is opened."); |
|
25 is(NetMonitorView.detailsPaneHidden, true, |
|
26 "The details pane should be hidden when the frontend is opened."); |
|
27 |
|
28 aMonitor.panelWin.once(aMonitor.panelWin.EVENTS.NETWORK_EVENT, () => { |
|
29 is(document.querySelector("#details-pane-toggle") |
|
30 .hasAttribute("disabled"), false, |
|
31 "The pane toggle button should be enabled after the first request."); |
|
32 is(document.querySelector("#requests-menu-empty-notice") |
|
33 .hasAttribute("hidden"), true, |
|
34 "The empty notice should be hidden after the first request."); |
|
35 is(RequestsMenu.itemCount, 1, |
|
36 "The requests menu should not be empty after the first request."); |
|
37 is(NetMonitorView.detailsPaneHidden, true, |
|
38 "The details pane should still be hidden after the first request."); |
|
39 |
|
40 aMonitor.panelWin.once(aMonitor.panelWin.EVENTS.NETWORK_EVENT, () => { |
|
41 is(document.querySelector("#details-pane-toggle") |
|
42 .hasAttribute("disabled"), false, |
|
43 "The pane toggle button should be still be enabled after a reload."); |
|
44 is(document.querySelector("#requests-menu-empty-notice") |
|
45 .hasAttribute("hidden"), true, |
|
46 "The empty notice should be still hidden after a reload."); |
|
47 is(RequestsMenu.itemCount, 1, |
|
48 "The requests menu should not be empty after a reload."); |
|
49 is(NetMonitorView.detailsPaneHidden, true, |
|
50 "The details pane should still be hidden after a reload."); |
|
51 |
|
52 teardown(aMonitor).then(finish); |
|
53 }); |
|
54 |
|
55 aDebuggee.location.reload(); |
|
56 }); |
|
57 |
|
58 aDebuggee.location.reload(); |
|
59 }); |
|
60 } |