summaryrefslogtreecommitdiffstats
path: root/devtools/client/aboutdebugging/test/browser/browser_aboutdebugging_devtoolstoolbox_splitconsole_key.js
blob: 44e83b8c43f3e0bc2f300c76a9568dd0f70b9c8b (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
/* Any copyright is dedicated to the Public Domain.
   http://creativecommons.org/publicdomain/zero/1.0/ */

"use strict";

/* import-globals-from helper-collapsibilities.js */
Services.scriptloader.loadSubScript(
  CHROME_URL_ROOT + "helper-collapsibilities.js",
  this
);

/**
 * Test that the split console key shortcut works on about:devtools-toolbox.
 */
add_task(async function () {
  info("Force all debug target panes to be expanded");
  prepareCollapsibilitiesTest();

  const { document, tab, window } = await openAboutDebugging();
  await selectThisFirefoxPage(document, window.AboutDebugging.store);
  const { devtoolsTab, devtoolsWindow } = await openAboutDevtoolsToolbox(
    document,
    tab,
    window
  );

  // Select any tool that is not the Webconsole, since we will assert the split-console.
  info("Select inspector tool");
  const toolbox = getToolbox(devtoolsWindow);
  await toolbox.selectTool("inspector");

  info("Press Escape and wait for the split console to be opened");
  const onSplitConsole = toolbox.once("split-console");
  EventUtils.synthesizeKey("VK_ESCAPE", {}, devtoolsWindow);
  await onSplitConsole;
  await waitUntil(() => toolbox.isSplitConsoleFocused());
  ok(true, "Split console is opened and focused");

  info("Press Escape again and wait for the split console to be closed");
  EventUtils.synthesizeKey("VK_ESCAPE", {}, devtoolsWindow);
  await waitUntil(() => !toolbox.isSplitConsoleFocused());
  ok(true, "Split console is closed and no longer focused");

  await closeAboutDevtoolsToolbox(document, devtoolsTab, window);
  await removeTab(tab);
});