summaryrefslogtreecommitdiffstats
path: root/devtools/client/debugger/test/mochitest/browser_dbg-blackbox-original.js
blob: e508c9766dc61fb44d5ed77b4dd154ad882930ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */

// This source map does not have source contents, so it's fetched separately
add_task(async function() {
  // NOTE: the CORS call makes the test run times inconsistent
  const dbg = await initDebugger("doc-sourcemaps3.html");
  dbg.actions.toggleMapScopes();

  const {
    selectors: { getBreakpoint, getBreakpointCount },
    getState,
  } = dbg;

  await waitForSources(dbg, "bundle.js", "sorted.js", "test.js");

  const sortedSrc = findSource(dbg, "sorted.js");

  await selectSource(dbg, sortedSrc);

  // Show the source in source tree in primiany panel for blackBox icon check
  rightClickElement(dbg, "CodeMirrorLines");
  selectContextMenuItem(dbg, "#node-menu-show-source");
  await waitForDispatch(dbg, "SHOW_SOURCE");

  await clickElement(dbg, "blackbox");
  await waitForDispatch(dbg, "BLACKBOX");

  const sourceTab = findElementWithSelector(dbg, ".source-tab.active");
  ok(
    sourceTab.querySelector(".img.blackBox"),
    "Source tab has a blackbox icon"
  );

  const treeItem = findElementWithSelector(dbg, ".tree-node.focused");
  ok(
    treeItem.querySelector(".img.blackBox"),
    "Source tree item has a blackbox icon"
  );

  // breakpoint at line 38 in sorted
  await addBreakpoint(dbg, sortedSrc, 38);
  // invoke test
  invokeInTab("test");
  // should not pause
  is(isPaused(dbg), false);

  // unblackbox
  await clickElement(dbg, "blackbox");
  await waitForDispatch(dbg, "BLACKBOX");

  // click on test
  invokeInTab("test");
  // should pause
  await waitForPaused(dbg);

  ok(true, "blackbox works");
});