fune/browser/base/content/test/general/browser_aboutSupport.js
Sebastian Hengst 2fc1de554d Bug 1336920 - Display the presence/absence of a valid Google and Mozilla API key in about:support. r=florian,francois
MozReview-Commit-ID: CRW3Ttb5DZm

--HG--
extra : rebase_source : 4c32f0c4a90835471c40ef53b6a1ebe2ee7109e9
2017-02-16 13:01:21 +01:00

32 lines
1.4 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
Cu.import("resource://gre/modules/AppConstants.jsm");
Cu.import("resource://gre/modules/Services.jsm");
add_task(function* () {
yield BrowserTestUtils.withNewTab({ gBrowser, url: "about:support" }, function* (browser) {
const strings = Services.strings.createBundle(
"chrome://global/locale/aboutSupport.properties");
let allowedStates = [strings.GetStringFromName("found"),
strings.GetStringFromName("missing")];
let keyGoogleStatus = yield ContentTask.spawn(browser, null, function* () {
let textBox = content.document.getElementById("key-google-box");
yield ContentTaskUtils.waitForCondition(() => textBox.textContent.trim(),
"Google API key status loaded");
return textBox.textContent;
});
ok(allowedStates.includes(keyGoogleStatus), "Google API key status shown");
let keyMozillaStatus = yield ContentTask.spawn(browser, null, function* () {
let textBox = content.document.getElementById("key-mozilla-box");
yield ContentTaskUtils.waitForCondition(() => textBox.textContent.trim(),
"Mozilla API key status loaded");
return textBox.textContent;
});
ok(allowedStates.includes(keyMozillaStatus), "Mozilla API key status shown");
});
});