[REF] mail, im_livechat, mrp: rename waitUntil to contains
`await contains` is shorter and reads better than `await waitUntil`. Part-of: odoo/odoo#130451
This commit is contained in:
@@ -5,7 +5,7 @@ import { startServer } from "@bus/../tests/helpers/mock_python_environment";
|
||||
import { start, setCookie, loadDefaultConfig } from "@im_livechat/../tests/embed/helper/test_utils";
|
||||
|
||||
import { Command } from "@mail/../tests/helpers/command";
|
||||
import { waitUntil } from "@mail/../tests/helpers/test_utils";
|
||||
import { contains } from "@mail/../tests/helpers/test_utils";
|
||||
|
||||
import { nextTick } from "@web/../tests/helpers/utils";
|
||||
|
||||
@@ -26,7 +26,7 @@ QUnit.test("persisted session", async (assert) => {
|
||||
const [channelInfo] = pyEnv.mockServer._mockDiscussChannelChannelInfo([channelId]);
|
||||
setCookie("im_livechat_session", JSON.stringify(channelInfo));
|
||||
start();
|
||||
await waitUntil(".o-mail-ChatWindow");
|
||||
await contains(".o-mail-ChatWindow");
|
||||
});
|
||||
|
||||
QUnit.test("rule received in init", async (assert) => {
|
||||
|
||||
@@ -5,7 +5,7 @@ import { startServer } from "@bus/../tests/helpers/mock_python_environment";
|
||||
import { loadDefaultConfig, setCookie, start } from "@im_livechat/../tests/embed/helper/test_utils";
|
||||
|
||||
import { Command } from "@mail/../tests/helpers/command";
|
||||
import { waitUntil } from "@mail/../tests/helpers/test_utils";
|
||||
import { contains } from "@mail/../tests/helpers/test_utils";
|
||||
|
||||
QUnit.module("thread service");
|
||||
|
||||
@@ -32,7 +32,7 @@ QUnit.test("new message from operator displays unread counter", async (assert) =
|
||||
thread_model: "discuss.channel",
|
||||
})
|
||||
);
|
||||
await waitUntil(".o-mail-ChatWindow-header:contains(1)");
|
||||
await contains(".o-mail-ChatWindow-header:contains(1)");
|
||||
});
|
||||
|
||||
QUnit.test("focus on unread livechat marks it as read", async (assert) => {
|
||||
@@ -58,7 +58,7 @@ QUnit.test("focus on unread livechat marks it as read", async (assert) => {
|
||||
thread_model: "discuss.channel",
|
||||
})
|
||||
);
|
||||
await waitUntil(".o-mail-Thread-newMessage ~ .o-mail-Message:contains(Are you there?)");
|
||||
await contains(".o-mail-Thread-newMessage ~ .o-mail-Message:contains(Are you there?)");
|
||||
$(".o-mail-Composer-input").trigger("focus");
|
||||
await waitUntil(".o-mail-Thread-newMessage", 0);
|
||||
await contains(".o-mail-Thread-newMessage", 0);
|
||||
});
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
import {
|
||||
afterNextRender,
|
||||
click,
|
||||
contains,
|
||||
createFile,
|
||||
start,
|
||||
startServer,
|
||||
waitUntil,
|
||||
} from "@mail/../tests/helpers/test_utils";
|
||||
|
||||
import { date_to_str } from "@web/legacy/js/core/time";
|
||||
@@ -75,8 +75,8 @@ QUnit.test("activity can upload a document", async (assert) => {
|
||||
});
|
||||
assert.containsOnce($, ".o-mail-Activity-info:contains('Upload Document')");
|
||||
inputFiles($(".o-mail-Activity .o_input_file")[0], [file]);
|
||||
await waitUntil(".o-mail-Activity-info:contains('Upload Document')", 0);
|
||||
await waitUntil("button[aria-label='Attach files']:contains(1)");
|
||||
await contains(".o-mail-Activity-info:contains('Upload Document')", 0);
|
||||
await contains("button[aria-label='Attach files']:contains(1)");
|
||||
});
|
||||
|
||||
QUnit.test("activity simplest layout", async (assert) => {
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
} from "@mail/core/common/chat_window_service";
|
||||
import { Command } from "@mail/../tests/helpers/command";
|
||||
import { patchUiSize } from "@mail/../tests/helpers/patch_ui_size";
|
||||
import { start, startServer, click, waitUntil } from "@mail/../tests/helpers/test_utils";
|
||||
import { click, contains, start, startServer } from "@mail/../tests/helpers/test_utils";
|
||||
|
||||
QUnit.module("chat window manager");
|
||||
|
||||
@@ -122,7 +122,7 @@ QUnit.test(
|
||||
await click(".o-mail-NotificationItem:contains(channel-C)");
|
||||
await click(".o_menu_systray i[aria-label='Messages']");
|
||||
await click(".o-mail-NotificationItem:contains(channel-D)");
|
||||
await waitUntil(
|
||||
await contains(
|
||||
".o-mail-ChatWindow-header:contains(channel-D) .o-mail-ChatWindow-command[title='Close Chat Window']"
|
||||
);
|
||||
assert.containsN($, ".o-mail-ChatWindow", 2);
|
||||
|
||||
@@ -10,13 +10,13 @@ import { patchUiSize, SIZES } from "@mail/../tests/helpers/patch_ui_size";
|
||||
import {
|
||||
afterNextRender,
|
||||
click,
|
||||
contains,
|
||||
createFile,
|
||||
insertText,
|
||||
isScrolledToBottom,
|
||||
nextAnimationFrame,
|
||||
start,
|
||||
startServer,
|
||||
waitUntil,
|
||||
} from "@mail/../tests/helpers/test_utils";
|
||||
|
||||
import { nextTick, triggerEvent, triggerHotkey } from "@web/../tests/helpers/utils";
|
||||
@@ -924,17 +924,17 @@ QUnit.test("chat window: composer state conservation on toggle discuss", async (
|
||||
}),
|
||||
];
|
||||
inputFiles($(".o-mail-Composer-coreMain .o_input_file")[0], files);
|
||||
await waitUntil(".o-mail-AttachmentCard .fa-check", 2);
|
||||
await contains(".o-mail-AttachmentCard .fa-check", 2);
|
||||
|
||||
openDiscuss();
|
||||
await waitUntil(".o-mail-ChatWindow", 0);
|
||||
await contains(".o-mail-ChatWindow", 0);
|
||||
|
||||
openView({
|
||||
res_id: channelId,
|
||||
res_model: "discuss.channel",
|
||||
views: [[false, "form"]],
|
||||
});
|
||||
await waitUntil(".o-mail-Composer-footer .o-mail-AttachmentList .o-mail-AttachmentCard", 2);
|
||||
await contains(".o-mail-Composer-footer .o-mail-AttachmentList .o-mail-AttachmentCard", 2);
|
||||
assert.strictEqual($(".o-mail-Composer-input").val(), "XDU for the win !");
|
||||
});
|
||||
|
||||
@@ -1161,7 +1161,7 @@ QUnit.test("Open chat window of new inviter", async (assert) => {
|
||||
username: "Newbie",
|
||||
partnerId,
|
||||
});
|
||||
await waitUntil(".o-mail-ChatWindow:contains(Newbie)");
|
||||
await contains(".o-mail-ChatWindow:contains(Newbie)");
|
||||
assert.containsOnce(
|
||||
$,
|
||||
".o_notification:contains(Newbie connected. This is their first connection. Wish them luck.)"
|
||||
|
||||
@@ -6,6 +6,7 @@ import { patchUiSize, SIZES } from "@mail/../tests/helpers/patch_ui_size";
|
||||
import {
|
||||
afterNextRender,
|
||||
click,
|
||||
contains,
|
||||
createFile,
|
||||
dragenterFiles,
|
||||
dropFiles,
|
||||
@@ -13,7 +14,6 @@ import {
|
||||
pasteFiles,
|
||||
start,
|
||||
startServer,
|
||||
waitUntil,
|
||||
} from "@mail/../tests/helpers/test_utils";
|
||||
|
||||
import { makeFakeNotificationService } from "@web/../tests/helpers/mock_services";
|
||||
@@ -701,7 +701,7 @@ QUnit.test("composer: add an attachment", async (assert) => {
|
||||
name: "text.txt",
|
||||
});
|
||||
inputFiles($(".o-mail-Composer-coreMain .o_input_file")[0], [file]);
|
||||
await waitUntil(".o-mail-AttachmentCard .fa-check");
|
||||
await contains(".o-mail-AttachmentCard .fa-check");
|
||||
|
||||
assert.containsOnce($, ".o-mail-Composer-footer .o-mail-AttachmentList");
|
||||
assert.containsOnce($, ".o-mail-Composer-footer .o-mail-AttachmentList .o-mail-AttachmentCard");
|
||||
@@ -731,7 +731,7 @@ QUnit.test("composer: add an attachment in reply to message in history", async (
|
||||
name: "text.txt",
|
||||
});
|
||||
inputFiles($(".o-mail-Composer-coreMain .o_input_file")[0], [file]);
|
||||
await waitUntil(".o-mail-AttachmentCard .fa-check");
|
||||
await contains(".o-mail-AttachmentCard .fa-check");
|
||||
|
||||
assert.containsOnce($, ".o-mail-Composer-footer .o-mail-AttachmentList");
|
||||
assert.containsOnce($, ".o-mail-Composer-footer .o-mail-AttachmentList .o-mail-AttachmentCard");
|
||||
@@ -757,7 +757,7 @@ QUnit.test(
|
||||
name: "text.txt",
|
||||
});
|
||||
inputFiles($(".o-mail-Composer-coreMain .o_input_file")[0], [file]);
|
||||
await waitUntil(".o-mail-AttachmentCard.o-isUploading");
|
||||
await contains(".o-mail-AttachmentCard.o-isUploading");
|
||||
assert.containsOnce($, ".o-mail-Composer-send");
|
||||
assert.ok($(".o-mail-Composer-send")[0].attributes.disabled);
|
||||
|
||||
@@ -781,7 +781,7 @@ QUnit.test("remove an attachment from composer does not need any confirmation",
|
||||
name: "text.txt",
|
||||
});
|
||||
inputFiles($(".o-mail-Composer-coreMain .o_input_file")[0], [file]);
|
||||
await waitUntil(".o-mail-AttachmentCard .fa-check");
|
||||
await contains(".o-mail-AttachmentCard .fa-check");
|
||||
assert.containsOnce($, ".o-mail-Composer-footer .o-mail-AttachmentList");
|
||||
assert.containsOnce($, ".o-mail-AttachmentList .o-mail-AttachmentCard");
|
||||
|
||||
@@ -843,10 +843,10 @@ QUnit.test("remove an uploading attachment", async (assert) => {
|
||||
name: "text.txt",
|
||||
});
|
||||
inputFiles($(".o-mail-Composer-coreMain .o_input_file")[0], [file]);
|
||||
await waitUntil(".o-mail-AttachmentCard.o-isUploading");
|
||||
await contains(".o-mail-AttachmentCard.o-isUploading");
|
||||
|
||||
click(".o-mail-AttachmentCard-unlink");
|
||||
await waitUntil(".o-mail-Composer .o-mail-AttachmentCard", 0);
|
||||
await contains(".o-mail-Composer .o-mail-AttachmentCard", 0);
|
||||
});
|
||||
|
||||
QUnit.test("Show a thread name in the recipient status text.", async (assert) => {
|
||||
@@ -923,8 +923,8 @@ QUnit.test(
|
||||
contentType: "text/plain",
|
||||
});
|
||||
inputFiles($(".o-mail-Composer-coreMain .o_input_file")[0], [file1, file2]);
|
||||
await waitUntil(".o-mail-AttachmentCard:contains(text1.txt)");
|
||||
await waitUntil(".o-mail-AttachmentCard:contains(text2.txt)");
|
||||
await contains(".o-mail-AttachmentCard:contains(text1.txt)");
|
||||
await contains(".o-mail-AttachmentCard:contains(text2.txt)");
|
||||
assert.containsN($, ".o-mail-AttachmentCard-aside div[title='Uploading']", 2);
|
||||
}
|
||||
);
|
||||
@@ -948,7 +948,7 @@ QUnit.test(
|
||||
});
|
||||
openDiscuss(channelId);
|
||||
const [input, file1, file2] = await Promise.all([
|
||||
waitUntil(".o-mail-Composer-coreMain .o_input_file"),
|
||||
contains(".o-mail-Composer-coreMain .o_input_file"),
|
||||
createFile({
|
||||
name: "text1.txt",
|
||||
content: "hello, world",
|
||||
@@ -961,15 +961,15 @@ QUnit.test(
|
||||
}),
|
||||
]);
|
||||
inputFiles(input[0], [file1, file2]);
|
||||
await waitUntil(".o-mail-AttachmentCard.o-isUploading:contains(text1.txt)");
|
||||
await waitUntil(".o-mail-AttachmentCard.o-isUploading:contains(text2.txt)");
|
||||
await contains(".o-mail-AttachmentCard.o-isUploading:contains(text1.txt)");
|
||||
await contains(".o-mail-AttachmentCard.o-isUploading:contains(text2.txt)");
|
||||
|
||||
click(".o-mail-AttachmentCard-unlink:eq(1)");
|
||||
await waitUntil(".o-mail-AttachmentCard:contains(text2.txt)", 0);
|
||||
await contains(".o-mail-AttachmentCard:contains(text2.txt)", 0);
|
||||
|
||||
// Simulates the completion of the upload of the first attachment
|
||||
uploadPromise.resolve();
|
||||
await waitUntil('.o-mail-AttachmentCard:not(.o-isUploading):contains("text1.txt")');
|
||||
await contains('.o-mail-AttachmentCard:not(.o-isUploading):contains("text1.txt")');
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
import {
|
||||
afterNextRender,
|
||||
click,
|
||||
contains,
|
||||
start,
|
||||
startServer,
|
||||
waitUntil,
|
||||
} from "@mail/../tests/helpers/test_utils";
|
||||
|
||||
import { triggerHotkey, patchWithCleanup } from "@web/../tests/helpers/utils";
|
||||
@@ -190,14 +190,14 @@ QUnit.test("Message delete notification", async (assert) => {
|
||||
});
|
||||
const { openDiscuss } = await start();
|
||||
openDiscuss();
|
||||
(await waitUntil("[title='Expand']")).click();
|
||||
(await waitUntil("[title='Mark as Todo']")).click();
|
||||
await waitUntil("button:contains(Inbox) .badge");
|
||||
await waitUntil("button:contains(Starred) .badge");
|
||||
(await contains("[title='Expand']")).click();
|
||||
(await contains("[title='Mark as Todo']")).click();
|
||||
await contains("button:contains(Inbox) .badge");
|
||||
await contains("button:contains(Starred) .badge");
|
||||
pyEnv["bus.bus"]._sendone(pyEnv.currentPartner, "mail.message/delete", {
|
||||
message_ids: [messageId],
|
||||
});
|
||||
await waitUntil(".o-mail-Message", 0);
|
||||
await waitUntil("button:contains(Inbox) .badge", 0);
|
||||
await waitUntil("button:contains(Starred) .badge", 0);
|
||||
await contains(".o-mail-Message", 0);
|
||||
await contains("button:contains(Inbox) .badge", 0);
|
||||
await contains("button:contains(Starred) .badge", 0);
|
||||
});
|
||||
|
||||
@@ -4,10 +4,10 @@ import { Command } from "@mail/../tests/helpers/command";
|
||||
import {
|
||||
afterNextRender,
|
||||
click,
|
||||
contains,
|
||||
mockGetMedia,
|
||||
start,
|
||||
startServer,
|
||||
waitUntil,
|
||||
} from "@mail/../tests/helpers/test_utils";
|
||||
|
||||
import { browser } from "@web/core/browser/browser";
|
||||
@@ -60,11 +60,11 @@ QUnit.test("should not display call UI when no more members (self disconnect)",
|
||||
const channelId = pyEnv["discuss.channel"].create({ name: "General" });
|
||||
const { openDiscuss } = await start();
|
||||
openDiscuss(channelId);
|
||||
(await waitUntil(".o-mail-Discuss-header button[title='Start a Call']")).click();
|
||||
await waitUntil(".o-discuss-Call");
|
||||
(await contains(".o-mail-Discuss-header button[title='Start a Call']")).click();
|
||||
await contains(".o-discuss-Call");
|
||||
|
||||
click(".o-discuss-CallActionList button[aria-label='Disconnect']");
|
||||
await waitUntil(".o-discuss-Call", 0);
|
||||
await contains(".o-discuss-Call", 0);
|
||||
});
|
||||
|
||||
QUnit.test("show call UI in chat window when in call", async (assert) => {
|
||||
@@ -202,8 +202,8 @@ QUnit.test("Create a direct message channel when clicking on start a meeting", a
|
||||
mockGetMedia();
|
||||
const { openDiscuss } = await start();
|
||||
openDiscuss();
|
||||
(await waitUntil("button:contains(Start a meeting)")).click();
|
||||
await waitUntil(".o-mail-DiscussSidebarChannel:contains(Mitchell Admin)");
|
||||
await waitUntil(".o-discuss-Call");
|
||||
await waitUntil(".o-discuss-ChannelInvitation");
|
||||
(await contains("button:contains(Start a meeting)")).click();
|
||||
await contains(".o-mail-DiscussSidebarChannel:contains(Mitchell Admin)");
|
||||
await contains(".o-discuss-Call");
|
||||
await contains(".o-discuss-ChannelInvitation");
|
||||
});
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
import { Command } from "@mail/../tests/helpers/command";
|
||||
import {
|
||||
click,
|
||||
contains,
|
||||
createFile,
|
||||
mockGetMedia,
|
||||
nextAnimationFrame,
|
||||
start,
|
||||
startServer,
|
||||
waitUntil,
|
||||
} from "@mail/../tests/helpers/test_utils";
|
||||
import { VoicePlayer } from "@mail/discuss/voice_message/common/voice_player";
|
||||
import { VoiceRecorder } from "@mail/discuss/voice_message/common/voice_recorder";
|
||||
@@ -167,7 +167,7 @@ QUnit.test("make voice message in chat", async (assert) => {
|
||||
patchDate(2023, 6, 31, 13, 0, 11); // +1 so exactly 10 sec elapsed
|
||||
// simulate some microphone data
|
||||
audioProcessor.process([[new Float32Array(128)]]);
|
||||
await waitUntil(".o-mail-VoiceRecorder:contains(00 : 10)");
|
||||
await contains(".o-mail-VoiceRecorder:contains(00 : 10)");
|
||||
assert.containsOnce($, "button[title='Stop Recording']");
|
||||
await click("button[title='Stop Recording']");
|
||||
assert.containsOnce($, ".o-mail-VoicePlayer");
|
||||
|
||||
@@ -8,12 +8,12 @@ import { patchUiSize } from "@mail/../tests/helpers/patch_ui_size";
|
||||
import {
|
||||
afterNextRender,
|
||||
click,
|
||||
contains,
|
||||
createFile,
|
||||
insertText,
|
||||
isScrolledToBottom,
|
||||
start,
|
||||
startServer,
|
||||
waitUntil,
|
||||
} from "@mail/../tests/helpers/test_utils";
|
||||
|
||||
import { makeFakeNotificationService } from "@web/../tests/helpers/mock_services";
|
||||
@@ -856,18 +856,18 @@ QUnit.test('all messages in "Inbox" in "History" after marked all as read', asyn
|
||||
}
|
||||
const { openDiscuss } = await start();
|
||||
openDiscuss();
|
||||
(await waitUntil("button:contains(Mark all read)")).click();
|
||||
await waitUntil(".o-mail-Message", 0);
|
||||
(await contains("button:contains(Mark all read)")).click();
|
||||
await contains(".o-mail-Message", 0);
|
||||
|
||||
/**
|
||||
* The await is necessary on click because otherwise useAutoScroll would set
|
||||
* the scroll to bottom after the manually set value from this test.
|
||||
*/
|
||||
await click("button:contains(History)");
|
||||
await waitUntil(".o-mail-Message", 30);
|
||||
await contains(".o-mail-Message", 30);
|
||||
|
||||
$(".o-mail-Thread")[0].scrollTop = 0;
|
||||
await waitUntil(".o-mail-Message", 40);
|
||||
await contains(".o-mail-Message", 40);
|
||||
});
|
||||
|
||||
QUnit.test("post a simple message", async (assert) => {
|
||||
@@ -1937,16 +1937,16 @@ QUnit.test(
|
||||
await openDiscuss();
|
||||
await click(".o-mail-DiscussSidebarCategory-add[title='Start a conversation']");
|
||||
await insertText(".o-discuss-ChannelSelector input", "m");
|
||||
await waitUntil(".o-mail-NavigableList-item:contains(Loading)");
|
||||
await contains(".o-mail-NavigableList-item:contains(Loading)");
|
||||
await insertText(".o-discuss-ChannelSelector input", "a");
|
||||
await insertText(".o-discuss-ChannelSelector input", "r");
|
||||
deferred1.resolve();
|
||||
assert.verifySteps(["First RPC"]);
|
||||
await waitUntil(".o-discuss-ChannelSelector-suggestion:contains(Mario)");
|
||||
await waitUntil(".o-discuss-ChannelSelector-suggestion:contains(Mama)");
|
||||
await contains(".o-discuss-ChannelSelector-suggestion:contains(Mario)");
|
||||
await contains(".o-discuss-ChannelSelector-suggestion:contains(Mama)");
|
||||
deferred2.resolve();
|
||||
assert.verifySteps(["Second RPC"]);
|
||||
await waitUntil(".o-discuss-ChannelSelector-suggestion:contains(Mama)", 0);
|
||||
await waitUntil(".o-discuss-ChannelSelector-suggestion:contains(Mario)");
|
||||
await contains(".o-discuss-ChannelSelector-suggestion:contains(Mama)", 0);
|
||||
await contains(".o-discuss-ChannelSelector-suggestion:contains(Mario)");
|
||||
}
|
||||
);
|
||||
|
||||
@@ -4,10 +4,10 @@ import { Command } from "@mail/../tests/helpers/command";
|
||||
import {
|
||||
afterNextRender,
|
||||
click,
|
||||
contains,
|
||||
insertText,
|
||||
start,
|
||||
startServer,
|
||||
waitUntil,
|
||||
} from "@mail/../tests/helpers/test_utils";
|
||||
|
||||
import { getOrigin } from "@web/core/utils/urls";
|
||||
@@ -1112,9 +1112,9 @@ QUnit.test("Group unread counter up to date after mention is marked as seen", as
|
||||
]);
|
||||
const { openDiscuss } = await start();
|
||||
openDiscuss();
|
||||
await waitUntil(".o-mail-DiscussSidebarChannel .o-discuss-badge");
|
||||
await contains(".o-mail-DiscussSidebarChannel .o-discuss-badge");
|
||||
click(".o-mail-DiscussSidebarChannel");
|
||||
await waitUntil(".o-discuss-badge", 0);
|
||||
await contains(".o-discuss-badge", 0);
|
||||
});
|
||||
|
||||
QUnit.test("Unpinning channel closes its chat window", async (assert) => {
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
/* @odoo-module */
|
||||
|
||||
import {
|
||||
click,
|
||||
insertText,
|
||||
start,
|
||||
startServer,
|
||||
waitUntil,
|
||||
} from "@mail/../tests/helpers/test_utils";
|
||||
import { click, contains, insertText, start, startServer } from "@mail/../tests/helpers/test_utils";
|
||||
import { patchUiSize, SIZES } from "@mail/../tests/helpers/patch_ui_size";
|
||||
|
||||
const rpc = {
|
||||
@@ -116,10 +110,10 @@ QUnit.test("Searching for a GIF", async (assert) => {
|
||||
},
|
||||
});
|
||||
openDiscuss(channelId);
|
||||
(await waitUntil("button[aria-label='GIFs']")).click();
|
||||
insertText((await waitUntil("input[placeholder='Search for a gif']"))[0], "search");
|
||||
await waitUntil("i[aria-label='back']");
|
||||
await waitUntil(".o-discuss-Gif", 2);
|
||||
(await contains("button[aria-label='GIFs']")).click();
|
||||
insertText((await contains("input[placeholder='Search for a gif']"))[0], "search");
|
||||
await contains("i[aria-label='back']");
|
||||
await contains(".o-discuss-Gif", 2);
|
||||
});
|
||||
|
||||
QUnit.test("Open a GIF category trigger the search for the category", async (assert) => {
|
||||
@@ -136,9 +130,9 @@ QUnit.test("Open a GIF category trigger the search for the category", async (ass
|
||||
},
|
||||
});
|
||||
openDiscuss(channelId);
|
||||
(await waitUntil("button[aria-label='GIFs']")).click();
|
||||
(await waitUntil("img[data-src='https://media.tenor.com/6uIlQAHIkNoAAAAM/cry.gif']")).click();
|
||||
await waitUntil(".o-discuss-Gif", 2);
|
||||
(await contains("button[aria-label='GIFs']")).click();
|
||||
(await contains("img[data-src='https://media.tenor.com/6uIlQAHIkNoAAAAM/cry.gif']")).click();
|
||||
await contains(".o-discuss-Gif", 2);
|
||||
assert.strictEqual(
|
||||
document.querySelector("input[placeholder='Search for a gif']").value,
|
||||
"cry"
|
||||
|
||||
@@ -679,7 +679,7 @@ export const click = getClick({ afterNextRender });
|
||||
* @param {string} selector
|
||||
* @param {number} [count=1]
|
||||
*/
|
||||
export function waitUntil(selector, count = 1) {
|
||||
export function until(selector, count = 1) {
|
||||
const res = $(selector);
|
||||
const resMessage = `Found ${count} occurrence(s) of ${selector}`;
|
||||
if (res.length === count) {
|
||||
|
||||
@@ -4,11 +4,11 @@ import { Command } from "@mail/../tests/helpers/command";
|
||||
import {
|
||||
afterNextRender,
|
||||
click,
|
||||
contains,
|
||||
insertText,
|
||||
nextAnimationFrame,
|
||||
start,
|
||||
startServer,
|
||||
waitUntil,
|
||||
} from "@mail/../tests/helpers/test_utils";
|
||||
|
||||
import { deserializeDateTime } from "@web/core/l10n/dates";
|
||||
@@ -410,12 +410,12 @@ QUnit.test(
|
||||
});
|
||||
const { openDiscuss } = await start();
|
||||
openDiscuss(channelId);
|
||||
(await waitUntil(".o-mail-Message [title='Expand']", 2))[0].click();
|
||||
(await waitUntil(".o-mail-Message [title='Edit']")).click();
|
||||
const input = (await waitUntil(".o-mail-Message .o-mail-Composer-input"))[0];
|
||||
(await contains(".o-mail-Message [title='Expand']", 2))[0].click();
|
||||
(await contains(".o-mail-Message [title='Edit']")).click();
|
||||
const input = (await contains(".o-mail-Message .o-mail-Composer-input"))[0];
|
||||
insertText(input, "Goodbye World", { replace: true });
|
||||
triggerHotkey("Enter", false);
|
||||
await waitUntil(".o-mail-MessageInReply-message:contains(Goodbye World)");
|
||||
await contains(".o-mail-MessageInReply-message:contains(Goodbye World)");
|
||||
assert.strictEqual($(".o-mail-MessageInReply-message")[0].innerText, "Goodbye World");
|
||||
}
|
||||
);
|
||||
|
||||
@@ -6,9 +6,9 @@ import { patchUiSize, SIZES } from "@mail/../tests/helpers/patch_ui_size";
|
||||
import {
|
||||
afterNextRender,
|
||||
click,
|
||||
contains,
|
||||
start,
|
||||
startServer,
|
||||
waitUntil,
|
||||
} from "@mail/../tests/helpers/test_utils";
|
||||
|
||||
import { browser } from "@web/core/browser/browser";
|
||||
@@ -887,9 +887,9 @@ QUnit.test("chat should show unread counter on receiving new messages", async (a
|
||||
});
|
||||
await start();
|
||||
click(".o_menu_systray i[aria-label='Messages']");
|
||||
await waitUntil(".o-mail-NotificationItem");
|
||||
await waitUntil(".o-mail-NotificationItem:contains(Partner1)");
|
||||
await waitUntil(".o-mail-NotificationItem .badge:contains('1')", 0);
|
||||
await contains(".o-mail-NotificationItem");
|
||||
await contains(".o-mail-NotificationItem:contains(Partner1)");
|
||||
await contains(".o-mail-NotificationItem .badge:contains('1')", 0);
|
||||
// simulate receiving a new message
|
||||
const channel = pyEnv["discuss.channel"].searchRead([["id", "=", channelId]])[0];
|
||||
pyEnv["bus.bus"]._sendone(channel, "discuss.channel/new_message", {
|
||||
@@ -902,7 +902,7 @@ QUnit.test("chat should show unread counter on receiving new messages", async (a
|
||||
res_id: channelId,
|
||||
},
|
||||
});
|
||||
await waitUntil(".o-mail-NotificationItem .badge:contains('1')");
|
||||
await contains(".o-mail-NotificationItem .badge:contains('1')");
|
||||
});
|
||||
|
||||
QUnit.test("preview for channel should show latest non-deleted message", async (assert) => {
|
||||
|
||||
@@ -4,6 +4,7 @@ import { Command } from "@mail/../tests/helpers/command";
|
||||
import {
|
||||
afterNextRender,
|
||||
click,
|
||||
contains,
|
||||
dragenterFiles,
|
||||
insertText,
|
||||
isScrolledTo,
|
||||
@@ -11,7 +12,6 @@ import {
|
||||
nextAnimationFrame,
|
||||
start,
|
||||
startServer,
|
||||
waitUntil,
|
||||
} from "@mail/../tests/helpers/test_utils";
|
||||
|
||||
import { config as transitionConfig } from "@web/core/transition";
|
||||
@@ -267,10 +267,10 @@ QUnit.test(
|
||||
thread_model: "discuss.channel",
|
||||
})
|
||||
);
|
||||
await waitUntil(".o-mail-Message");
|
||||
await contains(".o-mail-Message");
|
||||
assert.verifySteps(["rpc:channel_fetch"]);
|
||||
$(".o-mail-Composer-input")[0].focus();
|
||||
await waitUntil("span:contains(New messages)", 0);
|
||||
await contains("span:contains(New messages)", 0);
|
||||
assert.verifySteps(["rpc:set_last_seen_message"]);
|
||||
}
|
||||
);
|
||||
@@ -893,12 +893,12 @@ QUnit.test("Thread messages are only loaded once", async (assert) => {
|
||||
},
|
||||
]);
|
||||
openDiscuss();
|
||||
(await waitUntil(".o-mail-DiscussSidebarChannel:eq(0)")).click();
|
||||
await waitUntil(".o-mail-Message:contains(channel1)");
|
||||
(await waitUntil(".o-mail-DiscussSidebarChannel:eq(1)")).click();
|
||||
await waitUntil(".o-mail-Message:contains(channel2)");
|
||||
(await waitUntil(".o-mail-DiscussSidebarChannel:eq(0)")).click();
|
||||
await waitUntil(".o-mail-Message:contains(channel1)");
|
||||
(await contains(".o-mail-DiscussSidebarChannel:eq(0)")).click();
|
||||
await contains(".o-mail-Message:contains(channel1)");
|
||||
(await contains(".o-mail-DiscussSidebarChannel:eq(1)")).click();
|
||||
await contains(".o-mail-Message:contains(channel2)");
|
||||
(await contains(".o-mail-DiscussSidebarChannel:eq(0)")).click();
|
||||
await contains(".o-mail-Message:contains(channel1)");
|
||||
assert.verifySteps([`load messages - ${channelIds[0]}`, `load messages - ${channelIds[1]}`]);
|
||||
});
|
||||
|
||||
@@ -945,10 +945,10 @@ QUnit.test(
|
||||
id: channelId,
|
||||
message: formattedMessage,
|
||||
});
|
||||
await waitUntil("button:contains(Inbox) .badge:contains(1)");
|
||||
await contains("button:contains(Inbox) .badge:contains(1)");
|
||||
click("button:contains(General)");
|
||||
await waitUntil(".o-discuss-badge", 0);
|
||||
await waitUntil("button:contains(Inbox) .badge", 0);
|
||||
await contains(".o-discuss-badge", 0);
|
||||
await contains("button:contains(Inbox) .badge", 0);
|
||||
assert.verifySteps(["mark-all-messages-as-read"]);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -4,13 +4,13 @@ import { patchUiSize, SIZES } from "@mail/../tests/helpers/patch_ui_size";
|
||||
import {
|
||||
afterNextRender,
|
||||
click,
|
||||
contains,
|
||||
dragenterFiles,
|
||||
dropFiles,
|
||||
insertText,
|
||||
isScrolledTo,
|
||||
start,
|
||||
startServer,
|
||||
waitUntil,
|
||||
} from "@mail/../tests/helpers/test_utils";
|
||||
import { DELAY_FOR_SPINNER } from "@mail/core/web/chatter";
|
||||
|
||||
@@ -153,11 +153,11 @@ QUnit.test("Composer toggle state is kept when switching from aside to bottom",
|
||||
const { openFormView, pyEnv } = await start();
|
||||
const partnerId = pyEnv["res.partner"].create({ name: "John Doe" });
|
||||
openFormView("res.partner", partnerId);
|
||||
(await waitUntil("button:contains(Send message)")).click();
|
||||
await waitUntil(".o-mail-Form-chatter.o-aside .o-mail-Composer-input");
|
||||
(await contains("button:contains(Send message)")).click();
|
||||
await contains(".o-mail-Form-chatter.o-aside .o-mail-Composer-input");
|
||||
patchUiSize({ size: SIZES.LG });
|
||||
window.dispatchEvent(new Event("resize"));
|
||||
await waitUntil(".o-mail-Form-chatter:not(.o-aside) .o-mail-Composer-input");
|
||||
await contains(".o-mail-Form-chatter:not(.o-aside) .o-mail-Composer-input");
|
||||
});
|
||||
|
||||
QUnit.test("Textarea content is kept when switching from aside to bottom", async (assert) => {
|
||||
@@ -165,12 +165,12 @@ QUnit.test("Textarea content is kept when switching from aside to bottom", async
|
||||
const { openFormView, pyEnv } = await start();
|
||||
const partnerId = pyEnv["res.partner"].create({ name: "John Doe" });
|
||||
openFormView("res.partner", partnerId);
|
||||
(await waitUntil("button:contains(Send message)")).click();
|
||||
await waitUntil(".o-mail-Form-chatter.o-aside .o-mail-Composer-input");
|
||||
(await contains("button:contains(Send message)")).click();
|
||||
await contains(".o-mail-Form-chatter.o-aside .o-mail-Composer-input");
|
||||
await editInput(document.body, ".o-mail-Composer-input", "Hello world !");
|
||||
patchUiSize({ size: SIZES.LG });
|
||||
window.dispatchEvent(new Event("resize"));
|
||||
await waitUntil(".o-mail-Form-chatter:not(.o-aside) .o-mail-Composer-input");
|
||||
await contains(".o-mail-Form-chatter:not(.o-aside) .o-mail-Composer-input");
|
||||
assert.strictEqual($(".o-mail-Composer-input").val(), "Hello world !");
|
||||
});
|
||||
|
||||
@@ -182,7 +182,7 @@ QUnit.test("Composer type is kept when switching from aside to bottom", async (a
|
||||
await click("button:contains(Log note)");
|
||||
patchUiSize({ size: SIZES.LG });
|
||||
window.dispatchEvent(new Event("resize"));
|
||||
await waitUntil(".o-mail-Form-chatter:not(.o-aside) .o-mail-Composer-input");
|
||||
await contains(".o-mail-Form-chatter:not(.o-aside) .o-mail-Composer-input");
|
||||
assert.hasClass(
|
||||
$("button:contains(Log note)"),
|
||||
"btn-primary",
|
||||
@@ -756,17 +756,17 @@ QUnit.test("upload attachment on draft record", async (assert) => {
|
||||
views: [[false, "form"]],
|
||||
});
|
||||
const [chatter, file] = await Promise.all([
|
||||
waitUntil(".o-mail-Chatter"),
|
||||
contains(".o-mail-Chatter"),
|
||||
createFile({
|
||||
content: "hello, world",
|
||||
contentType: "text/plain",
|
||||
name: "text.txt",
|
||||
}),
|
||||
]);
|
||||
await waitUntil(".button[aria-label='Attach files']:contains(1)", 0);
|
||||
await contains(".button[aria-label='Attach files']:contains(1)", 0);
|
||||
dragenterFiles(chatter[0]);
|
||||
dropFiles((await waitUntil(".o-mail-Dropzone"))[0], [file]);
|
||||
await waitUntil("button[aria-label='Attach files']:contains(1)");
|
||||
dropFiles((await contains(".o-mail-Dropzone"))[0], [file]);
|
||||
await contains("button[aria-label='Attach files']:contains(1)");
|
||||
});
|
||||
|
||||
QUnit.test("Follower count of draft record is set to 0", async (assert) => {
|
||||
|
||||
@@ -7,11 +7,7 @@ import {
|
||||
nextTick,
|
||||
} from '@web/../tests/helpers/utils';
|
||||
import { setupViewRegistries } from "@web/../tests/views/helpers";
|
||||
import {
|
||||
start,
|
||||
startServer,
|
||||
waitUntil,
|
||||
} from '@mail/../tests/helpers/test_utils';
|
||||
import { contains, start, startServer } from "@mail/../tests/helpers/test_utils";
|
||||
|
||||
import { fileUploadService } from "@web/core/file_upload/file_upload_service";
|
||||
|
||||
@@ -227,10 +223,10 @@ QUnit.module('MrpDocumentsKanbanView', {
|
||||
res_model: "mrp.document",
|
||||
views: [[false, "kanban"]],
|
||||
});
|
||||
(await waitUntil(".o_kanban_previewer")).click();
|
||||
await waitUntil(".o-FileViewer");
|
||||
(await waitUntil(".o-FileViewer-headerButton .fa-times")).click();
|
||||
await waitUntil(".o-FileViewer", 0);
|
||||
(await contains(".o_kanban_previewer")).click();
|
||||
await contains(".o-FileViewer");
|
||||
(await contains(".o-FileViewer-headerButton .fa-times")).click();
|
||||
await contains(".o-FileViewer", 0);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user