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

"use strict";

const TEST_URI_ORG = `https://example.org/document-builder.sjs?html=<meta charset=utf8></meta>
<script>
      console.log("early message on org page");
</script><body>`;
const TEST_URI_COM = TEST_URI_ORG.replace(/org/g, "com");

add_task(async function () {
  info("Add a tab and open the console");
  const tab = await addTab("about:robots");
  const hud = await openConsole(tab);

  {
    await navigateTo(TEST_URI_ORG);

    // Wait for some time in order to let a chance to have duplicated message
    // and catch such regression
    await wait(1000);

    info("wait until the ORG message is displayed");
    await checkUniqueMessageExists(
      hud,
      "early message on org page",
      ".console-api"
    );
  }

  {
    await navigateTo(TEST_URI_COM);

    // Wait for some time in order to let a chance to have duplicated message
    // and catch such regression
    await wait(1000);

    info("wait until the COM message is displayed");
    await checkUniqueMessageExists(
      hud,
      "early message on com page",
      ".console-api"
    );
  }
});