зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1324062. Part 2 - Fix CustomizableUI test failures due to NIGHTLY-only Report Site Issue button. r=Gijs
MozReview-Commit-ID: 8fZMVz05X6n --HG-- extra : rebase_source : e5362e0c3bf83648d82f1cdf7efba442a5249d9b
This commit is contained in:
Родитель
85464e788f
Коммит
2704a86b3d
|
@ -30,7 +30,12 @@ add_task(function* testPanelPlaceholders() {
|
|||
// The value of expectedPlaceholders depends on the default palette layout.
|
||||
// Bug 1229236 is for these tests to be smarter so the test doesn't need to
|
||||
// change when the default placements change.
|
||||
let expectedPlaceholders = 1 + (isInDevEdition() ? 1 : 0);
|
||||
let expectedPlaceholders = 1;
|
||||
if (isInDevEdition()) {
|
||||
expectedPlaceholders += 1;
|
||||
} else if (isInNightly()) {
|
||||
expectedPlaceholders += 2;
|
||||
}
|
||||
is(panel.querySelectorAll(".panel-customization-placeholder").length, expectedPlaceholders, "The number of placeholders should be correct.");
|
||||
CustomizableUI.createWidget({id: kTestWidget2, label: "Pretty label", tooltiptext: "Pretty tooltip", defaultArea: CustomizableUI.AREA_PANEL});
|
||||
let elem = document.getElementById(kTestWidget2);
|
||||
|
@ -39,7 +44,7 @@ add_task(function* testPanelPlaceholders() {
|
|||
ok(wrapper, "There should be a wrapper");
|
||||
is(wrapper.firstChild.id, kTestWidget2, "Wrapper should have test widget");
|
||||
is(wrapper.parentNode, panel, "Wrapper should be in panel");
|
||||
expectedPlaceholders = isInDevEdition() ? 1 : 3;
|
||||
expectedPlaceholders = (expectedPlaceholders - 1) || 3;
|
||||
is(panel.querySelectorAll(".panel-customization-placeholder").length, expectedPlaceholders, "The number of placeholders should be correct.");
|
||||
CustomizableUI.destroyWidget(kTestWidget2);
|
||||
wrapper = document.getElementById("wrapper-" + kTestWidget2);
|
||||
|
|
|
@ -24,8 +24,9 @@ add_task(function*() {
|
|||
"add-ons-button",
|
||||
"developer-button",
|
||||
"sync-button",
|
||||
"webcompat-reporter-button"
|
||||
];
|
||||
removeDeveloperButtonIfDevEdition(placementsAfterMove);
|
||||
removeNonReleaseButtons(placementsAfterMove);
|
||||
simulateItemDrag(zoomControls, printButton);
|
||||
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
|
||||
ok(!CustomizableUI.inDefaultState, "Should no longer be in default state.");
|
||||
|
@ -52,8 +53,9 @@ add_task(function*() {
|
|||
"add-ons-button",
|
||||
"developer-button",
|
||||
"sync-button",
|
||||
"webcompat-reporter-button"
|
||||
];
|
||||
removeDeveloperButtonIfDevEdition(placementsAfterMove);
|
||||
removeNonReleaseButtons(placementsAfterMove);
|
||||
simulateItemDrag(zoomControls, savePageButton);
|
||||
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
|
||||
ok(CustomizableUI.inDefaultState, "Should be in default state.");
|
||||
|
@ -78,8 +80,9 @@ add_task(function*() {
|
|||
"add-ons-button",
|
||||
"developer-button",
|
||||
"sync-button",
|
||||
"webcompat-reporter-button"
|
||||
];
|
||||
removeDeveloperButtonIfDevEdition(placementsAfterMove);
|
||||
removeNonReleaseButtons(placementsAfterMove);
|
||||
simulateItemDrag(zoomControls, newWindowButton);
|
||||
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
|
||||
ok(CustomizableUI.inDefaultState, "Should still be in default state.");
|
||||
|
@ -103,8 +106,9 @@ add_task(function*() {
|
|||
"add-ons-button",
|
||||
"developer-button",
|
||||
"sync-button",
|
||||
"webcompat-reporter-button"
|
||||
];
|
||||
removeDeveloperButtonIfDevEdition(placementsAfterMove);
|
||||
removeNonReleaseButtons(placementsAfterMove);
|
||||
simulateItemDrag(zoomControls, historyPanelMenu);
|
||||
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
|
||||
ok(!CustomizableUI.inDefaultState, "Should no longer be in default state.");
|
||||
|
@ -132,8 +136,9 @@ add_task(function*() {
|
|||
"add-ons-button",
|
||||
"developer-button",
|
||||
"sync-button",
|
||||
"webcompat-reporter-button"
|
||||
];
|
||||
removeDeveloperButtonIfDevEdition(placementsAfterMove);
|
||||
removeNonReleaseButtons(placementsAfterMove);
|
||||
simulateItemDrag(zoomControls, preferencesButton);
|
||||
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
|
||||
ok(!CustomizableUI.inDefaultState, "Should no longer be in default state.");
|
||||
|
@ -161,8 +166,9 @@ add_task(function*() {
|
|||
"add-ons-button",
|
||||
"developer-button",
|
||||
"sync-button",
|
||||
"webcompat-reporter-button"
|
||||
];
|
||||
removeDeveloperButtonIfDevEdition(placementsAfterInsert);
|
||||
removeNonReleaseButtons(placementsAfterInsert);
|
||||
simulateItemDrag(openFileButton, zoomControls);
|
||||
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterInsert);
|
||||
ok(!CustomizableUI.inDefaultState, "Should no longer be in default state.");
|
||||
|
@ -202,8 +208,9 @@ add_task(function*() {
|
|||
"add-ons-button",
|
||||
"developer-button",
|
||||
"sync-button",
|
||||
"webcompat-reporter-button"
|
||||
];
|
||||
removeDeveloperButtonIfDevEdition(placementsAfterInsert);
|
||||
removeNonReleaseButtons(placementsAfterInsert);
|
||||
simulateItemDrag(openFileButton, editControls);
|
||||
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterInsert);
|
||||
ok(!CustomizableUI.inDefaultState, "Should no longer be in default state.");
|
||||
|
@ -240,8 +247,9 @@ add_task(function*() {
|
|||
"add-ons-button",
|
||||
"developer-button",
|
||||
"sync-button",
|
||||
"webcompat-reporter-button"
|
||||
];
|
||||
removeDeveloperButtonIfDevEdition(placementsAfterMove);
|
||||
removeNonReleaseButtons(placementsAfterMove);
|
||||
simulateItemDrag(editControls, zoomControls);
|
||||
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
|
||||
ok(CustomizableUI.inDefaultState, "Should still be in default state.");
|
||||
|
@ -266,8 +274,9 @@ add_task(function*() {
|
|||
"add-ons-button",
|
||||
"developer-button",
|
||||
"sync-button",
|
||||
"webcompat-reporter-button"
|
||||
];
|
||||
removeDeveloperButtonIfDevEdition(placementsAfterMove);
|
||||
removeNonReleaseButtons(placementsAfterMove);
|
||||
simulateItemDrag(editControls, newWindowButton);
|
||||
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
|
||||
let zoomControls = document.getElementById("zoom-controls");
|
||||
|
@ -295,8 +304,9 @@ add_task(function*() {
|
|||
"add-ons-button",
|
||||
"developer-button",
|
||||
"sync-button",
|
||||
"webcompat-reporter-button"
|
||||
];
|
||||
removeDeveloperButtonIfDevEdition(placementsAfterMove);
|
||||
removeNonReleaseButtons(placementsAfterMove);
|
||||
simulateItemDrag(editControls, privateBrowsingButton);
|
||||
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
|
||||
let zoomControls = document.getElementById("zoom-controls");
|
||||
|
@ -324,8 +334,9 @@ add_task(function*() {
|
|||
"add-ons-button",
|
||||
"developer-button",
|
||||
"sync-button",
|
||||
"webcompat-reporter-button"
|
||||
];
|
||||
removeDeveloperButtonIfDevEdition(placementsAfterMove);
|
||||
removeNonReleaseButtons(placementsAfterMove);
|
||||
simulateItemDrag(editControls, savePageButton);
|
||||
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
|
||||
let zoomControls = document.getElementById("zoom-controls");
|
||||
|
@ -353,11 +364,17 @@ add_task(function*() {
|
|||
"developer-button",
|
||||
"sync-button",
|
||||
];
|
||||
removeDeveloperButtonIfDevEdition(placementsAfterMove);
|
||||
removeNonReleaseButtons(placementsAfterMove);
|
||||
if (isInNightly()) {
|
||||
CustomizableUI.removeWidgetFromArea("webcompat-reporter-button");
|
||||
}
|
||||
simulateItemDrag(editControls, panel);
|
||||
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
|
||||
let zoomControls = document.getElementById("zoom-controls");
|
||||
simulateItemDrag(editControls, zoomControls);
|
||||
if (isInNightly()) {
|
||||
CustomizableUI.addWidgetToArea("webcompat-reporter-button", CustomizableUI.AREA_PANEL);
|
||||
}
|
||||
ok(CustomizableUI.inDefaultState, "Should still be in default state.");
|
||||
});
|
||||
|
||||
|
@ -379,8 +396,9 @@ add_task(function*() {
|
|||
"add-ons-button",
|
||||
"developer-button",
|
||||
"sync-button",
|
||||
"webcompat-reporter-button",
|
||||
];
|
||||
removeDeveloperButtonIfDevEdition(placementsAfterMove);
|
||||
removeNonReleaseButtons(placementsAfterMove);
|
||||
let paletteChildElementCount = palette.childElementCount;
|
||||
simulateItemDrag(editControls, palette);
|
||||
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
|
||||
|
@ -406,11 +424,12 @@ add_task(function*() {
|
|||
let numPlaceholders = 2;
|
||||
for (let i = 0; i < numPlaceholders; i++) {
|
||||
// This test relies on there being a specific number of widgets in the
|
||||
// panel. The addition of sync-button screwed this up, so we remove it
|
||||
// here. We should either fix the tests to not rely on the specific layout,
|
||||
// or fix bug 1007910 which would change the placeholder logic in different
|
||||
// ways. Bug 1229236 is for these tests to be smarter.
|
||||
CustomizableUI.removeWidgetFromArea("sync-button");
|
||||
// panel. The addition of sync-button and webcompat-reporter-button screwed
|
||||
// this up, so we remove them here. We should either fix the tests to not
|
||||
// rely on the specific layout, or fix bug 1007910 which would change the
|
||||
// placeholder logic in different ways. Bug 1229236 is for these tests to
|
||||
// be smarter.
|
||||
removeNonOriginalButtons();
|
||||
// NB: We can't just iterate over all of the placeholders
|
||||
// because each drag-drop action recreates them.
|
||||
let placeholder = panel.getElementsByClassName("panel-customization-placeholder")[i];
|
||||
|
@ -425,13 +444,14 @@ add_task(function*() {
|
|||
"preferences-button",
|
||||
"add-ons-button",
|
||||
"edit-controls",
|
||||
"developer-button"];
|
||||
removeDeveloperButtonIfDevEdition(placementsAfterMove);
|
||||
"developer-button",
|
||||
];
|
||||
removeNonReleaseButtons(placementsAfterMove);
|
||||
simulateItemDrag(editControls, placeholder);
|
||||
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
|
||||
let zoomControls = document.getElementById("zoom-controls");
|
||||
simulateItemDrag(editControls, zoomControls);
|
||||
CustomizableUI.addWidgetToArea("sync-button", CustomizableUI.AREA_PANEL);
|
||||
restoreNonOriginalButtons();
|
||||
ok(CustomizableUI.inDefaultState, "Should still be in default state.");
|
||||
}
|
||||
});
|
||||
|
@ -454,9 +474,10 @@ add_task(function*() {
|
|||
// Dragging a small button onto the last big button should work.
|
||||
add_task(function*() {
|
||||
// Bug 1007910 requires there be a placeholder on the final row for this
|
||||
// test to work as written. The addition of sync-button meant that's not true
|
||||
// so we remove it from here. Bug 1229236 is for these tests to be smarter.
|
||||
CustomizableUI.removeWidgetFromArea("sync-button");
|
||||
// test to work as written. The addition of sync-button and
|
||||
// webcompat-reporter-button meant that's not true so we remove them from
|
||||
// here. Bug 1229236 is for these tests to be smarter.
|
||||
removeNonOriginalButtons();
|
||||
yield startCustomizing();
|
||||
let editControls = document.getElementById("edit-controls");
|
||||
let panel = document.getElementById(CustomizableUI.AREA_PANEL);
|
||||
|
@ -472,8 +493,9 @@ add_task(function*() {
|
|||
"preferences-button",
|
||||
"add-ons-button",
|
||||
"edit-controls",
|
||||
"developer-button"];
|
||||
removeDeveloperButtonIfDevEdition(placementsAfterMove);
|
||||
"developer-button",
|
||||
];
|
||||
removeNonReleaseButtons(placementsAfterMove);
|
||||
simulateItemDrag(editControls, target);
|
||||
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
|
||||
let itemToDrag = "email-link-button"; // any button in the palette by default.
|
||||
|
@ -487,7 +509,7 @@ add_task(function*() {
|
|||
let zoomControls = document.getElementById("zoom-controls");
|
||||
simulateItemDrag(button, palette);
|
||||
simulateItemDrag(editControls, zoomControls);
|
||||
CustomizableUI.addWidgetToArea("sync-button", CustomizableUI.AREA_PANEL);
|
||||
restoreNonOriginalButtons();
|
||||
ok(CustomizableUI.inDefaultState, "Should be in default state again.");
|
||||
});
|
||||
|
||||
|
|
|
@ -21,8 +21,8 @@ add_task(function*() {
|
|||
}
|
||||
|
||||
// This test relies on an exact number of widgets being in the panel.
|
||||
// Remove the sync-button to satisfy that. (bug 1229236)
|
||||
CustomizableUI.removeWidgetFromArea("sync-button");
|
||||
// Remove the buttons to satisfy that. (bug 1229236)
|
||||
removeNonOriginalButtons();
|
||||
let panel = document.getElementById(CustomizableUI.AREA_PANEL);
|
||||
let placements = getAreaWidgetIds(CustomizableUI.AREA_PANEL);
|
||||
|
||||
|
@ -37,7 +37,7 @@ add_task(function*() {
|
|||
CustomizableUI.addWidgetToArea("developer-button", CustomizableUI.AREA_NAVBAR, 2);
|
||||
}
|
||||
|
||||
CustomizableUI.addWidgetToArea("sync-button", CustomizableUI.AREA_PANEL);
|
||||
restoreNonOriginalButtons();
|
||||
ok(CustomizableUI.inDefaultState, "Should be in default state again.");
|
||||
});
|
||||
|
||||
|
@ -50,8 +50,8 @@ add_task(function*() {
|
|||
}
|
||||
|
||||
// This test relies on an exact number of widgets being in the panel.
|
||||
// Remove the sync-button to satisfy that. (bug 1229236)
|
||||
CustomizableUI.removeWidgetFromArea("sync-button");
|
||||
// Remove the button to satisfy that. (bug 1229236)
|
||||
removeNonOriginalButtons()
|
||||
|
||||
let btn = document.getElementById("open-file-button");
|
||||
let panel = document.getElementById(CustomizableUI.AREA_PANEL);
|
||||
|
@ -81,7 +81,7 @@ add_task(function*() {
|
|||
CustomizableUI.addWidgetToArea("developer-button", CustomizableUI.AREA_NAVBAR, 2);
|
||||
}
|
||||
|
||||
CustomizableUI.addWidgetToArea("sync-button", CustomizableUI.AREA_PANEL);
|
||||
restoreNonOriginalButtons();
|
||||
ok(CustomizableUI.inDefaultState, "Should be in default state again.");
|
||||
});
|
||||
|
||||
|
@ -93,8 +93,8 @@ add_task(function*() {
|
|||
CustomizableUI.addWidgetToArea("developer-button", CustomizableUI.AREA_PANEL);
|
||||
}
|
||||
// This test relies on an exact number of widgets being in the panel.
|
||||
// Remove the sync-button to satisfy that. (bug 1229236)
|
||||
CustomizableUI.removeWidgetFromArea("sync-button");
|
||||
// Remove the buttons to satisfy that. (bug 1229236)
|
||||
removeNonOriginalButtons();
|
||||
|
||||
let btn = document.getElementById("add-ons-button");
|
||||
let btn2 = document.getElementById("developer-button");
|
||||
|
@ -123,7 +123,7 @@ add_task(function*() {
|
|||
CustomizableUI.addWidgetToArea("developer-button", CustomizableUI.AREA_NAVBAR, 2);
|
||||
}
|
||||
|
||||
CustomizableUI.addWidgetToArea("sync-button", CustomizableUI.AREA_PANEL);
|
||||
restoreNonOriginalButtons();
|
||||
ok(CustomizableUI.inDefaultState, "Should be in default state again.");
|
||||
});
|
||||
|
||||
|
@ -136,8 +136,8 @@ add_task(function*() {
|
|||
}
|
||||
|
||||
// This test relies on an exact number of widgets being in the panel.
|
||||
// Remove the sync-button to satisfy that. (bug 1229236)
|
||||
CustomizableUI.removeWidgetFromArea("sync-button");
|
||||
// Remove the buttons to satisfy that. (bug 1229236)
|
||||
removeNonOriginalButtons();
|
||||
|
||||
let btn = document.getElementById("edit-controls");
|
||||
let btn2 = document.getElementById("developer-button");
|
||||
|
@ -167,7 +167,7 @@ add_task(function*() {
|
|||
CustomizableUI.addWidgetToArea("developer-button", CustomizableUI.AREA_NAVBAR, 2);
|
||||
}
|
||||
|
||||
CustomizableUI.addWidgetToArea("sync-button", CustomizableUI.AREA_PANEL);
|
||||
restoreNonOriginalButtons();
|
||||
ok(CustomizableUI.inDefaultState, "Should be in default state again.");
|
||||
});
|
||||
|
||||
|
@ -186,8 +186,8 @@ add_task(function*() {
|
|||
ok(CustomizableUI.inDefaultState, "Should be in default state.");
|
||||
|
||||
// This test relies on an exact number of widgets being in the panel.
|
||||
// Remove the sync-button to satisfy that. (bug 1229236)
|
||||
CustomizableUI.removeWidgetFromArea("sync-button");
|
||||
// Remove the buttons to satisfy that. (bug 1229236)
|
||||
removeNonOriginalButtons();
|
||||
|
||||
is(getVisiblePlaceholderCount(panel), numPlaceholders, "Should have " + numPlaceholders + " visible placeholders before exiting");
|
||||
|
||||
|
@ -195,7 +195,7 @@ add_task(function*() {
|
|||
yield startCustomizing();
|
||||
is(getVisiblePlaceholderCount(panel), numPlaceholders, "Should have " + numPlaceholders + " visible placeholders after re-entering");
|
||||
|
||||
CustomizableUI.addWidgetToArea("sync-button", CustomizableUI.AREA_PANEL);
|
||||
restoreNonOriginalButtons();
|
||||
ok(CustomizableUI.inDefaultState, "Should still be in default state.");
|
||||
});
|
||||
|
||||
|
|
|
@ -62,9 +62,6 @@ function* openPrefsFromMenuPanel(expectedPanelId, entryPoint) {
|
|||
info("Check Sync button functionality");
|
||||
Services.prefs.setCharPref("identity.fxaccounts.remote.signup.uri", "http://example.com/");
|
||||
|
||||
// add the Sync button to the panel
|
||||
CustomizableUI.addWidgetToArea("sync-button", CustomizableUI.AREA_PANEL);
|
||||
|
||||
// check the button's functionality
|
||||
yield PanelUI.show();
|
||||
|
||||
|
@ -152,8 +149,6 @@ add_task(function* () {
|
|||
document.getElementById("sync-setup-state").hidden = true;
|
||||
document.getElementById("sync-syncnow-state").hidden = false;
|
||||
|
||||
CustomizableUI.addWidgetToArea("sync-button", CustomizableUI.AREA_PANEL);
|
||||
|
||||
let syncPanel = document.getElementById("PanelUI-remotetabs");
|
||||
let links = syncPanel.querySelectorAll(".remotetabs-promo-link");
|
||||
|
||||
|
@ -214,8 +209,6 @@ add_task(function* () {
|
|||
document.getElementById("sync-setup-state").hidden = true;
|
||||
document.getElementById("sync-syncnow-state").hidden = false;
|
||||
|
||||
// add the Sync button to the panel
|
||||
CustomizableUI.addWidgetToArea("sync-button", CustomizableUI.AREA_PANEL);
|
||||
yield PanelUI.show();
|
||||
document.getElementById("sync-button").click();
|
||||
let syncPanel = document.getElementById("PanelUI-remotetabs");
|
||||
|
|
|
@ -118,10 +118,32 @@ function isInDevEdition() {
|
|||
return AppConstants.MOZ_DEV_EDITION;
|
||||
}
|
||||
|
||||
function removeDeveloperButtonIfDevEdition(areaPanelPlacements) {
|
||||
function isInNightly() {
|
||||
return AppConstants.NIGHTLY_BUILD;
|
||||
}
|
||||
|
||||
function removeNonReleaseButtons(areaPanelPlacements) {
|
||||
if (isInDevEdition()) {
|
||||
areaPanelPlacements.splice(areaPanelPlacements.indexOf("developer-button"), 1);
|
||||
}
|
||||
|
||||
if (!isInNightly()) {
|
||||
areaPanelPlacements.splice(areaPanelPlacements.indexOf("webcompat-reporter-button"), 1);
|
||||
}
|
||||
}
|
||||
|
||||
function removeNonOriginalButtons() {
|
||||
CustomizableUI.removeWidgetFromArea("sync-button");
|
||||
if (isInNightly()) {
|
||||
CustomizableUI.removeWidgetFromArea("webcompat-reporter-button");
|
||||
}
|
||||
}
|
||||
|
||||
function restoreNonOriginalButtons() {
|
||||
CustomizableUI.addWidgetToArea("sync-button", CustomizableUI.AREA_PANEL);
|
||||
if (isInNightly()) {
|
||||
CustomizableUI.addWidgetToArea("webcompat-reporter-button", CustomizableUI.AREA_PANEL);
|
||||
}
|
||||
}
|
||||
|
||||
function assertAreaPlacements(areaId, expectedPlacements) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче