[REF] mail: tests: remove waitUntilMessagesLoaded of openDiscuss
This is no longer used since tests properly await what they require. Part-of: odoo/odoo#134025
This commit is contained in:
committed by
Alexandre Kühn
parent
e25e70b2f5
commit
315263f1b3
@@ -1005,7 +1005,7 @@ QUnit.test("chat window: scroll conservation on toggle discuss", async () => {
|
||||
await contains(".o-mail-Message", { count: 31 });
|
||||
await contains(".o-mail-ChatWindow .o-mail-Thread", { scroll: "bottom" });
|
||||
await scroll(".o-mail-ChatWindow .o-mail-Thread", 142);
|
||||
openDiscuss(null, { waitUntilMessagesLoaded: false });
|
||||
openDiscuss(null);
|
||||
await contains(".o-mail-ChatWindow", { count: 0 });
|
||||
openView({
|
||||
res_id: channelId,
|
||||
@@ -1065,7 +1065,7 @@ QUnit.test(
|
||||
await scroll(".o-mail-ChatWindow .o-mail-Thread", 142);
|
||||
// fold chat window
|
||||
await click(".o-mail-ChatWindow-command[title='Fold']");
|
||||
openDiscuss(null, { waitUntilMessagesLoaded: false });
|
||||
openDiscuss(null);
|
||||
await contains(".o-mail-ChatWindow", { count: 0 });
|
||||
openView({
|
||||
res_id: channelId,
|
||||
|
||||
@@ -1471,7 +1471,7 @@ QUnit.test("failure on loading messages should display error", async () => {
|
||||
}
|
||||
},
|
||||
});
|
||||
openDiscuss(channelId, { waitUntilMessagesLoaded: false });
|
||||
openDiscuss(channelId);
|
||||
await contains(".o-mail-Thread-error", {
|
||||
text: "An error occurred while fetching messages.",
|
||||
});
|
||||
@@ -1490,7 +1490,7 @@ QUnit.test("failure on loading messages should prompt retry button", async () =>
|
||||
}
|
||||
},
|
||||
});
|
||||
openDiscuss(channelId, { waitUntilMessagesLoaded: false });
|
||||
openDiscuss(channelId);
|
||||
await contains("button", { text: "Click here to retry" });
|
||||
});
|
||||
|
||||
|
||||
@@ -194,7 +194,7 @@ QUnit.test(
|
||||
const channelId = pyEnv["discuss.channel"].create({ name: "General" });
|
||||
patchUiSize({ size: SIZES.SM });
|
||||
const { openDiscuss } = await start();
|
||||
openDiscuss(channelId, { waitUntilMessagesLoaded: false });
|
||||
openDiscuss(channelId);
|
||||
await click("span", { text: "General" });
|
||||
await click("button[aria-label='GIFs']");
|
||||
await contains(".popover .o-discuss-GifPicker", { count: 0 });
|
||||
@@ -202,7 +202,7 @@ QUnit.test(
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test("Searching for a GIF with a failling RPC should display an error", async (assert) => {
|
||||
QUnit.test("Searching for a GIF with a failling RPC should display an error", async () => {
|
||||
const pyEnv = await startServer();
|
||||
const channelId = pyEnv["discuss.channel"].create({ name: "" });
|
||||
const { openDiscuss } = await start({
|
||||
|
||||
@@ -78,7 +78,7 @@ async function nextTick() {
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function getOpenDiscuss(webClient, { context = {}, params = {}, ...props } = {}) {
|
||||
return async function openDiscuss(pActiveId, { waitUntilMessagesLoaded = true } = {}) {
|
||||
return async function openDiscuss(pActiveId) {
|
||||
const actionOpenDiscuss = {
|
||||
// hardcoded actionId, required for discuss_container props validation.
|
||||
id: 104,
|
||||
@@ -101,31 +101,6 @@ function getOpenDiscuss(webClient, { context = {}, params = {}, ...props } = {})
|
||||
id: threadId,
|
||||
})
|
||||
);
|
||||
if (waitUntilMessagesLoaded) {
|
||||
const messagesLoadedPromise = makeDeferred();
|
||||
const store = webClient.env.services["mail.store"];
|
||||
const thread = store.Thread.records[store.discuss.threadLocalId];
|
||||
if (thread.isLoaded) {
|
||||
messagesLoadedPromise.resolve();
|
||||
}
|
||||
let loadMessageRoute = `/mail/${threadId}/messages`;
|
||||
if (Number.isInteger(threadId)) {
|
||||
loadMessageRoute = "/discuss/channel/messages";
|
||||
}
|
||||
registry.category("mock_server_callbacks").add(
|
||||
loadMessageRoute,
|
||||
({ channel_id: channelId = threadId }) => {
|
||||
if (channelId === threadId) {
|
||||
messagesLoadedPromise.resolve();
|
||||
}
|
||||
},
|
||||
{ force: true }
|
||||
);
|
||||
return afterNextRender(async () => {
|
||||
await doAction(webClient, actionOpenDiscuss, { props });
|
||||
await messagesLoadedPromise;
|
||||
});
|
||||
}
|
||||
return afterNextRender(() => doAction(webClient, actionOpenDiscuss, { props }));
|
||||
};
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ QUnit.test("auto-select 'Inbox' when discuss had channel as active thread", asyn
|
||||
|
||||
patchUiSize({ height: 360, width: 640 });
|
||||
const { openDiscuss } = await start();
|
||||
openDiscuss(channelId, { waitUntilMessagesLoaded: false });
|
||||
openDiscuss(channelId);
|
||||
await contains(".o-mail-MessagingMenu-tab.text-primary.fw-bolder", { text: "Channel" });
|
||||
|
||||
await click("button", { text: "Mailboxes" });
|
||||
|
||||
@@ -994,7 +994,7 @@ QUnit.test("can be marked as read while loading", async function () {
|
||||
}
|
||||
},
|
||||
});
|
||||
openDiscuss(undefined, { waitUntilMessagesLoaded: false });
|
||||
openDiscuss(undefined);
|
||||
await contains(".o-discuss-badge", { text: "1" });
|
||||
await click(".o-mail-DiscussSidebarChannel span", { text: "Demo" });
|
||||
await afterNextRender(loadDeferred.resolve);
|
||||
|
||||
Reference in New Issue
Block a user