summaryrefslogtreecommitdiffstats
path: root/browser/components/uitour/test/browser_UITour_pocket.js
blob: 072e1251e132406259f658522874b6ccf411e34a (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
/* Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/ */

"use strict";

var gTestTab;
var gContentAPI;

add_task(setup_UITourTest);

add_UITour_task(async function test_menu_show() {
  let panel = BrowserPageActions.activatedActionPanelNode;
  Assert.ok(
    !panel || panel.state == "closed",
    "Pocket panel should initially be closed"
  );
  gContentAPI.showMenu("pocket");

  // The panel gets created dynamically.
  panel = null;
  await waitForConditionPromise(() => {
    panel = BrowserPageActions.activatedActionPanelNode;
    return panel && panel.state == "open";
  }, "Menu should be visible after showMenu()");

  Assert.ok(
    !panel.hasAttribute("noautohide"),
    "@noautohide shouldn't be on the pocket panel"
  );

  panel.hidePopup();
  await new Promise(resolve => {
    panel = BrowserPageActions.activatedActionPanelNode;
    if (!panel || panel.state == "closed") {
      resolve();
    }
  });
});