зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1572773 - Adds utility functions for opening certviewer to head.js and refactors tests. r=johannh
Differential Revision: https://phabricator.services.mozilla.com/D41424 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
af3400b041
Коммит
6bc32f4961
|
@ -0,0 +1,65 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
async function getErrorPage(url) {
|
||||
let browser;
|
||||
let pageLoaded;
|
||||
await BrowserTestUtils.openNewForegroundTab(
|
||||
gBrowser,
|
||||
() => {
|
||||
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, url);
|
||||
browser = gBrowser.selectedBrowser;
|
||||
pageLoaded = BrowserTestUtils.waitForErrorPage(browser);
|
||||
},
|
||||
false
|
||||
);
|
||||
|
||||
await pageLoaded;
|
||||
return browser;
|
||||
}
|
||||
|
||||
async function openViaPageInfo(url) {
|
||||
await getErrorPage(url);
|
||||
|
||||
let pageInfo = BrowserPageInfo(url, "securityTab");
|
||||
await BrowserTestUtils.waitForEvent(pageInfo, "load");
|
||||
let viewCert = pageInfo.document.getElementById("security-view-cert");
|
||||
await TestUtils.waitForCondition(
|
||||
() => BrowserTestUtils.is_visible(viewCert),
|
||||
"View certificate button should be visible."
|
||||
);
|
||||
|
||||
let loaded = BrowserTestUtils.waitForNewTab(gBrowser, null, true);
|
||||
|
||||
viewCert.click();
|
||||
|
||||
await loaded;
|
||||
}
|
||||
|
||||
async function openViaErrorPage(url) {
|
||||
let browser = await getErrorPage(url);
|
||||
|
||||
let loaded = BrowserTestUtils.waitForNewTab(gBrowser, null, true);
|
||||
|
||||
await ContentTask.spawn(browser, null, async function() {
|
||||
let advancedButton = content.document.getElementById("advancedButton");
|
||||
Assert.ok(advancedButton, "advancedButton found");
|
||||
Assert.equal(
|
||||
advancedButton.hasAttribute("disabled"),
|
||||
false,
|
||||
"advancedButton should be clickable"
|
||||
);
|
||||
advancedButton.click();
|
||||
|
||||
let viewCertificate = content.document.getElementById("viewCertificate");
|
||||
Assert.equal(
|
||||
viewCertificate.hasAttribute("disabled"),
|
||||
false,
|
||||
"viewCertificate should be clickable"
|
||||
);
|
||||
viewCertificate.click();
|
||||
});
|
||||
await loaded;
|
||||
}
|
Загрузка…
Ссылка в новой задаче