Backed out changeset f273ef348cb3 (bug 1776863) for causing bc failures on browser_aboutwelcome_multistage_mr.js. CLOSED TREE

This commit is contained in:
Marian-Vasile Laza 2022-07-26 11:20:49 +03:00
Родитель 6cd2d7b509
Коммит 54b26a2cf8
2 изменённых файлов: 56 добавлений и 291 удалений

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

@ -260,40 +260,38 @@ const MR_ABOUT_WELCOME_DEFAULT = {
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, youre 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,
},
},
},
},
{
@ -304,7 +302,6 @@ const MR_ABOUT_WELCOME_DEFAULT = {
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",
@ -320,31 +317,6 @@ const MR_ABOUT_WELCOME_DEFAULT = {
},
},
},
{
id: "AW_SET_DEFAULT",
content: {
position: "split",
background: "#3191f8",
progress_bar: true,
logo: {},
title: "Make Firefoxs 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: {
@ -352,9 +324,12 @@ const MR_ABOUT_WELCOME_DEFAULT = {
background: "#3191f8",
progress_bar: true,
logo: {},
title: "Lightning fast setup",
subtitle:
"Its 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:
@ -367,7 +342,9 @@ const MR_ABOUT_WELCOME_DEFAULT = {
},
},
secondary_button: {
label: "Skip this step",
label: {
string_id: "mr1-onboarding-import-secondary-button-label",
},
action: {
navigate: true,
},
@ -381,7 +358,12 @@ const MR_ABOUT_WELCOME_DEFAULT = {
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: {
@ -438,16 +420,18 @@ const MR_ABOUT_WELCOME_DEFAULT = {
},
],
},
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,
@ -455,34 +439,6 @@ const MR_ABOUT_WELCOME_DEFAULT = {
},
},
},
{
id: "AW_GRATITUDE",
content: {
position: "split",
background: "#3191f8",
progress_bar: true,
logo: {},
title: "Youre helping us build a better web.",
subtitle:
"Thank you for using Firefox, backed by the Mozilla Foundation. With your support, were working to make the internet more open, accessible, and better for everyone.",
primary_button: {
label: "See whats new",
action: {
data: {
args: "about:firefoxview",
},
type: "OPEN_URL",
navigate: true,
},
},
secondary_button: {
label: "Start browsing",
action: {
navigate: true,
},
},
},
},
],
};
@ -575,44 +531,33 @@ function getLocalizedUA(ua) {
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.
@ -674,7 +619,7 @@ async function prepareContentForReact(content) {
}
}
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.
@ -714,11 +659,7 @@ async function prepareContentForReact(content) {
}
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;

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

@ -52,40 +52,10 @@ add_task(async function test_aboutwelcome_mr_template_telemetry() {
);
});
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 template content - Browser is not Pinned and not set as default
* Test MR template content
*/
add_task(async function test_aboutwelcome_mr_template_content() {
let sandbox = sinon.createSandbox();
await pushPrefs(["browser.shell.checkDefaultBrowser", true]);
const { ShellService } = ChromeUtils.import(
"resource:///modules/ShellService.jsm"
);
sandbox.stub(ShellService, "doesAppNeedPin").returns(true);
sandbox.stub(ShellService, "isDefaultBrowser").returns(false);
let browser = await openMRAboutWelcome();
await test_screen_content(
@ -94,150 +64,4 @@ add_task(async function test_aboutwelcome_mr_template_content() {
// 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() {
let sandbox = sinon.createSandbox();
const { ShellService } = ChromeUtils.import(
"resource:///modules/ShellService.jsm"
);
await pushPrefs(["browser.shell.checkDefaultBrowser", true]);
sandbox.stub(ShellService, "isDefaultBrowser").returns(true);
sandbox.stub(ShellService, "doesAppNeedPin").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() {
let sandbox = sinon.createSandbox();
await pushPrefs(["browser.shell.checkDefaultBrowser", true]);
const { ShellService } = ChromeUtils.import(
"resource:///modules/ShellService.jsm"
);
sandbox.stub(ShellService, "doesAppNeedPin").returns(false);
sandbox.stub(ShellService, "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() {
let sandbox = sinon.createSandbox();
await pushPrefs(["browser.shell.checkDefaultBrowser", true]);
const { ShellService } = ChromeUtils.import(
"resource:///modules/ShellService.jsm"
);
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();
});