зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1703391 - Fix browser_UITour4.js for proton urlbar. r=harry
Differential Revision: https://phabricator.services.mozilla.com/D111184
This commit is contained in:
Родитель
70c11d7795
Коммит
d4ca45c776
|
@ -282,7 +282,7 @@ var UITour = {
|
|||
],
|
||||
]),
|
||||
|
||||
nonProtonURLBarTargets: [
|
||||
nonProtonTargets: [
|
||||
[
|
||||
"pageAction-copyURL",
|
||||
{
|
||||
|
@ -350,8 +350,8 @@ var UITour = {
|
|||
);
|
||||
|
||||
// Add non-proton targets if necessary.
|
||||
if (!Services.prefs.getBoolPref("browser.proton.urlbar.enabled", false)) {
|
||||
for (let [id, target] of this.nonProtonURLBarTargets) {
|
||||
if (!UITour.protonEnabled) {
|
||||
for (let [id, target] of this.nonProtonTargets) {
|
||||
this.targets.set(id, target);
|
||||
}
|
||||
}
|
||||
|
@ -1170,7 +1170,10 @@ var UITour = {
|
|||
let shouldOpenPageActionPanel = false;
|
||||
if (this.targetIsInAppMenu(aTarget)) {
|
||||
shouldOpenAppMenu = true;
|
||||
} else if (this.targetIsInPageActionPanel(aTarget)) {
|
||||
} else if (
|
||||
this.targetIsInPageActionPanel(aTarget) &&
|
||||
!UITour.protonEnabled
|
||||
) {
|
||||
shouldOpenPageActionPanel = true;
|
||||
// Ensure the panel visibility so as to ensure the visibility of the target
|
||||
// element inside the panel otherwise we would be rejected in the below
|
||||
|
@ -1573,7 +1576,10 @@ var UITour = {
|
|||
aMenuBtn.openMenu(true);
|
||||
}
|
||||
|
||||
if (aMenuName == "appMenu" || aMenuName == "pageActionPanel") {
|
||||
if (
|
||||
aMenuName == "appMenu" ||
|
||||
(aMenuName == "pageActionPanel" && !UITour.protonEnabled)
|
||||
) {
|
||||
let menu = {
|
||||
onPanelHidden: this.onPanelHidden,
|
||||
};
|
||||
|
@ -1651,7 +1657,7 @@ var UITour = {
|
|||
closeMenuButton(menuBtn);
|
||||
} else if (aMenuName == "urlbar") {
|
||||
aWindow.gURLBar.view.close();
|
||||
} else if (aMenuName == "pageActionPanel") {
|
||||
} else if (aMenuName == "pageActionPanel" && !UITour.protonEnabled) {
|
||||
aWindow.BrowserPageActions.panelNode.hidePopup();
|
||||
}
|
||||
},
|
||||
|
|
|
@ -37,6 +37,12 @@ add_UITour_task(
|
|||
|
||||
// Test switching the highlight to the copyURL button on the page action panel
|
||||
let appMenuHiddenPromise = promisePanelElementHidden(window, appMenu);
|
||||
|
||||
// This doesn't exist in Proton.
|
||||
if (!UITour.targets.has("pageAction-copyURL")) {
|
||||
return;
|
||||
}
|
||||
|
||||
let pageActionPanelShownPromise = promisePanelElementShown(
|
||||
window,
|
||||
pageActionPanel
|
||||
|
@ -97,44 +103,52 @@ add_UITour_task(
|
|||
|
||||
let appMenu = window.PanelUI.panel;
|
||||
let pageActionPanel = BrowserPageActions.panelNode;
|
||||
|
||||
// Test showing info tooltip on the emailLink button on the page action panel
|
||||
let pageActionPanelShownPromise = promisePanelElementShown(
|
||||
window,
|
||||
pageActionPanel
|
||||
);
|
||||
let tooltipVisiblePromise = elementVisiblePromise(
|
||||
tooltip,
|
||||
"Should show info tooltip"
|
||||
);
|
||||
await showInfoPromise("pageAction-emailLink", "title", "text");
|
||||
await pageActionPanelShownPromise;
|
||||
await tooltipVisiblePromise;
|
||||
is(appMenu.state, "closed", "Shouldn't open the app menu");
|
||||
is(
|
||||
pageActionPanel.state,
|
||||
"open",
|
||||
"Should open the page action panel to show info on the copyURL button"
|
||||
);
|
||||
is(
|
||||
getShowInfoTargetName(),
|
||||
"pageAction-emailLink",
|
||||
"Should show info tooltip on the emailLink button on the page action panel"
|
||||
);
|
||||
|
||||
// Test switching info tooltip to the addons button on the app menu
|
||||
let appMenuShownPromise = promisePanelElementShown(window, appMenu);
|
||||
let pageActionPanelHiddenPromise = promisePanelElementHidden(
|
||||
window,
|
||||
pageActionPanel
|
||||
);
|
||||
tooltipVisiblePromise = elementVisiblePromise(
|
||||
tooltip,
|
||||
"Should show info tooltip"
|
||||
);
|
||||
await showInfoPromise("addons", "title", "text");
|
||||
await appMenuShownPromise;
|
||||
await pageActionPanelHiddenPromise;
|
||||
// This doesn't exist in Proton.
|
||||
if (UITour.targets.has("pageAction-emailLink")) {
|
||||
// Test showing info tooltip on the emailLink button on the page action panel
|
||||
let pageActionPanelShownPromise = promisePanelElementShown(
|
||||
window,
|
||||
pageActionPanel
|
||||
);
|
||||
await showInfoPromise("pageAction-emailLink", "title", "text");
|
||||
await pageActionPanelShownPromise;
|
||||
await tooltipVisiblePromise;
|
||||
is(appMenu.state, "closed", "Shouldn't open the app menu");
|
||||
is(
|
||||
pageActionPanel.state,
|
||||
"open",
|
||||
"Should open the page action panel to show info on the copyURL button"
|
||||
);
|
||||
is(
|
||||
getShowInfoTargetName(),
|
||||
"pageAction-emailLink",
|
||||
"Should show info tooltip on the emailLink button on the page action panel"
|
||||
);
|
||||
|
||||
// Test switching info tooltip to the addons button on the app menu
|
||||
let appMenuShownPromise = promisePanelElementShown(window, appMenu);
|
||||
let pageActionPanelHiddenPromise = promisePanelElementHidden(
|
||||
window,
|
||||
pageActionPanel
|
||||
);
|
||||
|
||||
tooltipVisiblePromise = elementVisiblePromise(
|
||||
tooltip,
|
||||
"Should show info tooltip"
|
||||
);
|
||||
await showInfoPromise("addons", "title", "text");
|
||||
await appMenuShownPromise;
|
||||
await pageActionPanelHiddenPromise;
|
||||
} else {
|
||||
let appMenuShownPromise = promisePanelElementShown(window, appMenu);
|
||||
await showInfoPromise("addons", "title", "text");
|
||||
await appMenuShownPromise;
|
||||
}
|
||||
await tooltipVisiblePromise;
|
||||
is(
|
||||
appMenu.state,
|
||||
|
@ -179,30 +193,38 @@ add_UITour_task(
|
|||
|
||||
let appMenu = window.PanelUI.panel;
|
||||
let pageActionPanel = BrowserPageActions.panelNode;
|
||||
let pageActionPanelHiddenPromise = Promise.resolve();
|
||||
|
||||
// Test highlighting the sendToDevice button on the page action panel
|
||||
let pageActionPanelShownPromise = promisePanelElementShown(
|
||||
window,
|
||||
pageActionPanel
|
||||
);
|
||||
let highlightVisiblePromise = elementVisiblePromise(
|
||||
highlight,
|
||||
"Should show highlight"
|
||||
);
|
||||
gContentAPI.showHighlight("pageAction-sendToDevice");
|
||||
await pageActionPanelShownPromise;
|
||||
await highlightVisiblePromise;
|
||||
is(appMenu.state, "closed", "Shouldn't open the app menu");
|
||||
is(
|
||||
pageActionPanel.state,
|
||||
"open",
|
||||
"Should open the page action panel to highlight the sendToDevice button"
|
||||
);
|
||||
is(
|
||||
getShowHighlightTargetName(),
|
||||
"pageAction-sendToDevice",
|
||||
"Should highlight the sendToDevice button on the page action panel"
|
||||
);
|
||||
// This doesn't exist in Proton.
|
||||
if (UITour.targets.has("pageAction-sendToDevice")) {
|
||||
// Test highlighting the sendToDevice button on the page action panel
|
||||
let pageActionPanelShownPromise = promisePanelElementShown(
|
||||
window,
|
||||
pageActionPanel
|
||||
);
|
||||
let highlightVisiblePromise = elementVisiblePromise(
|
||||
highlight,
|
||||
"Should show highlight"
|
||||
);
|
||||
gContentAPI.showHighlight("pageAction-sendToDevice");
|
||||
await pageActionPanelShownPromise;
|
||||
await highlightVisiblePromise;
|
||||
is(appMenu.state, "closed", "Shouldn't open the app menu");
|
||||
is(
|
||||
pageActionPanel.state,
|
||||
"open",
|
||||
"Should open the page action panel to highlight the sendToDevice button"
|
||||
);
|
||||
is(
|
||||
getShowHighlightTargetName(),
|
||||
"pageAction-sendToDevice",
|
||||
"Should highlight the sendToDevice button on the page action panel"
|
||||
);
|
||||
pageActionPanelHiddenPromise = promisePanelElementHidden(
|
||||
window,
|
||||
pageActionPanel
|
||||
);
|
||||
}
|
||||
|
||||
// Test showing info tooltip on the privateWindow button on the app menu
|
||||
let appMenuShownPromise = promisePanelElementShown(window, appMenu);
|
||||
|
@ -210,10 +232,6 @@ add_UITour_task(
|
|||
tooltip,
|
||||
"Should show info tooltip"
|
||||
);
|
||||
let pageActionPanelHiddenPromise = promisePanelElementHidden(
|
||||
window,
|
||||
pageActionPanel
|
||||
);
|
||||
let highlightHiddenPromise = elementHiddenPromise(
|
||||
highlight,
|
||||
"Should hide highlight"
|
||||
|
@ -283,6 +301,11 @@ add_UITour_task(
|
|||
"Should show info tooltip on the privateWindow button on the app menu"
|
||||
);
|
||||
|
||||
// This doesn't exist in Proton.
|
||||
if (!UITour.targets.has("pageAction-sendToDevice")) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Test highlighting the sendToDevice button on the page action panel
|
||||
let pageActionPanelShownPromise = promisePanelElementShown(
|
||||
window,
|
||||
|
@ -336,6 +359,11 @@ add_UITour_task(
|
|||
|
||||
add_UITour_task(
|
||||
async function test_show_appMenu_and_highligh_buttonOnPageActionPanel() {
|
||||
// This doesn't exist in Proton.
|
||||
if (!UITour.targets.has("pageAction-sendToDevice")) {
|
||||
return;
|
||||
}
|
||||
|
||||
let highlight = document.getElementById("UITourHighlight");
|
||||
is_element_hidden(highlight, "Highlight should initially be hidden");
|
||||
|
||||
|
@ -419,15 +447,17 @@ add_UITour_task(
|
|||
let appMenu = window.PanelUI.panel;
|
||||
let pageActionPanel = BrowserPageActions.panelNode;
|
||||
|
||||
// Test explicity asking for opening the page action panel
|
||||
let pageActionPanelShownPromise = promisePanelElementShown(
|
||||
window,
|
||||
pageActionPanel
|
||||
);
|
||||
gContentAPI.showMenu("pageActionPanel");
|
||||
await pageActionPanelShownPromise;
|
||||
is(appMenu.state, "closed", "Shouldn't open the app menu");
|
||||
is(pageActionPanel.state, "open", "Should open the page action panel");
|
||||
if (!gProton) {
|
||||
// Test explicity asking for opening the page action panel
|
||||
let pageActionPanelShownPromise = promisePanelElementShown(
|
||||
window,
|
||||
pageActionPanel
|
||||
);
|
||||
gContentAPI.showMenu("pageActionPanel");
|
||||
await pageActionPanelShownPromise;
|
||||
is(appMenu.state, "closed", "Shouldn't open the app menu");
|
||||
is(pageActionPanel.state, "open", "Should open the page action panel");
|
||||
}
|
||||
|
||||
// Test showing info tooltip on the privateWindow button on the app menu
|
||||
let appMenuShownPromise = promisePanelElementShown(window, appMenu);
|
||||
|
@ -445,8 +475,8 @@ add_UITour_task(
|
|||
);
|
||||
is(
|
||||
pageActionPanel.state,
|
||||
"open",
|
||||
"Shouldn't close the page action panel because it is opened explictly by api user."
|
||||
gProton ? "closed" : "open",
|
||||
"Check state of the page action panel if it was opened explictly by api user."
|
||||
);
|
||||
is(
|
||||
getShowInfoTargetName(),
|
||||
|
@ -454,13 +484,15 @@ add_UITour_task(
|
|||
"Should show info tooltip on the privateWindow button on the app menu"
|
||||
);
|
||||
|
||||
// Test hiding the page action panel wouldn't affect the info tooltip on the app menu
|
||||
let pageActionPanelHiddenPromise = promisePanelElementHidden(
|
||||
window,
|
||||
pageActionPanel
|
||||
);
|
||||
gContentAPI.hideMenu("pageActionPanel");
|
||||
await pageActionPanelHiddenPromise;
|
||||
if (!gProton) {
|
||||
// Test hiding the page action panel wouldn't affect the info tooltip on the app menu
|
||||
let pageActionPanelHiddenPromise = promisePanelElementHidden(
|
||||
window,
|
||||
pageActionPanel
|
||||
);
|
||||
gContentAPI.hideMenu("pageActionPanel");
|
||||
await pageActionPanelHiddenPromise;
|
||||
}
|
||||
is_element_visible(tooltip, "Tooltip should still be visible");
|
||||
is(appMenu.state, "open", "Shouldn't close the app menu");
|
||||
is(
|
||||
|
|
|
@ -21,7 +21,7 @@ function getExpectedTargets() {
|
|||
"library",
|
||||
"logins",
|
||||
"pageAction-bookmark",
|
||||
...(UrlbarPrefs.get("browser.proton.urlbar.enabled")
|
||||
...(gProton
|
||||
? []
|
||||
: [
|
||||
"pageAction-copyURL",
|
||||
|
|
Загрузка…
Ссылка в новой задаче