зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1551902 - Add a test for the toggle switch in the protections panel. r=johannh
Differential Revision: https://phabricator.services.mozilla.com/D32982 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
0306ad135b
Коммит
523e69c325
|
@ -0,0 +1,7 @@
|
|||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
"extends": [
|
||||
"plugin:mozilla/browser-test"
|
||||
]
|
||||
};
|
|
@ -0,0 +1,5 @@
|
|||
[DEFAULT]
|
||||
support-files =
|
||||
head.js
|
||||
|
||||
[browser_protections_UI.js]
|
|
@ -0,0 +1,19 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/* Basic UI tests for the protections panel */
|
||||
|
||||
add_task(async function testToggleSwitch() {
|
||||
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, "https://example.com");
|
||||
await openProtectionsPanel();
|
||||
ok(gProtectionsHandler._protectionsPopupTPSwitch.hasAttribute("enabled"), "TP Switch should be enabled");
|
||||
let popuphiddenPromise = BrowserTestUtils.waitForEvent(protectionsPopup, "popuphidden");
|
||||
let browserLoadedPromise = BrowserTestUtils.browserLoaded(tab.linkedBrowser);
|
||||
gProtectionsHandler._protectionsPopupTPSwitch.click();
|
||||
await popuphiddenPromise;
|
||||
await browserLoadedPromise;
|
||||
await openProtectionsPanel();
|
||||
ok(!gProtectionsHandler._protectionsPopupTPSwitch.hasAttribute("enabled"), "TP Switch should be disabled");
|
||||
Services.perms.remove(ContentBlocking._baseURIForChannelClassifier, "trackingprotection");
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
|
@ -0,0 +1,11 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
var protectionsPopup = document.getElementById("protections-popup");
|
||||
|
||||
async function openProtectionsPanel() {
|
||||
let popupShownPromise = BrowserTestUtils.waitForEvent(protectionsPopup, "popupshown");
|
||||
let identityBox = document.getElementById("identity-box");
|
||||
EventUtils.synthesizeMouseAtCenter(identityBox, { metaKey: true });
|
||||
await popupShownPromise;
|
||||
}
|
|
@ -46,6 +46,7 @@ BROWSER_CHROME_MANIFESTS += [
|
|||
'content/test/sanitize/browser.ini',
|
||||
'content/test/sidebar/browser.ini',
|
||||
'content/test/siteIdentity/browser.ini',
|
||||
'content/test/siteProtections/browser.ini',
|
||||
'content/test/static/browser.ini',
|
||||
'content/test/statuspanel/browser.ini',
|
||||
'content/test/sync/browser.ini',
|
||||
|
|
Загрузка…
Ссылка в новой задаче