Bug 1634542 - Add a test for the private browsing popup support; r=canaltinova

Differential Revision: https://phabricator.services.mozilla.com/D75602
This commit is contained in:
Greg Tatum 2020-05-18 14:49:17 +00:00
Родитель 2b35eaf09a
Коммит 5c9b8bef77
2 изменённых файлов: 47 добавлений и 0 удалений

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

@ -27,3 +27,4 @@ support-files =
[browser_webchannel-enable-menu-button.js]
[browser_popup-record-capture.js]
[browser_popup-record-discard.js]
[browser_popup-private-browsing.js]

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

@ -0,0 +1,46 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
add_task(async function test() {
info(
"Test that the profiler popup gets disabled when a private browsing window is open."
);
await makeSureProfilerPopupIsEnabled();
await toggleOpenProfilerPopup();
const getRecordingButton = () =>
getElementByLabel(document, "Start Recording");
const getDisabledMessage = () =>
getElementFromDocumentByText(
document,
"The profiler is currently disabled"
);
ok(await getRecordingButton(), "The start recording button is available");
info("Open a private browsing window.");
const privateWindow = await BrowserTestUtils.openNewBrowserWindow({
private: true,
});
info("Switch back to the main window and open the popup again.");
window.focus();
await toggleOpenProfilerPopup();
ok(await getDisabledMessage(), "The disabled message is displayed.");
info("Close the private window");
await BrowserTestUtils.closeWindow(privateWindow);
info("Make sure the first window is focused, and open the popup back up.");
window.focus();
await toggleOpenProfilerPopup();
ok(
await getRecordingButton(),
"The start recording button is available once again."
);
});