blob: 66132aa4847282f19222c951c090b6b634dcbf29 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
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"
);
});
|