summaryrefslogtreecommitdiffstats
path: root/devtools/client/framework/test/browser_about-devtools-toolbox_load.js
blob: abcb59a5d60b7672f1c70b4230df5973acba8609 (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
/* Any copyright is dedicated to the Public Domain.
   http://creativecommons.org/publicdomain/zero/1.0/ */

"use strict";

/**
 * Test that about:devtools-toolbox shows error an page when opened with invalid
 * paramters
 */
add_task(async function () {
  // test that error is shown when missing `type` param
  let { document, tab } = await openAboutToolbox({ invalid: "invalid" });
  await assertErrorIsShown(document);
  await removeTab(tab);
  // test that error is shown if `id` is not provided
  ({ document, tab } = await openAboutToolbox({ type: "tab" }));
  await assertErrorIsShown(document);
  await removeTab(tab);
  // test that error is shown if `remoteId` refers to an unexisting target
  ({ document, tab } = await openAboutToolbox({
    type: "tab",
    remoteId: "13371337",
  }));
  await assertErrorIsShown(document);
  await removeTab(tab);

  async function assertErrorIsShown(doc) {
    await waitUntil(() => doc.querySelector(".qa-error-page"));
    ok(doc.querySelector(".qa-error-page"), "Error page is rendered");
  }
});