oca-ocb-mail/odoo-bringout-oca-ocb-im_livechat/im_livechat/static/tests/messaging_menu_patch.test.js
Ernad Husremovic daa394e8b0 19.0 vanilla
2026-03-09 09:31:39 +01:00

47 lines
2.2 KiB
JavaScript

import { click, contains, patchUiSize, start, startServer } from "@mail/../tests/mail_test_helpers";
import { describe, test } from "@odoo/hoot";
import { Command, serverState } from "@web/../tests/web_test_helpers";
import { defineLivechatModels } from "./livechat_test_helpers";
describe.current.tags("desktop");
defineLivechatModels();
test('livechats should be in "chat" filter', async () => {
const pyEnv = await startServer();
const guestId = pyEnv["mail.guest"].create({ name: "Visitor 11" });
pyEnv["discuss.channel"].create({
channel_member_ids: [
Command.create({ partner_id: serverState.partnerId, livechat_member_type: "agent" }),
Command.create({ guest_id: guestId, livechat_member_type: "visitor" }),
],
channel_type: "livechat",
livechat_operator_id: serverState.partnerId,
});
await start();
await click(".o_menu_systray i[aria-label='Messages']");
await contains(".o-mail-MessagingMenu button.fw-bold", { text: "Notifications" });
await contains(".o-mail-NotificationItem", { text: "Visitor 11" });
await click(".o-mail-MessagingMenu button", { text: "Chats" });
await contains(".o-mail-MessagingMenu button.fw-bold", { text: "Chats" });
await contains(".o-mail-NotificationItem", { text: "Visitor 11" });
});
test('livechats should be in "livechat" tab in mobile', async () => {
patchUiSize({ height: 360, width: 640 });
const pyEnv = await startServer();
const guestId = pyEnv["mail.guest"].create({ name: "Visitor 11" });
pyEnv["discuss.channel"].create({
channel_member_ids: [
Command.create({ partner_id: serverState.partnerId, livechat_member_type: "agent" }),
Command.create({ guest_id: guestId, livechat_member_type: "visitor" }),
],
channel_type: "livechat",
livechat_operator_id: serverState.partnerId,
});
await start();
await click(".o_menu_systray i[aria-label='Messages']");
await click("button", { text: "Live Chats" });
await contains(".o-mail-NotificationItem", { text: "Visitor 11" });
await click("button", { text: "Chats" });
await contains(".o-mail-NotificationItem", { count: 0, text: "Visitor 11" });
});