Bug 1875203 - disable multistage_experimentAPI transitions test case for debug builds r=omc-reviewers,pdahiya

[try run](https://treeherder.mozilla.org/jobs?repo=try&author=nsauermann%40mozilla.com&selectedTaskRun=fqhEAWtySZaqPjLtWUVYWQ.0)

Differential Revision: https://phabricator.services.mozilla.com/D204377
This commit is contained in:
negin 2024-03-13 17:25:42 +00:00
parent f01e37b32b
commit 10b922a0a2
4 changed files with 270 additions and 269 deletions

View file

@ -56,4 +56,5 @@ skip-if = [
"os == 'linux' && debug", # Bug 1804804 - disabled on win && linux for extremely high failure rate
]
["browser_aboutwelcome_multistage_urlbar_focus.js"]
["browser_aboutwelcome_multistage_transitions.js"]
skip-if = ["debug"] # Bug 1875203

View file

@ -10,101 +10,6 @@ const { TelemetryTestUtils } = ChromeUtils.importESModule(
"resource://testing-common/TelemetryTestUtils.sys.mjs"
);
const TEST_PROTON_CONTENT = [
{
id: "AW_STEP1",
content: {
title: "Step 1",
primary_button: {
label: "Next",
action: {
navigate: true,
},
},
secondary_button: {
label: "link",
},
secondary_button_top: {
label: "link top",
action: {
type: "SHOW_FIREFOX_ACCOUNTS",
data: { entrypoint: "test" },
},
},
has_noodles: true,
},
},
{
id: "AW_STEP2",
content: {
title: "Step 2",
primary_button: {
label: "Next",
action: {
navigate: true,
},
},
secondary_button: {
label: "link",
},
has_noodles: true,
},
},
{
id: "AW_STEP3",
content: {
title: "Step 3",
tiles: {
type: "theme",
action: {
theme: "<event>",
},
data: [
{
theme: "automatic",
label: "theme-1",
tooltip: "test-tooltip",
},
{
theme: "dark",
label: "theme-2",
},
],
},
primary_button: {
label: "Next",
action: {
navigate: true,
},
},
secondary_button: {
label: "Import",
action: {
type: "SHOW_MIGRATION_WIZARD",
data: { source: "chrome" },
},
},
has_noodles: true,
},
},
{
id: "AW_STEP4",
content: {
title: "Step 4",
primary_button: {
label: "Next",
action: {
navigate: true,
},
},
secondary_button: {
label: "link",
},
has_noodles: true,
},
},
];
/**
* Test the zero onboarding using ExperimentAPI
*/
@ -354,119 +259,6 @@ add_task(async function test_multistage_aboutwelcome_experimentAPI() {
await doExperimentCleanup();
});
/**
* Test the multistage proton welcome UI using ExperimentAPI with transitions
*/
add_task(async function test_multistage_aboutwelcome_transitions() {
const sandbox = sinon.createSandbox();
await setAboutWelcomePref(true);
await ExperimentAPI.ready();
let doExperimentCleanup = await ExperimentFakes.enrollWithFeatureConfig({
featureId: "aboutwelcome",
value: {
id: "my-mochitest-experiment",
enabled: true,
screens: TEST_PROTON_CONTENT,
transitions: true,
},
});
let tab = await BrowserTestUtils.openNewForegroundTab(
gBrowser,
"about:welcome",
true
);
const browser = tab.linkedBrowser;
let aboutWelcomeActor = await getAboutWelcomeParent(browser);
// Stub AboutWelcomeParent Content Message Handler
sandbox.spy(aboutWelcomeActor, "onContentMessage");
registerCleanupFunction(() => {
BrowserTestUtils.removeTab(tab);
sandbox.restore();
});
await test_screen_content(
browser,
"multistage proton step 1",
// Expected selectors:
["div.proton.transition- .screen"],
// Unexpected selectors:
["div.proton.transition-out"]
);
// Double click should still only transition once.
await onButtonClick(browser, "button.primary");
await onButtonClick(browser, "button.primary");
await test_screen_content(
browser,
"multistage proton step 1 transition to 2",
// Expected selectors:
["div.proton.transition-out .screen", "div.proton.transition- .screen-1"]
);
await doExperimentCleanup();
});
/**
* Test the multistage proton welcome UI using ExperimentAPI without transitions
*/
add_task(async function test_multistage_aboutwelcome_transitions_off() {
const sandbox = sinon.createSandbox();
await setAboutWelcomePref(true);
await ExperimentAPI.ready();
let doExperimentCleanup = await ExperimentFakes.enrollWithFeatureConfig({
featureId: "aboutwelcome",
value: {
id: "my-mochitest-experiment",
enabled: true,
screens: TEST_PROTON_CONTENT,
transitions: false,
},
});
let tab = await BrowserTestUtils.openNewForegroundTab(
gBrowser,
"about:welcome",
true
);
const browser = tab.linkedBrowser;
let aboutWelcomeActor = await getAboutWelcomeParent(browser);
// Stub AboutWelcomeParent Content Message Handler
sandbox.spy(aboutWelcomeActor, "onContentMessage");
registerCleanupFunction(() => {
BrowserTestUtils.removeTab(tab);
sandbox.restore();
});
await test_screen_content(
browser,
"multistage proton step 1",
// Expected selectors:
["div.proton.transition- .screen"],
// Unexpected selectors:
["div.proton.transition-out"]
);
await onButtonClick(browser, "button.primary");
await test_screen_content(
browser,
"multistage proton step 1 no transition to 2",
// Expected selectors:
[],
// Unexpected selectors:
["div.proton.transition-out .screen-0"]
);
await doExperimentCleanup();
});
/* Test multistage custom backdrop
*/
add_task(async function test_multistage_aboutwelcome_backdrop() {
@ -590,3 +382,52 @@ add_task(async function test_multistage_aboutwelcome_utm_term() {
await doExperimentCleanup();
});
add_task(async function test_multistage_aboutwelcome_newtab_urlbar_focus() {
const sandbox = sinon.createSandbox();
const TEST_CONTENT = [
{
id: "TEST_SCREEN",
content: {
position: "split",
logo: {},
title: "Test newtab url focus",
primary_button: {
label: "Next",
action: {
navigate: true,
},
},
},
},
];
await setAboutWelcomePref(true);
await ExperimentAPI.ready();
await pushPrefs(["browser.aboutwelcome.newtabUrlBarFocus", true]);
const doExperimentCleanup = await ExperimentFakes.enrollWithFeatureConfig({
featureId: "aboutwelcome",
value: {
id: "my-mochitest-experiment",
screens: TEST_CONTENT,
},
});
const tab = await BrowserTestUtils.openNewForegroundTab(
gBrowser,
"about:welcome",
true
);
const browser = tab.linkedBrowser;
let focused = BrowserTestUtils.waitForEvent(gURLBar.inputField, "focus");
await onButtonClick(browser, "button.primary");
await focused;
Assert.ok(gURLBar.focused, "focus should be on url bar");
registerCleanupFunction(() => {
BrowserTestUtils.removeTab(tab);
sandbox.restore();
});
await doExperimentCleanup();
});

View file

@ -0,0 +1,219 @@
"use strict";
const { ExperimentAPI } = ChromeUtils.importESModule(
"resource://nimbus/ExperimentAPI.sys.mjs"
);
const { ExperimentFakes } = ChromeUtils.importESModule(
"resource://testing-common/NimbusTestUtils.sys.mjs"
);
const { TelemetryTestUtils } = ChromeUtils.importESModule(
"resource://testing-common/TelemetryTestUtils.sys.mjs"
);
const TEST_PROTON_CONTENT = [
{
id: "AW_STEP1",
content: {
title: "Step 1",
primary_button: {
label: "Next",
action: {
navigate: true,
},
},
secondary_button: {
label: "link",
},
secondary_button_top: {
label: "link top",
action: {
type: "SHOW_FIREFOX_ACCOUNTS",
data: { entrypoint: "test" },
},
},
has_noodles: true,
},
},
{
id: "AW_STEP2",
content: {
title: "Step 2",
primary_button: {
label: "Next",
action: {
navigate: true,
},
},
secondary_button: {
label: "link",
},
has_noodles: true,
},
},
{
id: "AW_STEP3",
content: {
title: "Step 3",
tiles: {
type: "theme",
action: {
theme: "<event>",
},
data: [
{
theme: "automatic",
label: "theme-1",
tooltip: "test-tooltip",
},
{
theme: "dark",
label: "theme-2",
},
],
},
primary_button: {
label: "Next",
action: {
navigate: true,
},
},
secondary_button: {
label: "Import",
action: {
type: "SHOW_MIGRATION_WIZARD",
data: { source: "chrome" },
},
},
has_noodles: true,
},
},
{
id: "AW_STEP4",
content: {
title: "Step 4",
primary_button: {
label: "Next",
action: {
navigate: true,
},
},
secondary_button: {
label: "link",
},
has_noodles: true,
},
},
];
/**
* Test the multistage proton welcome UI using ExperimentAPI with transitions
*/
add_task(async function test_multistage_aboutwelcome_transitions() {
const sandbox = sinon.createSandbox();
await setAboutWelcomePref(true);
await ExperimentAPI.ready();
let doExperimentCleanup = await ExperimentFakes.enrollWithFeatureConfig({
featureId: "aboutwelcome",
value: {
id: "my-mochitest-experiment",
enabled: true,
screens: TEST_PROTON_CONTENT,
transitions: true,
},
});
let tab = await BrowserTestUtils.openNewForegroundTab(
gBrowser,
"about:welcome",
true
);
const browser = tab.linkedBrowser;
let aboutWelcomeActor = await getAboutWelcomeParent(browser);
// Stub AboutWelcomeParent Content Message Handler
sandbox.spy(aboutWelcomeActor, "onContentMessage");
registerCleanupFunction(() => {
BrowserTestUtils.removeTab(tab);
sandbox.restore();
});
await test_screen_content(
browser,
"multistage proton step 1",
// Expected selectors:
["div.proton.transition- .screen"],
// Unexpected selectors:
["div.proton.transition-out"]
);
// Double click should still only transition once.
await onButtonClick(browser, "button.primary");
await onButtonClick(browser, "button.primary");
await test_screen_content(
browser,
"multistage proton step 1 transition to 2",
// Expected selectors:
["div.proton.transition-out .screen", "div.proton.transition- .screen-1"]
);
await doExperimentCleanup();
});
/**
* Test the multistage proton welcome UI using ExperimentAPI without transitions
*/
add_task(async function test_multistage_aboutwelcome_transitions_off() {
const sandbox = sinon.createSandbox();
await setAboutWelcomePref(true);
await ExperimentAPI.ready();
let doExperimentCleanup = await ExperimentFakes.enrollWithFeatureConfig({
featureId: "aboutwelcome",
value: {
id: "my-mochitest-experiment",
enabled: true,
screens: TEST_PROTON_CONTENT,
transitions: false,
},
});
let tab = await BrowserTestUtils.openNewForegroundTab(
gBrowser,
"about:welcome",
true
);
const browser = tab.linkedBrowser;
let aboutWelcomeActor = await getAboutWelcomeParent(browser);
// Stub AboutWelcomeParent Content Message Handler
sandbox.spy(aboutWelcomeActor, "onContentMessage");
registerCleanupFunction(() => {
BrowserTestUtils.removeTab(tab);
sandbox.restore();
});
await test_screen_content(
browser,
"multistage proton step 1",
// Expected selectors:
["div.proton.transition- .screen"],
// Unexpected selectors:
["div.proton.transition-out"]
);
await onButtonClick(browser, "button.primary");
await test_screen_content(
browser,
"multistage proton step 1 no transition to 2",
// Expected selectors:
[],
// Unexpected selectors:
["div.proton.transition-out .screen-0"]
);
await doExperimentCleanup();
});

View file

@ -1,60 +0,0 @@
"use strict";
const { ExperimentAPI } = ChromeUtils.importESModule(
"resource://nimbus/ExperimentAPI.sys.mjs"
);
const { ExperimentFakes } = ChromeUtils.importESModule(
"resource://testing-common/NimbusTestUtils.sys.mjs"
);
const { TelemetryTestUtils } = ChromeUtils.importESModule(
"resource://testing-common/TelemetryTestUtils.sys.mjs"
);
add_task(async function test_multistage_aboutwelcome_newtab_urlbar_focus() {
const sandbox = sinon.createSandbox();
const TEST_CONTENT = [
{
id: "TEST_SCREEN",
content: {
position: "split",
logo: {},
title: "Test newtab url focus",
primary_button: {
label: "Next",
action: {
navigate: true,
},
},
},
},
];
await setAboutWelcomePref(true);
await ExperimentAPI.ready();
await pushPrefs(["browser.aboutwelcome.newtabUrlBarFocus", true]);
const doExperimentCleanup = await ExperimentFakes.enrollWithFeatureConfig({
featureId: "aboutwelcome",
value: {
id: "my-mochitest-experiment",
screens: TEST_CONTENT,
},
});
const tab = await BrowserTestUtils.openNewForegroundTab(
gBrowser,
"about:welcome",
true
);
const browser = tab.linkedBrowser;
let focused = BrowserTestUtils.waitForEvent(gURLBar.inputField, "focus");
await onButtonClick(browser, "button.primary");
await focused;
Assert.ok(gURLBar.focused, "focus should be on url bar");
registerCleanupFunction(() => {
BrowserTestUtils.removeTab(tab);
sandbox.restore();
});
await doExperimentCleanup();
});