mirror of
https://github.com/bringout/oca-ocb-mail.git
synced 2026-04-21 23:21:59 +02:00
19.0 vanilla
This commit is contained in:
parent
5df8c07b59
commit
daa394e8b0
2114 changed files with 564841 additions and 299642 deletions
|
|
@ -0,0 +1,78 @@
|
|||
import {
|
||||
click,
|
||||
contains,
|
||||
openFormView,
|
||||
start,
|
||||
startServer
|
||||
} from "@mail/../tests/mail_test_helpers";
|
||||
import { describe, test } from "@odoo/hoot";
|
||||
import { defineSMSModels } from "@sms/../tests/sms_test_helpers";
|
||||
|
||||
describe.current.tags("desktop");
|
||||
defineSMSModels();
|
||||
|
||||
test("Notification Processing", async () => {
|
||||
const { partnerId } = await _prepareSmsNotification("process");
|
||||
await start();
|
||||
await openFormView("res.partner", partnerId);
|
||||
await _assertContainsSmsNotification();
|
||||
await _assertContainsPopoverWithIcon("fa-hourglass-half");
|
||||
});
|
||||
|
||||
test("Notification Pending", async () => {
|
||||
const { partnerId } = await _prepareSmsNotification("pending");
|
||||
await start();
|
||||
await openFormView("res.partner", partnerId);
|
||||
await _assertContainsSmsNotification();
|
||||
await _assertContainsPopoverWithIcon("fa-paper-plane-o");
|
||||
});
|
||||
|
||||
test("Notification Sent", async () => {
|
||||
const { partnerId } = await _prepareSmsNotification("sent");
|
||||
await start();
|
||||
await openFormView("res.partner", partnerId);
|
||||
await _assertContainsPopoverWithIcon("fa-check");
|
||||
});
|
||||
|
||||
test("Notification Error", async () => {
|
||||
const { partnerId } = await _prepareSmsNotification("exception");
|
||||
await start();
|
||||
await openFormView("res.partner", partnerId);
|
||||
await _assertContainsSmsNotification();
|
||||
await click(".o-mail-Message-notification");
|
||||
await contains(".o-mail-MessageNotificationPopover");
|
||||
await contains(".o-mail-MessageNotificationPopover [title='Error']");
|
||||
});
|
||||
|
||||
const _prepareSmsNotification = async (notification_status) => {
|
||||
const pyEnv = await startServer();
|
||||
const partnerId = pyEnv["res.partner"].create({ name: "Someone", partner_share: true });
|
||||
const messageId = pyEnv["mail.message"].create({
|
||||
body: "not empty",
|
||||
message_type: "sms",
|
||||
model: "res.partner",
|
||||
res_id: partnerId,
|
||||
});
|
||||
pyEnv["mail.notification"].create({
|
||||
mail_message_id: messageId,
|
||||
notification_status: notification_status,
|
||||
notification_type: "sms",
|
||||
res_partner_id: partnerId,
|
||||
});
|
||||
return { partnerId, messageId };
|
||||
};
|
||||
|
||||
const _assertContainsSmsNotification = async () => {
|
||||
await contains(".o-mail-Message");
|
||||
await contains(".o-mail-Message-notification");
|
||||
await contains(".o-mail-Message-notification i");
|
||||
await contains(".o-mail-Message-notification i.fa-mobile");
|
||||
};
|
||||
|
||||
const _assertContainsPopoverWithIcon = async (iconClassName) => {
|
||||
await click(".o-mail-Message-notification");
|
||||
await contains(".o-mail-MessageNotificationPopover");
|
||||
await contains(".o-mail-MessageNotificationPopover i");
|
||||
await contains(`.o-mail-MessageNotificationPopover i.${iconClassName}`);
|
||||
await contains(".o-mail-MessageNotificationPopover", { text: "Someone" });
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue