diff options
Diffstat (limited to 'browser/base/content/test/protectionsUI/browser_protectionsUI.js')
-rw-r--r-- | browser/base/content/test/protectionsUI/browser_protectionsUI.js | 119 |
1 files changed, 4 insertions, 115 deletions
diff --git a/browser/base/content/test/protectionsUI/browser_protectionsUI.js b/browser/base/content/test/protectionsUI/browser_protectionsUI.js index 98698e087e..5dc6acebf7 100644 --- a/browser/base/content/test/protectionsUI/browser_protectionsUI.js +++ b/browser/base/content/test/protectionsUI/browser_protectionsUI.js @@ -73,85 +73,16 @@ add_task(async function testToggleSwitch() { console.log(buttonEvents); is(buttonEvents.length, 1, "recorded telemetry for opening the popup"); - // Check the visibility of the "Site not working?" link. - ok( - BrowserTestUtils.isVisible( - gProtectionsHandler._protectionsPopupTPSwitchBreakageLink - ), - "The 'Site not working?' link should be visible." - ); - - // The 'Site Fixed?' link should be hidden. - ok( - BrowserTestUtils.isHidden( - gProtectionsHandler._protectionsPopupTPSwitchBreakageFixedLink - ), - "The 'Site Fixed?' link should be hidden." - ); - - // Navigate through the 'Site Not Working?' flow and back to the main view, - // checking for telemetry on the way. - let siteNotWorkingView = document.getElementById( - "protections-popup-siteNotWorkingView" - ); - let viewShown = BrowserTestUtils.waitForEvent( - siteNotWorkingView, - "ViewShown" - ); - gProtectionsHandler._protectionsPopupTPSwitchBreakageLink.click(); - await viewShown; - - checkClickTelemetry("sitenotworking_link"); - - let sendReportButton = document.getElementById( - "protections-popup-siteNotWorkingView-sendReport" - ); - let sendReportView = document.getElementById( - "protections-popup-sendReportView" - ); - viewShown = BrowserTestUtils.waitForEvent(sendReportView, "ViewShown"); - sendReportButton.click(); - await viewShown; - - checkClickTelemetry("send_report_link"); - - viewShown = BrowserTestUtils.waitForEvent(siteNotWorkingView, "ViewShown"); - sendReportView.querySelector(".subviewbutton-back").click(); - await viewShown; - - let mainView = document.getElementById("protections-popup-mainView"); - - viewShown = BrowserTestUtils.waitForEvent(mainView, "ViewShown"); - siteNotWorkingView.querySelector(".subviewbutton-back").click(); - await viewShown; + let browserLoadedPromise = BrowserTestUtils.browserLoaded(tab.linkedBrowser); - ok( - gProtectionsHandler._protectionsPopupTPSwitch.hasAttribute("pressed"), - "TP Switch should be on" - ); let popuphiddenPromise = BrowserTestUtils.waitForEvent( gProtectionsHandler._protectionsPopup, "popuphidden" ); - let browserLoadedPromise = BrowserTestUtils.browserLoaded(tab.linkedBrowser); - await clickToggle(gProtectionsHandler._protectionsPopupTPSwitch); - - // The 'Site not working?' link should be hidden after clicking the TP switch. - ok( - BrowserTestUtils.isHidden( - gProtectionsHandler._protectionsPopupTPSwitchBreakageLink - ), - "The 'Site not working?' link should be hidden after TP switch turns to off." - ); - // Same for the 'Site Fixed?' link - ok( - BrowserTestUtils.isHidden( - gProtectionsHandler._protectionsPopupTPSwitchBreakageFixedLink - ), - "The 'Site Fixed?' link should be hidden." - ); + await clickToggle(gProtectionsHandler._protectionsPopupTPSwitch); await popuphiddenPromise; + checkClickTelemetry("etp_toggle_off"); // We need to wait toast's popup shown and popup hidden events. It won't fire @@ -164,41 +95,13 @@ add_task(async function testToggleSwitch() { // Wait until the ETP state confirmation toast is shown and hides itself. await toastShown; + // Re-open the protections panel and confirm that the toggle is off, then toggle it back on. await openProtectionsPanel(); ok( !gProtectionsHandler._protectionsPopupTPSwitch.hasAttribute("pressed"), "TP Switch should be off" ); - // The 'Site not working?' link should be hidden if the TP is off. - ok( - BrowserTestUtils.isHidden( - gProtectionsHandler._protectionsPopupTPSwitchBreakageLink - ), - "The 'Site not working?' link should be hidden if TP is off." - ); - - // The 'Site Fixed?' link should be shown if TP is off. - ok( - BrowserTestUtils.isVisible( - gProtectionsHandler._protectionsPopupTPSwitchBreakageFixedLink - ), - "The 'Site Fixed?' link should be visible." - ); - - // Check telemetry for 'Site Fixed?' link. - viewShown = BrowserTestUtils.waitForEvent(sendReportView, "ViewShown"); - gProtectionsHandler._protectionsPopupTPSwitchBreakageFixedLink.click(); - await viewShown; - - checkClickTelemetry("sitenotworking_link", "sitefixed"); - - viewShown = BrowserTestUtils.waitForEvent(mainView, "ViewShown"); - sendReportView.querySelector(".subviewbutton-back").click(); - await viewShown; - - // Click the TP switch again and check the visibility of the 'Site not - // Working?'. It should be hidden after toggling the TP switch. browserLoadedPromise = BrowserTestUtils.browserLoaded(tab.linkedBrowser); popuphiddenPromise = BrowserTestUtils.waitForEvent( @@ -208,20 +111,6 @@ add_task(async function testToggleSwitch() { await clickToggle(gProtectionsHandler._protectionsPopupTPSwitch); - ok( - BrowserTestUtils.isHidden( - gProtectionsHandler._protectionsPopupTPSwitchBreakageLink - ), - `The 'Site not working?' link should be still hidden after toggling TP - switch to on from off.` - ); - ok( - BrowserTestUtils.isHidden( - gProtectionsHandler._protectionsPopupTPSwitchBreakageFixedLink - ), - "The 'Site Fixed?' link should be hidden." - ); - // Wait for the protections panel to be hidden as the result of the ETP toggle // on action. await popuphiddenPromise; |