Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

/* Any copyright is dedicated to the Public Domain.
"use strict";
// Note: "identity.fxaccounts.remote.root" is set to https://example.com in browser.ini
add_task(async function test_SHOW_FIREFOX_ACCOUNTS() {
await BrowserTestUtils.withNewTab("about:blank", async browser => {
let loaded = BrowserTestUtils.browserLoaded(browser);
await SMATestUtils.executeAndValidateAction({
type: "SHOW_FIREFOX_ACCOUNTS",
data: { entrypoint: "snippets" },
});
Assert.equal(
await loaded,
"should load fxa with endpoint=snippets"
);
// Open a URL
loaded = BrowserTestUtils.browserLoaded(browser);
await SMATestUtils.executeAndValidateAction({
type: "SHOW_FIREFOX_ACCOUNTS",
data: { entrypoint: "aboutwelcome" },
});
Assert.equal(
await loaded,
"should load fxa with a custom endpoint"
);
// Open a URL with extra parameters
loaded = BrowserTestUtils.browserLoaded(browser);
await SMATestUtils.executeAndValidateAction({
type: "SHOW_FIREFOX_ACCOUNTS",
data: { entrypoint: "test", extraParams: { foo: "bar" } },
});
Assert.equal(
await loaded,
"should load fxa with a custom endpoint and extra parameters in url"
);
});
add_task(async function test_SHOW_FIREFOX_ACCOUNTS_where() {
// Open FXA with a 'where' prop
const action = {
type: "SHOW_FIREFOX_ACCOUNTS",
data: {
entrypoint: "activity-stream-firstrun",
where: "tab",
},
};
const tabPromise = BrowserTestUtils.waitForNewTab(
gBrowser,
);
await SpecialMessageActions.handleAction(action, gBrowser);
const browser = await tabPromise;
ok(browser, "should open FXA in a new tab");
BrowserTestUtils.removeTab(browser);
});
});