41 lines
1.4 KiB
JavaScript
41 lines
1.4 KiB
JavaScript
import { describe, test } from "@odoo/hoot";
|
|
import {
|
|
SIZES,
|
|
click,
|
|
contains,
|
|
patchUiSize,
|
|
start,
|
|
startServer,
|
|
} from "@mail/../tests/mail_test_helpers";
|
|
import { Command, serverState } from "@web/../tests/web_test_helpers";
|
|
import { defineLivechatModels } from "./livechat_test_helpers";
|
|
|
|
describe.current.tags("desktop");
|
|
defineLivechatModels();
|
|
|
|
test("Livechat button is not present when there is no livechat thread", async () => {
|
|
patchUiSize({ size: SIZES.SM });
|
|
await start();
|
|
await click(".o_menu_systray i[aria-label='Messages']");
|
|
await contains(".o-mail-MessagingMenu");
|
|
await contains(".o-mail-MessagingMenu-navbar span", { count: 0, text: "Livechat" });
|
|
});
|
|
|
|
test("Livechat button is present when there is at least one livechat thread", async () => {
|
|
patchUiSize({ size: SIZES.SM });
|
|
const pyEnv = await startServer();
|
|
pyEnv["discuss.channel"].create({
|
|
anonymous_name: "Visitor 11",
|
|
channel_member_ids: [
|
|
Command.create({ partner_id: serverState.partnerId }),
|
|
Command.create({ partner_id: serverState.publicPartnerId }),
|
|
],
|
|
channel_type: "livechat",
|
|
livechat_operator_id: serverState.partnerId,
|
|
});
|
|
await start();
|
|
await click(".o_menu_systray i[aria-label='Messages']");
|
|
await contains(".o-mail-MessagingMenu");
|
|
await contains(".o-mail-MessagingMenu-navbar", { text: "Livechat" });
|
|
});
|