summaryrefslogtreecommitdiffstats
path: root/services/fxaccounts/tests/browser/browser_verify_login.js
blob: c14d6ed0b2e1386b500da4987035481b613c7c38 (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
/* Any copyright is dedicated to the Public Domain.
   http://creativecommons.org/publicdomain/zero/1.0/ */

add_task(async function () {
  let payload = {
    data: {
      deviceName: "Laptop",
      url: "https://example.com/newLogin",
      title: "Sign-in Request",
      body: "New sign-in request from vershwal's Nighty on Intel Mac OS X 10.12",
    },
  };
  info("testVerifyNewSignin");
  setupMockAlertsService();
  BrowserTestUtils.loadURIString(gBrowser.selectedBrowser, "about:mozilla");
  await waitForDocLoadComplete();

  let waitForTabPromise = BrowserTestUtils.waitForNewTab(gBrowser);

  Services.obs.notifyObservers(
    null,
    "fxaccounts:verify_login",
    JSON.stringify(payload.data)
  );

  let tab = await waitForTabPromise;
  Assert.ok("Tab successfully opened");
  Assert.equal(tab.linkedBrowser.currentURI.spec, payload.data.url);
  BrowserTestUtils.removeTab(tab);
});