summaryrefslogtreecommitdiffstats
path: root/devtools/client/aboutdebugging/test/browser/browser_aboutdebugging_devtools.js
blob: 4ea3238ea3a142a144224a1471aba7a23f30c01a (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
/* 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
);

/**
 * Check that DevTools are not closed when leaving This Firefox runtime page.
 */

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 connectSidebarItem = findSidebarItemByText("Setup", document);
  const connectLink = connectSidebarItem.querySelector(".qa-sidebar-link");
  ok(connectSidebarItem, "Found the Connect sidebar item");

  info("Open devtools on the current about:debugging tab");
  const toolbox = await openToolboxForTab(tab, "inspector");
  const inspector = toolbox.getPanel("inspector");

  info("DevTools starts workers, wait for requests to settle");
  const store = window.AboutDebugging.store;
  await waitForAboutDebuggingRequests(store);

  info("Click on the Connect item in the sidebar");
  connectLink.click();
  await waitForDispatch(store, "UNWATCH_RUNTIME_SUCCESS");

  info("Wait until Connect page is displayed");
  await waitUntil(() => document.querySelector(".qa-connect-page"));

  const markupViewElement = inspector.panelDoc.getElementById("markup-box");
  ok(markupViewElement, "Inspector is still rendered");

  // We explicitely destroy the toolbox in order to ensure waiting for its full destruction
  // and avoid leak / pending requests
  info("Destroy the opened toolbox");
  await toolbox.destroy();

  await removeTab(tab);
});