summaryrefslogtreecommitdiffstats
path: root/devtools/client/application/test/browser/browser_application_panel_sidebar.js
blob: 80b2fbfe09206762e63b76c11f129f26f17f410e (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/* Any copyright is dedicated to the Public Domain.
   http://creativecommons.org/publicdomain/zero/1.0/ */

"use strict";

/**
 * Check that the manifest is being properly shown
 */

add_task(async function () {
  info("Test that we are displaying correctly the sidebar");

  await enableApplicationPanel();
  const { panel, tab, commands } = await openNewTabAndApplicationPanel();
  const doc = panel.panelWin.document;

  info("Waiting for the sidebar to be displayed");
  await waitUntil(() => doc.querySelector(".js-sidebar") !== null);
  ok(true, "Sidebar is being displayed");

  await waitUntil(() => doc.querySelector(".js-service-workers-page") !== null);
  ok(true, "Service Workers page was loaded per default.");

  // close the tab
  info("Closing the tab.");
  await commands.client.waitForRequestsToSettle();
  await BrowserTestUtils.removeTab(tab);
});

add_task(async function () {
  info("Test that we are displaying correctly the selected page - manifest");

  await enableApplicationPanel();
  const { panel, tab, commands } = await openNewTabAndApplicationPanel();
  const doc = panel.panelWin.document;

  info("Select service worker page");
  selectPage(panel, "service-workers");
  await waitUntil(() => doc.querySelector(".js-service-workers-page") !== null);
  await unregisterAllWorkers(commands.client, doc);

  info("Select manifest page in the sidebar");
  const link = doc.querySelector(".js-sidebar-manifest");
  link.click();

  await waitUntil(() => doc.querySelector(".js-manifest-page") !== null);
  ok(true, "Manifest page was selected.");

  // close the tab
  info("Closing the tab.");
  await commands.client.waitForRequestsToSettle();
  await BrowserTestUtils.removeTab(tab);
});

add_task(async function () {
  info(
    "Test that we are displaying correctly the selected page - service workers"
  );
  const url = URL_ROOT + "resources/manifest/load-ok.html";

  await enableApplicationPanel();
  const { panel, tab, commands } = await openNewTabAndApplicationPanel(url);
  const doc = panel.panelWin.document;

  selectPage(panel, "manifest");

  info("Waiting for the manifest to load");
  await waitUntil(() => doc.querySelector(".js-manifest-page") !== null);
  ok(true, "Manifest page was selected.");

  info("Select service worker page in the sidebar");
  const link = doc.querySelector(".js-sidebar-service-workers");
  link.click();

  await waitUntil(() => doc.querySelector(".js-service-workers-page") !== null);
  ok(true, "Service workers page was selected.");

  // close the tab
  info("Closing the tab.");
  await commands.client.waitForRequestsToSettle();
  await BrowserTestUtils.removeTab(tab);
});