Bug 1470307 - Replace open_pref_window() with open_pref_tab() in test-calendar-utils.js; r=philipp

This commit is contained in:
Geoff Lankow 2018-07-17 23:30:23 +12:00
Родитель 2090587896
Коммит ce038a0381
3 изменённых файлов: 26 добавлений и 23 удалений

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

@ -1,5 +1,6 @@
cal-recurrence
invitations
testAlarmDefaultValue.js
testBasicFunctionality.js
testLocalICS.js
testTodayPane.js

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

@ -12,6 +12,8 @@ var os = {};
ChromeUtils.import("chrome://mozmill/content/stdlib/os.js", os);
var frame = {};
ChromeUtils.import("chrome://mozmill/content/modules/frame.js", frame);
var utils = {};
ChromeUtils.import("chrome://mozmill/content/modules/utils.js", utils);
var SHORT_SLEEP = 100;
var MID_SLEEP = 500;
@ -46,7 +48,7 @@ var REC_DLG_UNTIL_INPUT = `
anon({"anonid":"input"})
`;
var plan_for_modal_dialog, wait_for_modal_dialog, open_pref_window;
var plan_for_modal_dialog, wait_for_modal_dialog, open_pref_tab;
function setupModule() {
({ plan_for_modal_dialog, wait_for_modal_dialog } =
@ -56,7 +58,7 @@ function setupModule() {
// loading of modules in shared modules does not setup the module correctly.
collector.getModule("folder-display-helpers").setupModule();
({ open_pref_window } = collector.getModule("pref-window-helpers"));
({ open_pref_tab } = collector.getModule("pref-window-helpers"));
collector.getModule("pref-window-helpers").setupModule();
}
@ -833,9 +835,12 @@ function setData(dialog, iframe, data) {
}
function openLightningPrefs(aCallback, aParentController) {
open_pref_window("paneLightning", aCallback);
aParentController.waitFor(() => mozmill.utils.getWindows("Mail:Preferences").length == 0, "Error closing preferences window", 2000);
// Since the Lightning pane is added after load, asking for it with open_pref_tab won't work. Cheat instead.
let tab = open_pref_tab("paneGeneral");
tab.browser.contentDocument.querySelector('#category-box radio[pane="paneLightning"]').click();
utils.waitFor(() => tab.browser.contentDocument.documentElement.currentPane.id == "paneLightning",
"Timed out waiting for prefpane paneLightning to load.");
aCallback(tab);
}
/**

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

@ -27,6 +27,7 @@ function setupModule(module) {
menulistSelect
} = collector.getModule("calendar-utils"));
collector.getModule("calendar-utils").setupModule();
collector.getModule("content-tab-helpers").installInto(module);
Object.assign(module, helpersForController(controller));
}
@ -79,32 +80,28 @@ function testDefaultAlarms() {
});
}
function handlePrefDialog(prefs) {
let { eid: prefsid } = helpersForController(prefs);
function handlePrefDialog(tab) {
// Click on the alarms tab
prefs.click(prefsid("calPreferencesTabAlarms"));
content_tab_e(tab, "calPreferencesTabAlarms").click();
// Turn on alarms for events and tasks
prefs.waitForElement(prefsid("eventdefalarm"));
menulistSelect(prefsid("eventdefalarm"), "1", prefs);
menulistSelect(prefsid("tododefalarm"), "1", prefs);
menulistSelect(content_tab_eid(tab, "eventdefalarm"), "1", controller);
menulistSelect(content_tab_eid(tab, "tododefalarm"), "1", controller);
// Selects "days" as a unit
menulistSelect(prefsid("tododefalarmunit"), "days", prefs);
menulistSelect(prefsid("eventdefalarmunit"), "days", prefs);
menulistSelect(content_tab_eid(tab, "tododefalarmunit"), "days", controller);
menulistSelect(content_tab_eid(tab, "eventdefalarmunit"), "days", controller);
// Sets default alarm length for events to DEFVALUE
let eventdefalarmlen = prefsid("eventdefalarmlen");
prefs.click(eventdefalarmlen);
prefs.keypress(eventdefalarmlen, "a", { accelKey: true });
prefs.type(eventdefalarmlen, DEFVALUE.toString());
let eventdefalarmlen = content_tab_eid(tab, "eventdefalarmlen");
controller.click(eventdefalarmlen);
controller.keypress(eventdefalarmlen, "a", { accelKey: true });
controller.type(eventdefalarmlen, DEFVALUE.toString());
let tododefalarmlen = prefsid("tododefalarmlen");
prefs.click(tododefalarmlen);
prefs.keypress(tododefalarmlen, "a", { accelKey: true });
prefs.type(tododefalarmlen, DEFVALUE.toString());
prefs.window.document.documentElement.acceptDialog();
let tododefalarmlen = content_tab_eid(tab, "tododefalarmlen");
controller.click(tododefalarmlen);
controller.keypress(tododefalarmlen, "a", { accelKey: true });
controller.type(tododefalarmlen, DEFVALUE.toString());
}
function teardownTest(module) {