diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /comm/mail/base/test/browser/browser_statusFeedback.js | |
parent | Initial commit. (diff) | |
download | thunderbird-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 '')
-rw-r--r-- | comm/mail/base/test/browser/browser_statusFeedback.js | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/comm/mail/base/test/browser/browser_statusFeedback.js b/comm/mail/base/test/browser/browser_statusFeedback.js new file mode 100644 index 0000000000..66132aa484 --- /dev/null +++ b/comm/mail/base/test/browser/browser_statusFeedback.js @@ -0,0 +1,71 @@ +/* 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/. */ + +const { MessageGenerator } = ChromeUtils.import( + "resource://testing-common/mailnews/MessageGenerator.jsm" +); + +const statusText = document.getElementById("statusText"); +const tabmail = document.getElementById("tabmail"); +const about3Pane = tabmail.currentAbout3Pane; +const { threadTree } = about3Pane; + +add_setup(async function () { + // Create an account for the test. + MailServices.accounts.createLocalMailAccount(); + const account = MailServices.accounts.accounts[0]; + account.addIdentity(MailServices.accounts.createIdentity()); + + // Create a folder for the account to store test messages. + const rootFolder = account.incomingServer.rootFolder; + rootFolder.createSubfolder("statusFeedback", null); + const testFolder = rootFolder + .getChildNamed("statusFeedback") + .QueryInterface(Ci.nsIMsgLocalMailFolder); + + // Generate a test message. + const generator = new MessageGenerator(); + testFolder.addMessage(generator.makeMessage().toMboxString()); + + // Use the test folder. + about3Pane.displayFolder(testFolder.URI); + await ensure_cards_view(); + + // Remove test account on cleanup. + registerCleanupFunction(() => { + MailServices.accounts.removeAccount(account, false); + }); +}); + +/** + * Tests that the correct status message appears when opening a message. + */ +add_task(async function testMessageOpen() { + const row = threadTree.getRowAtIndex(0); + const subjectLine = row.querySelector( + ".thread-card-subject-container .subject" + ); + + // Click on the email. + const selectPromise = BrowserTestUtils.waitForEvent(threadTree, "select"); + EventUtils.synthesizeMouseAtCenter( + subjectLine, + { clickCount: 1 }, + about3Pane + ); + await selectPromise; + + // Check the value of the status message. + Assert.equal( + statusText.value, + "Loading Messageā¦", + "correct status message is shown" + ); + + // Check that the status message eventually reset + await TestUtils.waitForCondition( + () => statusText.value == "", + "status message should eventually reset" + ); +}); |