browser/devtools/canvasdebugger/test/browser_canvas-frontend-reload-02.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:441e691f75b4
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
3
4 /**
5 * Tests that the frontend UI is properly reconfigured after reloading.
6 */
7
8 function ifTestingSupported() {
9 let [target, debuggee, panel] = yield initCanavsDebuggerFrontend(SIMPLE_CANVAS_URL);
10 let { window, $, $all, EVENTS, SnapshotsListView, CallsListView } = panel.panelWin;
11
12 is(SnapshotsListView.itemCount, 0,
13 "There should be no snapshots initially displayed in the UI.");
14 is(CallsListView.itemCount, 0,
15 "There should be no function calls initially displayed in the UI.");
16
17 is($("#screenshot-container").hidden, true,
18 "The screenshot should not be initially displayed in the UI.");
19 is($("#snapshot-filmstrip").hidden, true,
20 "There should be no thumbnails initially displayed in the UI (1).");
21 is($all(".filmstrip-thumbnail").length, 0,
22 "There should be no thumbnails initially displayed in the UI (2).");
23
24 yield reload(target);
25
26 let recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
27 let callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED);
28 let thumbnailsDisplayed = once(window, EVENTS.THUMBNAILS_DISPLAYED);
29 let screenshotDisplayed = once(window, EVENTS.CALL_SCREENSHOT_DISPLAYED);
30 SnapshotsListView._onRecordButtonClick();
31 yield promise.all([
32 recordingFinished,
33 callListPopulated,
34 thumbnailsDisplayed,
35 screenshotDisplayed
36 ]);
37
38 is(SnapshotsListView.itemCount, 1,
39 "There should be one snapshot displayed in the UI.");
40 is(CallsListView.itemCount, 8,
41 "All the function calls should now be displayed in the UI.");
42
43 is($("#screenshot-container").hidden, false,
44 "The screenshot should now be displayed in the UI.");
45 is($("#snapshot-filmstrip").hidden, false,
46 "All the thumbnails should now be displayed in the UI (1).");
47 is($all(".filmstrip-thumbnail").length, 4,
48 "All the thumbnails should now be displayed in the UI (2).");
49
50 let reset = once(window, EVENTS.UI_RESET);
51 let navigated = reload(target);
52
53 yield reset;
54 ok(true, "The UI was reset after the refresh button was clicked.");
55
56 is(SnapshotsListView.itemCount, 0,
57 "There should be no snapshots displayed in the UI after navigating.");
58 is(CallsListView.itemCount, 0,
59 "There should be no function calls displayed in the UI after navigating.");
60 is($("#snapshot-filmstrip").hidden, true,
61 "There should be no thumbnails displayed in the UI after navigating.");
62 is($("#screenshot-container").hidden, true,
63 "The screenshot should not be displayed in the UI after navigating.");
64
65 yield navigated;
66 ok(true, "The target finished reloading.");
67
68 yield teardown(panel);
69 finish();
70 }

mercurial