summaryrefslogtreecommitdiffstats
path: root/toolkit/components/reader/tests/browser/browser_readerMode_bc_reuse.js
blob: d1d0e8b0d52886d5c8d7b809eda924b883114f70 (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
/* Any copyright is dedicated to the Public Domain.
   http://creativecommons.org/publicdomain/zero/1.0/ */

"use strict";

const TEST_PATH = getRootDirectory(gTestPath).replace(
  "chrome://mochitests/content",
  "https://example.com"
);

const TEST_URL = TEST_PATH + "readerModeArticle.html";

add_task(async function test_TODO() {
  await BrowserTestUtils.withNewTab(
    "data:text/html,<p>Opener",
    async browser => {
      let newTabPromise = BrowserTestUtils.waitForNewTab(
        gBrowser,
        TEST_URL,
        true
      );
      await SpecialPowers.spawn(browser, [TEST_URL], url => {
        content.eval(`window.x = open("${url}", "_blank");`);
      });
      let newTab = await newTabPromise;

      let readerButton = document.getElementById("reader-mode-button");
      await BrowserTestUtils.waitForMutationCondition(
        readerButton,
        { attributes: true },
        () => !readerButton.hidden
      );
      let tabLoaded = promiseTabLoadEvent(newTab);
      readerButton.click();
      await tabLoaded;
      isnot(
        newTab.linkedBrowser.browsingContext.group.id,
        browser.browsingContext.group.id,
        "BC should be in a different group now."
      );
      BrowserTestUtils.removeTab(newTab);
    }
  );
});