Bug 1613092 - Support Regexp in checkIntervention. r=adw

Differential Revision: https://phabricator.services.mozilla.com/D61565

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Harry Twyford 2020-02-05 08:58:29 +00:00
Родитель 48199b9dc3
Коммит 6e64ec0fac
2 изменённых файлов: 18 добавлений и 3 удалений

Просмотреть файл

@ -35,7 +35,7 @@ add_task(async function refresh() {
tip: TIPS.REFRESH,
title:
"Restore default settings and remove old add-ons for optimal performance.",
button: "Refresh Nightly…",
button: /^Refresh .+…$/,
awaitCallback() {
return promiseAlertDialog("cancel", [
"chrome://global/content/resetProfile.xhtml",

Просмотреть файл

@ -103,8 +103,23 @@ async function checkIntervention({
// Do a search that triggers the tip.
let [result, element] = await awaitTip(searchString);
Assert.strictEqual(result.payload.type, tip);
Assert.equal(element._elements.get("title").textContent, title);
Assert.equal(element._elements.get("tipButton").textContent, button);
let actualTitle = element._elements.get("title").textContent;
if (typeof title == "string") {
Assert.equal(actualTitle, title, "Title string");
} else {
// regexp
Assert.ok(title.test(actualTitle), "Title regexp");
}
let actualButton = element._elements.get("tipButton").textContent;
if (typeof button == "string") {
Assert.equal(actualButton, button, "Button string");
} else {
// regexp
Assert.ok(button.test(actualButton), "Button regexp");
}
Assert.ok(BrowserTestUtils.is_visible(element._elements.get("helpButton")));
let values = await Promise.all([awaitCallback(), pickTip()]);