Backed out changeset 220e0dfd7bdc (bug 1776863) for causing failures at browser_aboutwelcome_multistage_mr.js on central. CLOSED TREE
authorButkovits Atila <abutkovits@mozilla.com>
Fri, 29 Jul 2022 10:55:14 +0300
changeset 625482 5d3ef9d591b2883ab5aaf1a77d85a7609e4e4f74
parent 625481 7ecc8473d53077b833f3884413bcfd99b63a5d00
child 625483 7b8f750002da65cb2caab57e471150e829f2674e
push id167009
push userabutkovits@mozilla.com
push dateFri, 29 Jul 2022 07:56:31 +0000
treeherderautoland@5d3ef9d591b2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1776863
milestone105.0a1
backs out220e0dfd7bdcb4c8895c5fd1638413dac2831284
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 220e0dfd7bdc (bug 1776863) for causing failures at browser_aboutwelcome_multistage_mr.js on central. CLOSED TREE
browser/components/newtab/aboutwelcome/lib/AboutWelcomeDefaults.jsm
browser/components/newtab/test/browser/browser_aboutwelcome_multistage_mr.js
--- a/browser/components/newtab/aboutwelcome/lib/AboutWelcomeDefaults.jsm
+++ b/browser/components/newtab/aboutwelcome/lib/AboutWelcomeDefaults.jsm
@@ -255,138 +255,120 @@ const MR_ABOUT_WELCOME_DEFAULT = {
   // Allow tests to easily disable transitions.
   transitions: Services.prefs.getBoolPref(
     "browser.aboutwelcome.transitions",
     true
   ),
   backdrop: "#438ab6",
   screens: [
     {
-      id: "AW_PIN_FIREFOX",
+      id: "AW_SET_DEFAULT",
       content: {
         position: "split",
         background: "#3191f8",
         progress_bar: true,
         logo: {},
-        title: "Open up an amazing internet",
-        subtitle:
-          "Launch Firefox from anywhere with a single click. Every time you do, you’re choosing a more open and independent web.",
+        hero_text: {
+          string_id: "mr1-welcome-screen-hero-text",
+        },
+        title: {
+          string_id: "mr1-onboarding-default-header",
+        },
+        subtitle: {
+          string_id: "mr1-onboarding-default-subtitle",
+        },
         primary_button: {
-          label: "Pin Firefox to taskbar",
+          label: {
+            string_id: "mr1-onboarding-default-primary-button-label",
+          },
           action: {
             navigate: true,
-            type: "PIN_FIREFOX_TO_TASKBAR",
+            type: "SET_DEFAULT_BROWSER",
           },
         },
         secondary_button: {
-          label: "Skip this step",
+          label: {
+            string_id: "mr1-onboarding-set-default-secondary-button-label",
+          },
           action: {
             navigate: true,
           },
         },
-        secondary_button_top: {
-          label: {
-            string_id: "mr1-onboarding-sign-in-button-label",
-          },
-          action: {
-            data: {
-              entrypoint: "activity-stream-firstrun",
-            },
-            type: "SHOW_FIREFOX_ACCOUNTS",
-            addFlowParams: true,
-          },
-        },
       },
     },
     {
       id: "AW_LANGUAGE_MISMATCH",
       content: {
         position: "split",
         background: "#3191f8",
         progress_bar: true,
         logo: {},
         title: { string_id: "onboarding-live-language-header" },
-        subtitle: "Firefox speaks your language",
         languageSwitcher: {
           downloading: {
             string_id: "onboarding-live-language-button-label-downloading",
           },
           cancel: {
             string_id: "onboarding-live-language-secondary-cancel-download",
           },
           waiting: { string_id: "onboarding-live-language-waiting-button" },
           skip: { string_id: "onboarding-live-language-skip-button-label" },
           action: {
             navigate: true,
           },
         },
       },
     },
     {
-      id: "AW_SET_DEFAULT",
-      content: {
-        position: "split",
-        background: "#3191f8",
-        progress_bar: true,
-        logo: {},
-        title: "Make Firefox’s indie tech your go-to browser.",
-        subtitle:
-          "Start with a browser backed by a non-profit. We defend your privacy while you zip around the web.",
-        primary_button: {
-          label: "Set as default browser",
-          action: {
-            navigate: true,
-            type: "SET_DEFAULT_BROWSER",
-          },
-        },
-        secondary_button: {
-          label: "Skip this step",
-          action: {
-            navigate: true,
-          },
-        },
-      },
-    },
-    {
       id: "AW_IMPORT_SETTINGS",
       content: {
         position: "split",
         background: "#3191f8",
         progress_bar: true,
         logo: {},
-        title: "Lightning fast setup",
-        subtitle:
-          "It’s a cinch to get Firefox how you like it. Add your bookmarks, passwords and more from your old browser.",
+        title: {
+          string_id: "mr1-onboarding-import-header",
+        },
+        subtitle: {
+          string_id: "mr1-onboarding-import-subtitle",
+        },
         primary_button: {
           label: {
             string_id:
               "mr1-onboarding-import-primary-button-label-no-attribution",
           },
           action: {
             type: "SHOW_MIGRATION_WIZARD",
             data: {},
             navigate: true,
           },
         },
         secondary_button: {
-          label: "Skip this step",
+          label: {
+            string_id: "mr1-onboarding-import-secondary-button-label",
+          },
           action: {
             navigate: true,
           },
         },
       },
     },
     {
       id: "AW_CHOOSE_THEME",
       content: {
         position: "split",
         background: "#3191f8",
         progress_bar: true,
         logo: {},
-        title: "Independent voices can change culture",
+        title: {
+          string_id: "mr1-onboarding-theme-header",
+        },
+        subtitle: {
+          string_id: "mr1-onboarding-theme-subtitle",
+        },
         tiles: {
           type: "theme",
           action: {
             theme: "<event>",
           },
           data: [
             {
               theme: "automatic",
@@ -433,61 +415,35 @@ const MR_ABOUT_WELCOME_DEFAULT = {
                 string_id: "mr1-onboarding-theme-tooltip-alpenglow",
               },
               description: {
                 string_id: "mr1-onboarding-theme-description-alpenglow",
               },
             },
           ],
         },
-        subtitle:
-          "You are an Expressionist. You see the world differently and your creations stir the emotions of others.",
         primary_button: {
-          label: "Set colorway",
+          label: {
+            string_id: "onboarding-theme-primary-button-label",
+          },
           action: {
             navigate: true,
           },
         },
         secondary_button: {
-          label: "Skip this step",
+          label: {
+            string_id: "mr1-onboarding-theme-secondary-button-label",
+          },
           action: {
             theme: "automatic",
             navigate: true,
           },
         },
       },
     },
-    {
-      id: "AW_GRATITUDE",
-      content: {
-        position: "split",
-        background: "#3191f8",
-        progress_bar: true,
-        logo: {},
-        title: "You’re helping us build a better web.",
-        subtitle:
-          "Thank you for using Firefox, backed by the Mozilla Foundation. With your support, we’re working to make the internet more open, accessible, and better for everyone.",
-        primary_button: {
-          label: "See what’s new",
-          action: {
-            data: {
-              args: "about:firefoxview",
-            },
-            type: "OPEN_URL",
-            navigate: true,
-          },
-        },
-        secondary_button: {
-          label: "Start browsing",
-          action: {
-            navigate: true,
-          },
-        },
-      },
-    },
   ],
 };
 
 async function getAddonFromRepository(data) {
   const [addonInfo] = await lazy.AddonRepository.getAddonsByIDs([data]);
   if (addonInfo.sourceURI.scheme !== "https") {
     return null;
   }
@@ -570,54 +526,43 @@ function getLocalizedUA(ua) {
     gSourceL10n = new Localization(["browser/migration.ftl"]);
   }
   if (allowedUAs.includes(ua)) {
     return gSourceL10n.formatValue(`source-name-${ua.toLowerCase()}`);
   }
   return null;
 }
 
-// Helper to find screens and remove them where applicable.
-function removeScreens(check, screens) {
-  for (let i = 0; i < screens?.length; i++) {
-    if (check(screens[i])) {
-      screens.splice(i--, 1);
-    }
-  }
-}
-
 function prepareMRContent(content) {
   // Expand with logic for finalized MR designs
-  const { screens } = content;
-
-  //If Fx is set as default, skip Import settings screen and show colorways
-  let removeDefault = !content.needDefault;
-  if (removeDefault) {
-    removeScreens(
-      screen => screen.id?.startsWith("AW_IMPORT_SETTINGS"),
-      screens
-    );
-  }
-
   return content;
 }
 
 async function prepareContentForReact(content) {
-  const { screens } = content;
-
   if (content?.template === "return_to_amo") {
     return content;
   }
 
+  if (content.templateMR) {
+    return prepareMRContent(content);
+  }
+
+  // Helper to find screens and remove them where applicable.
+  function removeScreens(check) {
+    const { screens } = content;
+    for (let i = 0; i < screens?.length; i++) {
+      if (check(screens[i])) {
+        screens.splice(i--, 1);
+      }
+    }
+  }
+
   // Change content for Windows 7 because non-light themes aren't quite right.
   if (AppConstants.isPlatformAndVersionAtMost("win", "6.1")) {
-    removeScreens(
-      screen => ["theme"].includes(screen.content?.tiles?.type),
-      screens
-    );
+    removeScreens(screen => ["theme"].includes(screen.content?.tiles?.type));
   }
 
   // Set the primary import button source based on attribution.
   if (content?.ua) {
     // If available, add the browser source to action data
     // and localized browser string args to primary button label
     const { label, action } =
       content?.screens?.find(
@@ -669,17 +614,17 @@ async function prepareContentForReact(co
       } else {
         // The "pin" screen will now handle "default" so remove other "default."
         pinScreen.content.primary_button.action.type = "SET_DEFAULT_BROWSER";
         removeDefault = true;
       }
     }
   }
   if (removeDefault) {
-    removeScreens(screen => screen.id?.startsWith("AW_SET_DEFAULT"), screens);
+    removeScreens(screen => screen.id?.startsWith("AW_SET_DEFAULT"));
   }
 
   // Remove Firefox Accounts related UI and prevent related metrics.
   if (!Services.prefs.getBoolPref("identity.fxaccounts.enabled", false)) {
     delete content.screens?.find(
       screen =>
         screen.content?.secondary_button_top?.action?.type ===
         "SHOW_FIREFOX_ACCOUNTS"
@@ -709,21 +654,17 @@ async function prepareContentForReact(co
 
       addMessageArgs(screen.content.languageSwitcher);
       addMessageArgs(screen.content);
       shouldRemoveLanguageMismatchScreen = false;
     }
   }
 
   if (shouldRemoveLanguageMismatchScreen) {
-    removeScreens(screen => screen.id === "AW_LANGUAGE_MISMATCH", screens);
-  }
-
-  if (content.templateMR) {
-    return prepareMRContent(content);
+    removeScreens(screen => screen.id === "AW_LANGUAGE_MISMATCH");
   }
 
   return content;
 }
 
 const AboutWelcomeDefaults = {
   prepareContentForReact,
   getDefaults,
--- a/browser/components/newtab/test/browser/browser_aboutwelcome_multistage_mr.js
+++ b/browser/components/newtab/test/browser/browser_aboutwelcome_multistage_mr.js
@@ -1,69 +1,44 @@
 "use strict";
 
 const MR_TEMPLATE_PREF = "browser.aboutwelcome.templateMR";
 
-const { AboutWelcomeParent } = ChromeUtils.import(
-  "resource:///actors/AboutWelcomeParent.jsm"
-);
-
 async function openMRAboutWelcome() {
   await pushPrefs([MR_TEMPLATE_PREF, true]);
   await setAboutWelcomePref(true);
   let tab = await BrowserTestUtils.openNewForegroundTab(
     gBrowser,
     "about:welcome",
     true
   );
   registerCleanupFunction(() => {
     BrowserTestUtils.removeTab(tab);
   });
 
   return tab.linkedBrowser;
 }
 
-async function clickVisibleButton(browser, selector) {
-  // eslint-disable-next-line no-shadow
-  await ContentTask.spawn(browser, { selector }, async ({ selector }) => {
-    function getVisibleElement() {
-      for (const el of content.document.querySelectorAll(selector)) {
-        if (el.offsetParent !== null) {
-          return el;
-        }
-      }
-      return null;
-    }
-    await ContentTaskUtils.waitForCondition(
-      getVisibleElement,
-      selector,
-      200, // interval
-      100 // maxTries
-    );
-    getVisibleElement().click();
-  });
-}
-
 /**
  * Test MR message telemetry
  */
 add_task(async function test_aboutwelcome_mr_template_telemetry() {
   let browser = await openMRAboutWelcome();
   let aboutWelcomeActor = await getAboutWelcomeParent(browser);
 
   let sandbox = sinon.createSandbox();
 
   // Stub AboutWelcomeParent's Content Message Handler
   const messageStub = sandbox.spy(aboutWelcomeActor, "onContentMessage");
 
   registerCleanupFunction(() => {
     sandbox.restore();
   });
 
-  await clickVisibleButton(browser, "button.secondary");
+  await onButtonClick(browser, ".action-buttons button.secondary");
 
   const { callCount } = messageStub;
   ok(callCount >= 1, `${callCount} Stub was called`);
   let clickCall;
   for (let i = 0; i < callCount; i++) {
     const call = messageStub.getCall(i);
     info(`Call #${i}: ${call.args[0]} ${JSON.stringify(call.args[1])}`);
     if (call.calledWithMatch("", { event: "CLICK_BUTTON" })) {
@@ -73,160 +48,20 @@ add_task(async function test_aboutwelcom
 
   Assert.ok(
     clickCall.args[1].message_id.startsWith("MR_WELCOME_DEFAULT"),
     "Telemetry includes MR message id"
   );
 });
 
 /**
- * Test MR template content - Browser is not Pinned and not set as default
+ * Test MR template content
  */
 add_task(async function test_aboutwelcome_mr_template_content() {
-  await pushPrefs(["browser.shell.checkDefaultBrowser", true]);
-  let sandbox = sinon.createSandbox();
-
-  sandbox.stub(AboutWelcomeParent, "doesAppNeedPin").returns(true);
-  sandbox.stub(AboutWelcomeParent, "isDefaultBrowser").returns(false);
   let browser = await openMRAboutWelcome();
 
   await test_screen_content(
     browser,
     "MR template includes screens with split position",
     // Expected selectors:
     [`main.screen[pos="split"]`]
   );
-
-  await test_screen_content(
-    browser,
-    "renders pin screen",
-    //Expected selectors:
-    ["main.AW_PIN_FIREFOX"],
-    //Unexpected selectors:
-    ["main.AW_GRATITUDE"]
-  );
-
-  await clickVisibleButton(browser, ".action-buttons button.secondary");
-
-  //should render set default
-  await test_screen_content(
-    browser,
-    "renders set default screen",
-    //Expected selectors:
-    ["main.AW_SET_DEFAULT"],
-    //Unexpected selectors:
-    ["main.AW_CHOOSE_THEME"]
-  );
-
-  await clickVisibleButton(browser, ".action-buttons button.secondary");
-
-  await test_screen_content(
-    browser,
-    "renders import settings screen",
-    //Expected selectors:
-    ["main.AW_IMPORT_SETTINGS"],
-    //Unexpected selectors:
-    ["main.AW_PIN_FIREFOX"]
-  );
-
-  await clickVisibleButton(browser, ".action-buttons button.secondary");
-
-  await test_screen_content(
-    browser,
-    "renders set colorway screen",
-    //Expected selectors:
-    ["main.AW_CHOOSE_THEME"],
-    //Unexpected selectors:
-    ["main.AW_PIN_FIREFOX"]
-  );
-
-  await clickVisibleButton(browser, ".action-buttons button.secondary");
-
-  await test_screen_content(
-    browser,
-    "renders gratitude screen",
-    //Expected selectors:
-    ["main.AW_GRATITUDE"],
-    //Unexpected selectors:
-    ["main.AW_PIN_FIREFOX"]
-  );
-
-  sandbox.restore();
 });
-
-/**
- * Test MR template content - Browser has been set as Default, not pinned
- */
-add_task(async function test_aboutwelcome_mr_template_content_default() {
-  await pushPrefs(["browser.shell.checkDefaultBrowser", true]);
-  let sandbox = sinon.createSandbox();
-
-  sandbox.stub(AboutWelcomeParent, "doesAppNeedPin").returns(true);
-  sandbox.stub(AboutWelcomeParent, "isDefaultBrowser").returns(true);
-
-  let browser = await openMRAboutWelcome();
-
-  await test_screen_content(
-    browser,
-    "renders pin screen",
-    //Expected selectors:
-    ["main.AW_PIN_FIREFOX"],
-    //Unexpected selectors:
-    ["main.AW_SET_DEFAULT"]
-  );
-
-  await clickVisibleButton(browser, ".action-buttons button.secondary");
-
-  await test_screen_content(
-    browser,
-    "renders set colorway screen",
-    //Expected selectors:
-    ["main.AW_CHOOSE_THEME"],
-    //Unexpected selectors:
-    ["main.AW_SET_DEFAULT"]
-  );
-  sandbox.restore();
-});
-
-/**
- * Test MR template content - Browser is Pinned, not default
- */
-add_task(async function test_aboutwelcome_mr_template_content() {
-  await pushPrefs(["browser.shell.checkDefaultBrowser", true]);
-  let sandbox = sinon.createSandbox();
-
-  sandbox.stub(AboutWelcomeParent, "doesAppNeedPin").returns(false);
-  sandbox.stub(AboutWelcomeParent, "isDefaultBrowser").returns(false);
-  let browser = await openMRAboutWelcome();
-
-  //should render set default
-  await test_screen_content(
-    browser,
-    "renders set default screen",
-    //Expected selectors:
-    ["main.AW_ONLY_DEFAULT"],
-    //Unexpected selectors:
-    ["main.AW_PIN_FIREFOX"]
-  );
-  sandbox.restore();
-});
-/**
- * Test MR template content - Browser is Pinned and set as default
- */
-add_task(async function test_aboutwelcome_mr_template_content() {
-  await pushPrefs(["browser.shell.checkDefaultBrowser", true]);
-  let sandbox = sinon.createSandbox();
-
-  sandbox.stub(ShellService, "doesAppNeedPin").returns(false);
-  sandbox.stub(ShellService, "isDefaultBrowser").returns(true);
-  let browser = await openMRAboutWelcome();
-
-  //should render set default
-  await test_screen_content(
-    browser,
-    "doesn't render pin and set default screens",
-    //Expected selectors:
-    ["main.AW_GET_STARTED"],
-    //Unexpected selectors:
-    ["main.AW_PIN_FIREFOX", "main.AW_ONLY_DEFAULT"]
-  );
-  sandbox.restore();
-});