summaryrefslogtreecommitdiffstats
path: root/comm/mail/test/browser/subscribe
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /comm/mail/test/browser/subscribe
parentInitial commit. (diff)
downloadthunderbird-upstream.tar.xz
thunderbird-upstream.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'comm/mail/test/browser/subscribe')
-rw-r--r--comm/mail/test/browser/subscribe/browser.ini11
-rw-r--r--comm/mail/test/browser/subscribe/browser_newsFilter.js67
2 files changed, 78 insertions, 0 deletions
diff --git a/comm/mail/test/browser/subscribe/browser.ini b/comm/mail/test/browser/subscribe/browser.ini
new file mode 100644
index 0000000000..58ac0c93be
--- /dev/null
+++ b/comm/mail/test/browser/subscribe/browser.ini
@@ -0,0 +1,11 @@
+[DEFAULT]
+prefs =
+ mail.provider.suppress_dialog_on_startup=true
+ mail.spotlight.firstRunDone=true
+ mail.winsearch.firstRunDone=true
+ mailnews.start_page.override_url=about:blank
+ mailnews.start_page.url=about:blank
+ datareporting.policy.dataSubmissionPolicyBypassNotification=true
+subsuite = thunderbird
+
+[browser_newsFilter.js]
diff --git a/comm/mail/test/browser/subscribe/browser_newsFilter.js b/comm/mail/test/browser/subscribe/browser_newsFilter.js
new file mode 100644
index 0000000000..66ec1a0349
--- /dev/null
+++ b/comm/mail/test/browser/subscribe/browser_newsFilter.js
@@ -0,0 +1,67 @@
+/* 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/. */
+
+/* Test that the subscribe window for news servers has working autocomplete. */
+
+"use strict";
+
+var utils = ChromeUtils.import("resource://testing-common/mozmill/utils.jsm");
+
+var {
+ NNTP_PORT,
+ setupLocalServer,
+ setupNNTPDaemon,
+ shutdownNNTPServer,
+ startupNNTPServer,
+} = ChromeUtils.import("resource://testing-common/mozmill/NNTPHelpers.jsm");
+var {
+ check_newsgroup_displayed,
+ enter_text_in_search_box,
+ open_subscribe_window_from_context_menu,
+} = ChromeUtils.import(
+ "resource://testing-common/mozmill/SubscribeWindowHelpers.jsm"
+);
+
+/**
+ * Checks that the filter in the subscribe window works correctly
+ * (shows only newsgroups matching all of several search strings
+ * separated by whitespace)
+ */
+add_task(async function test_subscribe_newsgroup_filter() {
+ var daemon = setupNNTPDaemon();
+ var remoteServer = startupNNTPServer(daemon, NNTP_PORT);
+ let server = setupLocalServer(NNTP_PORT);
+ let rootFolder = server.rootFolder;
+ await new Promise(r => setTimeout(r));
+ await open_subscribe_window_from_context_menu(rootFolder, filter_test_helper);
+ shutdownNNTPServer(remoteServer);
+
+ Assert.report(
+ false,
+ undefined,
+ undefined,
+ "Test ran to completion successfully"
+ );
+});
+
+/**
+ * Helper function (callback), needed because the subscribe window is modal.
+ *
+ * @param swc Controller for the subscribe window
+ */
+function filter_test_helper(swc) {
+ enter_text_in_search_box(swc, "subscribe empty");
+ utils.waitFor(
+ () => check_newsgroup_displayed(swc, "test.subscribe.empty"),
+ "test.subscribe.empty not in the list"
+ );
+ utils.waitFor(
+ () => !check_newsgroup_displayed(swc, "test.empty"),
+ "test.empty is in the list, but should not be"
+ );
+ utils.waitFor(
+ () => !check_newsgroup_displayed(swc, "test.subscribe.simple"),
+ "test.subscribe.simple is in the list, but should not be"
+ );
+}