From 72d9e1138532e0e85b9bf0b0de757bd3acb77af1 Mon Sep 17 00:00:00 2001 From: Richard Marti Date: Tue, 16 Jul 2019 07:46:59 +0200 Subject: [PATCH] Bug 1498332 - Fix the tests after the prefs rearrange. r=darktrojan --- .../test/mozmill/testAlarmDefaultValue.js | 4 +- mail/components/preferences/preferences.js | 6 +- .../preferences/test/browser/browser.ini | 4 - .../test/browser/browser_advanced.js | 87 ----------- .../test/browser/browser_applications.js | 25 ---- .../preferences/test/browser/browser_chat.js | 6 +- .../test/browser/browser_cloudfile.js | 6 +- .../test/browser/browser_compose.js | 28 ++-- .../test/browser/browser_display.js | 52 ------- .../test/browser/browser_general.js | 141 +++++++++++++++++- .../test/browser/browser_openPreferences.js | 38 +---- .../test/browser/browser_privacy.js | 70 ++++++++- .../preferences/test/browser/head.js | 30 ++-- .../cloudfile/test-cloudfile-manager.js | 8 +- .../pref-window/test-attachments-pane.js | 59 -------- .../mozmill/pref-window/test-font-chooser.js | 2 +- 16 files changed, 251 insertions(+), 315 deletions(-) delete mode 100644 mail/components/preferences/test/browser/browser_advanced.js delete mode 100644 mail/components/preferences/test/browser/browser_applications.js delete mode 100644 mail/components/preferences/test/browser/browser_display.js delete mode 100644 mail/test/mozmill/pref-window/test-attachments-pane.js diff --git a/calendar/test/mozmill/testAlarmDefaultValue.js b/calendar/test/mozmill/testAlarmDefaultValue.js index 5503b3c065..a1fbfc10f7 100755 --- a/calendar/test/mozmill/testAlarmDefaultValue.js +++ b/calendar/test/mozmill/testAlarmDefaultValue.js @@ -92,8 +92,8 @@ function testDefaultAlarms() { function handlePrefTab(tab) { let { replaceText } = helpersForController(controller); - // Click on the alarms tab. - content_tab_e(tab, "calPreferencesTabAlarms").click(); + // Scroll to the reminder groupbox + content_tab_e(tab, "defaultsnoozelength").scrollIntoView(); // Turn on alarms for events and tasks. menulistSelect(content_tab_eid(tab, "eventdefalarm"), "1", controller); diff --git a/mail/components/preferences/preferences.js b/mail/components/preferences/preferences.js index 2d242d5de8..019bda380c 100644 --- a/mail/components/preferences/preferences.js +++ b/mail/components/preferences/preferences.js @@ -127,7 +127,11 @@ function selectPrefPane(prefWindow, paneID, scrollPaneTo, otherArgs) { * @param subdialogID ID of button to activate, opening a subdialog */ function showTab(pane, scrollPaneTo, subdialogID) { - document.getElementById(scrollPaneTo).scrollIntoView(); + let scrollTarget = document.getElementById(scrollPaneTo); + if (scrollTarget.closest("groupbox")) { + scrollTarget = scrollTarget.closest("groupbox"); + } + scrollTarget.scrollIntoView(); if (subdialogID) { setTimeout(function() { document.getElementById(subdialogID).click(); diff --git a/mail/components/preferences/test/browser/browser.ini b/mail/components/preferences/test/browser/browser.ini index 40bb2259ff..0118ffb213 100644 --- a/mail/components/preferences/test/browser/browser.ini +++ b/mail/components/preferences/test/browser/browser.ini @@ -11,14 +11,10 @@ prefs = mailnews.start_page.url=about:blank subsuite = thunderbird -[browser_advanced.js] -[browser_applications.js] [browser_chat.js] [browser_cloudfile.js] support-files = files/icon.svg files/management.html [browser_compose.js] -[browser_display.js] [browser_general.js] [browser_openPreferences.js] [browser_privacy.js] -[browser_security.js] diff --git a/mail/components/preferences/test/browser/browser_advanced.js b/mail/components/preferences/test/browser/browser_advanced.js deleted file mode 100644 index 81edfdaa2f..0000000000 --- a/mail/components/preferences/test/browser/browser_advanced.js +++ /dev/null @@ -1,87 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, you can obtain one at http://mozilla.org/MPL/2.0/. */ - -add_task(async () => { - let tests = [{ - checkboxID: "useAutoScroll", - pref: "general.autoScroll", - }, { - checkboxID: "useSmoothScrolling", - pref: "general.smoothScroll", - }, { - checkboxID: "alwaysCheckDefault", - pref: "mail.shell.checkDefaultClient", - }, { - checkboxID: "enableGloda", - pref: "mailnews.database.global.indexer.enabled", - }, { - checkboxID: "allowHWAccel", - pref: "layers.acceleration.disabled", - prefValues: [true, false], - }]; - - // We don't want to wake up the platform search for this test. - // if (AppConstants.platform == "macosx") { - // tests.push({ - // checkboxID: "searchIntegration", - // pref: "mail.spotlight.enable", - // }); - // } else if (AppConstants.platform == "win") { - // tests.push({ - // checkboxID: "searchIntegration", - // pref: "mail.winsearch.enable", - // }); - // } - - await testCheckboxes("paneAdvanced", "advancedGeneralTab", ...tests); - - // Telemetry pref is locked. - // await testCheckboxes("paneAdvanced", "dataChoicesTab", { - // checkboxID: "submitTelemetryBox", - // pref: "toolkit.telemetry.enabled", - // }); - - await testCheckboxes("paneAdvanced", "networkingTab", { - checkboxID: "allowSmartSize", - pref: "browser.cache.disk.smart_size.enabled", - prefValues: [true, false], - enabledElements: ["#cacheSize"], - }, { - checkboxID: "offlineCompactFolder", - pref: "mail.prompt_purge_threshhold", - enabledElements: ["#offlineCompactFolderMin"], - }); - - await testCheckboxes("paneAdvanced", "certificateTab", { - checkboxID: "enableOCSP", - pref: "security.OCSP.enabled", - prefValues: [0, 1], - }); -}); - -add_task(async () => { - await testRadioButtons("paneAdvanced", "advancedGeneralTab", { - pref: "intl.regional_prefs.use_os_locales", - states: [{ - id: "appLocale", - prefValue: false, - }, { - id: "rsLocale", - prefValue: true, - }], - }); - - // Here we'd test the update choices, but I don't want to go near that. - - await testRadioButtons("paneAdvanced", "certificateTab", { - pref: "security.default_personal_cert", - states: [{ - id: "certSelectionAuto", - prefValue: "Select Automatically", - }, { - id: "certSelectionAsk", - prefValue: "Ask Every Time", - }], - }); -}); diff --git a/mail/components/preferences/test/browser/browser_applications.js b/mail/components/preferences/test/browser/browser_applications.js deleted file mode 100644 index 457ec95ffb..0000000000 --- a/mail/components/preferences/test/browser/browser_applications.js +++ /dev/null @@ -1,25 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, you can obtain one at http://mozilla.org/MPL/2.0/. */ - -add_task(async () => { - await testCheckboxes("paneApplications", "attachmentsOutTab", { - checkboxID: "enableThreshold", - pref: "mail.compose.big_attachments.notify", - enabledElements: ["#cloudFileThreshold"], - }); -}); - -add_task(async () => { - await testRadioButtons("paneApplications", "attachmentsInTab", { - pref: "browser.download.useDownloadDir", - states: [{ - id: "saveTo", - prefValue: true, - enabledElements: ["#downloadFolder", "#chooseFolder"], - }, { - id: "alwaysAsk", - prefValue: false, - }], - }); -}); diff --git a/mail/components/preferences/test/browser/browser_chat.js b/mail/components/preferences/test/browser/browser_chat.js index 414c2c69e5..b6d4c2175a 100644 --- a/mail/components/preferences/test/browser/browser_chat.js +++ b/mail/components/preferences/test/browser/browser_chat.js @@ -3,7 +3,7 @@ * file, you can obtain one at http://mozilla.org/MPL/2.0/. */ add_task(async () => { - await testCheckboxes("paneChat", "chatGeneralTab", { + await testCheckboxes("paneChat", "chatPaneCategory", { checkboxID: "reportIdle", pref: "messenger.status.reportIdle", enabledElements: ["#autoAway", "#timeBeforeAway"], @@ -23,14 +23,14 @@ add_task(async () => { }); Services.prefs.setBoolPref("messenger.status.reportIdle", true); - await testCheckboxes("paneChat", "chatGeneralTab", { + await testCheckboxes("paneChat", "chatPaneCategory", { checkboxID: "autoAway", pref: "messenger.status.awayWhenIdle", enabledElements: ["#defaultIdleAwayMessage"], }); Services.prefs.setBoolPref("mail.chat.play_sound", true); - await testRadioButtons("paneChat", "chatGeneralTab", { + await testRadioButtons("paneChat", "chatPaneCategory", { pref: "mail.chat.play_sound.type", states: [{ id: "chatSoundSystemSound", diff --git a/mail/components/preferences/test/browser/browser_cloudfile.js b/mail/components/preferences/test/browser/browser_cloudfile.js index 3be824b562..c8ff101670 100644 --- a/mail/components/preferences/test/browser/browser_cloudfile.js +++ b/mail/components/preferences/test/browser/browser_cloudfile.js @@ -31,7 +31,7 @@ add_task(async () => { // Load the preferences tab. - let { prefsDocument, prefsWindow } = await openNewPrefsTab("paneApplications", "attachmentsOutTab"); + let { prefsDocument, prefsWindow } = await openNewPrefsTab("paneCompose", "compositionAttachmentsCategory"); // Check everything is as it should be. @@ -282,13 +282,15 @@ add_task(async () => { // Load the preferences tab. - let { prefsDocument, prefsWindow } = await openNewPrefsTab("paneApplications", "attachmentsOutTab"); + let { prefsDocument, prefsWindow } = await openNewPrefsTab("paneCompose", "compositionAttachmentsCategory"); let accountList = prefsDocument.getElementById("cloudFileView"); is(accountList.itemCount, 0); let buttonList = prefsDocument.getElementById("addCloudFileAccountButtons"); ok(!buttonList.hidden); + is(buttonList.childElementCount, 2); + is(buttonList.children[0].getAttribute("value"), "Mochitest"); let menuButton = prefsDocument.getElementById("addCloudFileAccount"); ok(menuButton.hidden); diff --git a/mail/components/preferences/test/browser/browser_compose.js b/mail/components/preferences/test/browser/browser_compose.js index 94dda07e74..b8be1f065c 100644 --- a/mail/components/preferences/test/browser/browser_compose.js +++ b/mail/components/preferences/test/browser/browser_compose.js @@ -3,7 +3,7 @@ * file, you can obtain one at http://mozilla.org/MPL/2.0/. */ add_task(async () => { - await testCheckboxes("paneCompose", "generalTab", { + await testCheckboxes("paneCompose", "compositionMainCategory", { checkboxID: "addExtension", pref: "mail.forward_add_extension", }, { @@ -14,10 +14,14 @@ add_task(async () => { checkboxID: "mailWarnOnSendAccelKey", pref: "mail.warn_on_send_accel_key", }, { - checkboxID: "attachment_reminder_label", - pref: "mail.compose.attachment_reminder", - enabledElements: ["#attachment_reminder_button"], + checkboxID: "spellCheckBeforeSend", + pref: "mail.SpellCheckBeforeSend", }, { + checkboxID: "inlineSpellCheck", + pref: "mail.spellcheck.inline", + }); + + await testCheckboxes("paneCompose", "FontSelect", { checkboxID: "useReaderDefaults", pref: "msgcompose.default_colors", enabledInverted: true, @@ -32,7 +36,7 @@ add_task(async () => { pref: "mail.compose.default_to_paragraph", }); - await testCheckboxes("paneCompose", "addressingTab", { + await testCheckboxes("paneCompose", "compositionAddressingCategory", { checkboxID: "addressingAutocomplete", pref: "mail.enable_autocomplete", }, { @@ -44,12 +48,16 @@ add_task(async () => { pref: "mail.collect_email_address_outgoing", enabledElements: ["#localDirectoriesList"], }); +}); - await testCheckboxes("paneCompose", "spellingTab", { - checkboxID: "spellCheckBeforeSend", - pref: "mail.SpellCheckBeforeSend", +add_task(async () => { + await testCheckboxes("paneCompose", "compositionAttachmentsCategory", { + checkboxID: "attachment_reminder_label", + pref: "mail.compose.attachment_reminder", + enabledElements: ["#attachment_reminder_button"], }, { - checkboxID: "inlineSpellCheck", - pref: "mail.spellcheck.inline", + checkboxID: "enableThreshold", + pref: "mail.compose.big_attachments.notify", + enabledElements: ["#cloudFileThreshold"], }); }); diff --git a/mail/components/preferences/test/browser/browser_display.js b/mail/components/preferences/test/browser/browser_display.js deleted file mode 100644 index 64e7d578c8..0000000000 --- a/mail/components/preferences/test/browser/browser_display.js +++ /dev/null @@ -1,52 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, you can obtain one at http://mozilla.org/MPL/2.0/. */ - -add_task(async () => { - Services.prefs.setIntPref("mail.displayname.version", 1); - - await testCheckboxes("paneDisplay", "formattingTab", { - checkboxID: "displayGlyph", - pref: "mail.display_glyph", - }); - - await testCheckboxes("paneDisplay", "displayTab", { - checkboxID: "automaticallyMarkAsRead", - pref: "mailnews.mark_message_read.auto", - enabledElements: ["#markAsReadAutoPreferences radio"], - }, { - checkboxID: "closeMsgOnMoveOrDelete", - pref: "mail.close_message_window.on_delete", - }, { - checkboxID: "showCondensedAddresses", - pref: "mail.showCondensedAddresses", - }); -}); - -add_task(async () => { - Services.prefs.setBoolPref("mailnews.mark_message_read.auto", true); - - await testRadioButtons("paneDisplay", "displayTab", { - pref: "mailnews.mark_message_read.delay", - states: [{ - id: "mark_read_immediately", - prefValue: false, - }, { - id: "markAsReadAfterDelay", - prefValue: true, - enabledElements: ["#markAsReadDelay"], - }], - }, { - pref: "mail.openMessageBehavior", - states: [{ - id: "newTab", - prefValue: 2, - }, { - id: "newWindow", - prefValue: 0, - }, { - id: "existingWindow", - prefValue: 1, - }], - }); -}); diff --git a/mail/components/preferences/test/browser/browser_general.js b/mail/components/preferences/test/browser/browser_general.js index 311c4432c6..bb60957526 100644 --- a/mail/components/preferences/test/browser/browser_general.js +++ b/mail/components/preferences/test/browser/browser_general.js @@ -3,26 +3,49 @@ * file, you can obtain one at http://mozilla.org/MPL/2.0/. */ add_task(async () => { - let tests = [{ + await testCheckboxes("paneGeneral", "generalCategory", { checkboxID: "mailnewsStartPageEnabled", pref: "mailnews.start_page.enabled", enabledElements: ["#mailnewsStartPageUrl", "#mailnewsStartPageUrl + button"], - }]; + }, { + checkboxID: "alwaysCheckDefault", + pref: "mail.shell.checkDefaultClient", + }); +}); +add_task(async () => { + await testCheckboxes("paneGeneral", "scrollingGroup", { + checkboxID: "useAutoScroll", + pref: "general.autoScroll", + }, { + checkboxID: "useSmoothScrolling", + pref: "general.smoothScroll", + }); +}); + +add_task(async () => { + await testCheckboxes("paneGeneral", "enableGloda", { + checkboxID: "enableGloda", + pref: "mailnews.database.global.indexer.enabled", + }, { + checkboxID: "allowHWAccel", + pref: "layers.acceleration.disabled", + prefValues: [true, false], + }); +}); + +add_task(async () => { if (AppConstants.platform != "macosx") { - tests.push({ + await testCheckboxes("paneGeneral", "incomingMailCategory", { checkboxID: "newMailNotification", pref: "mail.biff.play_sound", enabledElements: ["#soundType radio"], - }); - tests.push({ + }, { checkboxID: "newMailNotificationAlert", pref: "mail.biff.show_alert", enabledElements: ["#customizeMailAlert"], }); } - - await testCheckboxes("paneGeneral", undefined, ...tests); }); add_task(async () => { @@ -32,7 +55,7 @@ add_task(async () => { Services.prefs.setBoolPref("mail.biff.play_sound", true); - await testRadioButtons("paneGeneral", undefined, { + await testRadioButtons("paneGeneral", "incomingMailCategory", { pref: "mail.biff.play_sound.type", states: [{ id: "system", @@ -44,3 +67,105 @@ add_task(async () => { }], }); }); + +add_task(async () => { + Services.prefs.setIntPref("mail.displayname.version", 1); + + await testCheckboxes("paneGeneral", "fontsGroup", { + checkboxID: "displayGlyph", + pref: "mail.display_glyph", + }); + + await testCheckboxes("paneGeneral", "readingAndDisplayCategory", { + checkboxID: "automaticallyMarkAsRead", + pref: "mailnews.mark_message_read.auto", + enabledElements: ["#markAsReadAutoPreferences radio"], + }, { + checkboxID: "closeMsgOnMoveOrDelete", + pref: "mail.close_message_window.on_delete", + }, { + checkboxID: "showCondensedAddresses", + pref: "mail.showCondensedAddresses", + }); +}); + +add_task(async () => { + Services.prefs.setBoolPref("mailnews.mark_message_read.auto", true); + + await testRadioButtons("paneGeneral", "mark_read_immediately", { + pref: "mailnews.mark_message_read.delay", + states: [{ + id: "mark_read_immediately", + prefValue: false, + }, { + id: "markAsReadAfterDelay", + prefValue: true, + enabledElements: ["#markAsReadDelay"], + }], + }, { + pref: "mail.openMessageBehavior", + states: [{ + id: "newTab", + prefValue: 2, + }, { + id: "newWindow", + prefValue: 0, + }, { + id: "existingWindow", + prefValue: 1, + }], + }); +}); + +add_task(async () => { + // We don't want to wake up the platform search for this test. + // if (AppConstants.platform == "macosx") { + // tests.push({ + // checkboxID: "searchIntegration", + // pref: "mail.spotlight.enable", + // }); + // } else if (AppConstants.platform == "win") { + // tests.push({ + // checkboxID: "searchIntegration", + // pref: "mail.winsearch.enable", + // }); + // } + + await testCheckboxes("paneGeneral", "allowSmartSize", { + checkboxID: "allowSmartSize", + pref: "browser.cache.disk.smart_size.enabled", + prefValues: [true, false], + enabledElements: ["#cacheSize"], + }, { + checkboxID: "offlineCompactFolder", + pref: "mail.prompt_purge_threshhold", + enabledElements: ["#offlineCompactFolderMin"], + }); +}); + +add_task(async () => { + await testRadioButtons("paneGeneral", "formatLocale", { + pref: "intl.regional_prefs.use_os_locales", + states: [{ + id: "appLocale", + prefValue: false, + }, { + id: "rsLocale", + prefValue: true, + }], + }); +}); + +add_task(async () => { + await testRadioButtons("paneGeneral", "filesAttachmentCategory", { + pref: "browser.download.useDownloadDir", + states: [{ + id: "saveTo", + prefValue: true, + enabledElements: ["#downloadFolder", "#chooseFolder"], + }, { + id: "alwaysAsk", + prefValue: false, + }], + }); +}); diff --git a/mail/components/preferences/test/browser/browser_openPreferences.js b/mail/components/preferences/test/browser/browser_openPreferences.js index 55edff57c7..d0487a75b5 100644 --- a/mail/components/preferences/test/browser/browser_openPreferences.js +++ b/mail/components/preferences/test/browser/browser_openPreferences.js @@ -26,42 +26,8 @@ add_task(async () => { await closePrefsTab(); // … even with a value in the XULStore. - await openNewPrefsTab("paneAdvanced"); - is(getStoredLastSelected(), "paneAdvanced"); - - await closePrefsTab(); -}); - -add_task(async () => { - // Check that openPreferencesTab with no second argument opens the right tab on a tabbed pane. - Services.xulStore.removeDocument("about:preferences"); - Services.prefs.clearUserPref("mail.preferences.display.selectedTabIndex"); - - await openNewPrefsTab("paneDisplay"); - is(getStoredLastSelected(), "paneDisplay"); - is(Services.prefs.getIntPref("mail.preferences.display.selectedTabIndex", -1), 0); - - await closePrefsTab(); -}); - -add_task(async () => { - // Check that openPreferencesTab with a second argument opens the right tab on a tabbed pane… - Services.xulStore.removeDocument("about:preferences"); - Services.prefs.clearUserPref("mail.preferences.display.selectedTabIndex"); - - let prefsDocument; - ({ prefsDocument } = await openNewPrefsTab("paneDisplay", "tagTab")); - is(getStoredLastSelected(), "paneDisplay"); - prefsDocument.getElementById("displayPrefs").selectedTab.id = "tagTab"; - is(Services.prefs.getIntPref("mail.preferences.display.selectedTabIndex", -1), 1); - - await closePrefsTab(); - - // … even with a value in the prefs. - ({ prefsDocument } = await openNewPrefsTab("paneDisplay", "displayTab")); - is(getStoredLastSelected(), "paneDisplay"); - prefsDocument.getElementById("displayPrefs").selectedTab.id = "displayTab"; - is(Services.prefs.getIntPref("mail.preferences.display.selectedTabIndex", -1), 2); + await openNewPrefsTab("paneCompose"); + is(getStoredLastSelected(), "paneCompose"); await closePrefsTab(); }); diff --git a/mail/components/preferences/test/browser/browser_privacy.js b/mail/components/preferences/test/browser/browser_privacy.js index abfcf9114e..dd6387b398 100644 --- a/mail/components/preferences/test/browser/browser_privacy.js +++ b/mail/components/preferences/test/browser/browser_privacy.js @@ -3,7 +3,7 @@ * file, you can obtain one at http://mozilla.org/MPL/2.0/. */ add_task(async () => { - await testCheckboxes("panePrivacy", undefined, { + await testCheckboxes("panePrivacy", "privacyCategory", { checkboxID: "acceptRemoteContent", pref: "mailnews.message_display.disable_remote_image", prefValues: [true, false], @@ -20,3 +20,71 @@ add_task(async () => { pref: "privacy.donottrackheader.enabled", }); }); + +add_task(async () => { + await testCheckboxes("panePrivacy", "privacyJunkCategory", { + checkboxID: "manualMark", + pref: "mail.spam.manualMark", + enabledElements: ["#manualMarkMode radio"], + }, { + checkboxID: "markAsReadOnSpam", + pref: "mail.spam.markAsReadOnSpam", + }, { + checkboxID: "enableJunkLogging", + pref: "mail.spam.logging.enabled", + enabledElements: ["#openJunkLogButton"], + }); + + await testCheckboxes("panePrivacy", "privacySecurityCategory", { + checkboxID: "enablePhishingDetector", + pref: "mail.phishing.detection.enabled", + }); + + await testCheckboxes("panePrivacy", "enableAntiVirusQuaruntine", { + checkboxID: "enableAntiVirusQuaruntine", + pref: "mailnews.downloadToTempFile", + }); +}); + +add_task(async () => { + Services.prefs.setBoolPref("mail.spam.manualMark", true); + + await testRadioButtons("panePrivacy", "privacyJunkCategory", { + pref: "mail.spam.manualMarkMode", + states: [{ + id: "manualMarkMode0", + prefValue: 0, + }, { + id: "manualMarkMode1", + prefValue: 1, + }], + }); +}); + +add_task(async () => { + // Telemetry pref is locked. + // await testCheckboxes("paneAdvanced", undefined, { + // checkboxID: "submitTelemetryBox", + // pref: "toolkit.telemetry.enabled", + // }); + + await testCheckboxes("panePrivacy", "enableOCSP", { + checkboxID: "enableOCSP", + pref: "security.OCSP.enabled", + prefValues: [0, 1], + }); +}); + +// Here we'd test the update choices, but I don't want to go near that. +add_task(async () => { + await testRadioButtons("panePrivacy", "enableOCSP", { + pref: "security.default_personal_cert", + states: [{ + id: "certSelectionAuto", + prefValue: "Select Automatically", + }, { + id: "certSelectionAsk", + prefValue: "Ask Every Time", + }], + }); +}); diff --git a/mail/components/preferences/test/browser/head.js b/mail/components/preferences/test/browser/head.js index 4a413f1bc5..fa131b641d 100644 --- a/mail/components/preferences/test/browser/head.js +++ b/mail/components/preferences/test/browser/head.js @@ -4,7 +4,7 @@ /* import-globals-from ../../../../base/content/utilityOverlay.js */ -async function openNewPrefsTab(paneID, tabID, otherArgs) { +async function openNewPrefsTab(paneID, scrollPaneTo, otherArgs) { let tabmail = document.getElementById("tabmail"); let prefsTabMode = tabmail.tabModes.preferencesTab; @@ -17,7 +17,7 @@ async function openNewPrefsTab(paneID, tabID, otherArgs) { resolve(subject); } }, "chrome-document-loaded"); - openPreferencesTab(paneID, tabID, otherArgs); + openPreferencesTab(paneID, scrollPaneTo, otherArgs); }); ok(prefsDocument.URL == "about:preferences", "Prefs tab is open"); @@ -30,15 +30,12 @@ async function openNewPrefsTab(paneID, tabID, otherArgs) { }); } - await new Promise(resolve => setTimeout(resolve)); + await new Promise(resolve => prefsWindow.setTimeout(resolve)); is(prefsWindow.getCurrentPaneID(), paneID, `Selected pane is ${paneID}`); - if (tabID) { - is(prefsDocument.querySelector(`#${paneID} tab[selected]`).id, tabID, `Selected tab is ${tabID}`); - } } else { // If we don't wait here for other scripts to run, they // could be in a bad state if our test closes the tab. - await new Promise(resolve => setTimeout(resolve)); + await new Promise(resolve => prefsWindow.setTimeout(resolve)); } registerCleanupOnce(); @@ -46,7 +43,7 @@ async function openNewPrefsTab(paneID, tabID, otherArgs) { return { prefsDocument, prefsWindow }; } -async function openExistingPrefsTab(paneID, tabID, otherArgs) { +async function openExistingPrefsTab(paneID, scrollPaneTo, otherArgs) { let tabmail = document.getElementById("tabmail"); let prefsTabMode = tabmail.tabModes.preferencesTab; @@ -58,17 +55,14 @@ async function openExistingPrefsTab(paneID, tabID, otherArgs) { if (paneID && prefsWindow.getCurrentPaneID() != paneID) { await new Promise(resolve => { prefsDocument.addEventListener("paneSelected", resolve, { once: true }); - openPreferencesTab(paneID, tabID, otherArgs); + openPreferencesTab(paneID, scrollPaneTo, otherArgs); }); } else { - openPreferencesTab(paneID, tabID, otherArgs); + openPreferencesTab(paneID, scrollPaneTo, otherArgs); } - await new Promise(resolve => setTimeout(resolve)); + await new Promise(resolve => prefsWindow.setTimeout(resolve)); is(prefsWindow.getCurrentPaneID(), paneID, `Selected pane is ${paneID}`); - if (tabID) { - is(prefsDocument.querySelector(`#${paneID} tab[selected]`).id, tabID, `Selected tab is ${tabID}`); - } registerCleanupOnce(); @@ -105,7 +99,7 @@ async function closePrefsTab() { * enabledElements - an array of CSS selectors (optional) * enabledInverted - if the elements should be disabled when the checkbox is checked (optional) */ -async function testCheckboxes(paneID, tabID, ...tests) { +async function testCheckboxes(paneID, scrollPaneTo, ...tests) { for (let initiallyChecked of [true, false]) { info(`Opening ${paneID} with prefs set to ${initiallyChecked}`); @@ -121,7 +115,7 @@ async function testCheckboxes(paneID, tabID, ...tests) { } } - let { prefsDocument, prefsWindow } = await openNewPrefsTab(paneID, tabID); + let { prefsDocument, prefsWindow } = await openNewPrefsTab(paneID, scrollPaneTo); let testUIState = function(test, checked) { let wantedValue = checked; @@ -181,7 +175,7 @@ async function testCheckboxes(paneID, tabID, ...tests) { * enabledElements - an array of CSS selectors to elements that should be enabled when this * radio button is selected (optional) */ -async function testRadioButtons(paneID, tabID, ...tests) { +async function testRadioButtons(paneID, scrollPaneTo, ...tests) { for (let { pref, states } of tests) { for (let initialState of states) { info(`Opening ${paneID} with ${pref} set to ${initialState.prefValue}`); @@ -194,7 +188,7 @@ async function testRadioButtons(paneID, tabID, ...tests) { Services.prefs.setCharPref(pref, initialState.prefValue); } - let { prefsDocument, prefsWindow } = await openNewPrefsTab(paneID, tabID); + let { prefsDocument, prefsWindow } = await openNewPrefsTab(paneID, scrollPaneTo); let testUIState = function(currentState) { info(`Testing with ${pref} set to ${currentState.prefValue}`); diff --git a/mail/test/mozmill/cloudfile/test-cloudfile-manager.js b/mail/test/mozmill/cloudfile/test-cloudfile-manager.js index 4e99923ecf..1c2133d035 100644 --- a/mail/test/mozmill/cloudfile/test-cloudfile-manager.js +++ b/mail/test/mozmill/cloudfile/test-cloudfile-manager.js @@ -75,9 +75,7 @@ function destroy_account(aKey) { * case-insensitive) */ function test_load_accounts_and_properly_order() { - let prefTab = open_pref_tab("paneApplications"); - let tabbox = content_tab_e(prefTab, "attachmentPrefs"); - tabbox.selectedIndex = 1; + let prefTab = open_pref_tab("paneCompose"); let richList = content_tab_e(prefTab, "cloudFileView"); assert_equals(4, richList.itemCount, @@ -108,9 +106,7 @@ test_external_link.__force_skip__ = true; function test_external_link() { gMockExtProtSvcReg.register(); - let prefTab = open_pref_tab("paneApplications"); - let tabbox = content_tab_e(prefTab, "attachmentPrefs"); - tabbox.selectedIndex = 1; + let prefTab = open_pref_tab("paneCompose"); content_tab_e(prefTab, "cloudFileView").selectedIndex = 0; let iframe = content_tab_e(prefTab, "cloudFileSettingsWrapper").firstElementChild; diff --git a/mail/test/mozmill/pref-window/test-attachments-pane.js b/mail/test/mozmill/pref-window/test-attachments-pane.js deleted file mode 100644 index 7311f6ff05..0000000000 --- a/mail/test/mozmill/pref-window/test-attachments-pane.js +++ /dev/null @@ -1,59 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -/** - * Tests the manager for attachment storage services - */ - -"use strict"; - -/* import-globals-from ../shared-modules/test-content-tab-helpers.js */ -/* import-globals-from ../shared-modules/test-folder-display-helpers.js */ -/* import-globals-from ../shared-modules/test-pref-window-helpers.js */ - -var MODULE_NAME = "test-attachments-pane"; -var RELATIVE_ROOT = "../shared-modules"; -var MODULE_REQUIRES = ["folder-display-helpers", "pref-window-helpers", "content-tab-helpers"]; - -function setupModule(module) { - for (let lib of MODULE_REQUIRES) { - collector.getModule(lib).installInto(module); - } -} - -/** - * Test that if we come back to the Attachment pane, then - * we'll automatically be viewing the same tab we were viewing - * last time. - */ -function test_persist_tabs() { - let prefTab = open_pref_tab("paneApplications"); - let tabbox = content_tab_e(prefTab, "attachmentPrefs"); - - // We should default to be viewing the "Outgoing" tab, which is the - // second tab, with index 1. - assert_equals(1, tabbox.selectedIndex, - "The second tab should have been selected"); - // Switch to the first tab. - tabbox.selectedIndex = 0; - close_pref_tab(prefTab); - - prefTab = open_pref_tab("paneApplications"); - tabbox = content_tab_e(prefTab, "attachmentPrefs"); - - // We should default to be viewing the first tab now. - assert_equals(0, tabbox.selectedIndex, - "The first tab selection should have been persisted"); - // Switch back to the second tab. - tabbox.selectedIndex = 1; - close_pref_tab(prefTab); - - prefTab = open_pref_tab("paneApplications"); - tabbox = content_tab_e(prefTab, "attachmentPrefs"); - - // We should default to be viewing the second tab. - assert_equals(1, tabbox.selectedIndex, - "The second tab selection should have been persisted"); - close_pref_tab(prefTab); -} diff --git a/mail/test/mozmill/pref-window/test-font-chooser.js b/mail/test/mozmill/pref-window/test-font-chooser.js index 6eaad6cea1..99c647d167 100644 --- a/mail/test/mozmill/pref-window/test-font-chooser.js +++ b/mail/test/mozmill/pref-window/test-font-chooser.js @@ -92,7 +92,7 @@ function assert_fonts_equal(aDescription, aExpected, aActual, aPrefix = false) { */ function _verify_fonts_displayed(aDefaults, aSerif, aSansSerif, aMonospace) { // Bring up the preferences window. - let prefTab = open_pref_tab("paneDisplay"); + let prefTab = open_pref_tab("paneGeneral"); let isSansDefault = (Services.prefs.getCharPref("font.default." + kLanguage) == "sans-serif");