diff --git a/devtools/client/performance-new/test/browser/browser.ini b/devtools/client/performance-new/test/browser/browser.ini index 1381ed7c95f9..1c1a501b1cc5 100644 --- a/devtools/client/performance-new/test/browser/browser.ini +++ b/devtools/client/performance-new/test/browser/browser.ini @@ -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] diff --git a/devtools/client/performance-new/test/browser/browser_popup-private-browsing.js b/devtools/client/performance-new/test/browser/browser_popup-private-browsing.js new file mode 100644 index 000000000000..cd4b47c0de07 --- /dev/null +++ b/devtools/client/performance-new/test/browser/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." + ); +});