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

"use strict";

// Check that messages are displayed in the console when RDM is enabled

const TEST_URI =
  "data:text/html,<!DOCTYPE html><meta charset=utf8>Test logging in RDM";

add_task(async function () {
  const tab = await addTab(TEST_URI);

  info("Open responsive design mode");
  await openRDM(tab);

  info("Log a message before the console is open");
  SpecialPowers.spawn(gBrowser.selectedBrowser, [], function () {
    content.wrappedJSObject.console.log("Cached message");
  });

  info("Open the console");
  const hud = await openConsole(tab);
  await waitFor(
    () => findConsoleAPIMessage(hud, "Cached message"),
    "Cached message isn't displayed in the console output"
  );
  ok(true, "Cached message is displayed in the console");

  info("Log a message while the console is open");
  SpecialPowers.spawn(gBrowser.selectedBrowser, [], function () {
    content.wrappedJSObject.console.log("Live message");
  });

  await waitFor(
    () => findConsoleAPIMessage(hud, "Live message"),
    "Live message isn't displayed in the console output"
  );
  ok(true, "Live message is displayed in the console");

  info("Close responsive design mode");
  await closeRDM(tab);
});