You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
2.0 KiB

# Copyright 2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
# Copyright 2018 Artyom Losev <https://it-projects.info/team/ArtyomLosev>
# Copyright 2019 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
# License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html).
import odoo.tests
from werkzeug import url_encode
@odoo.tests.common.at_install(True)
@odoo.tests.common.post_install(True)
class TestUi(odoo.tests.HttpCase):
def test_01_mail_to(self):
# checks the presence of an element with a link to the recipient
env = self.env
# needed because tests are run before the module is marked as
# installed. In js web will only load qweb coming from modules
# that are returned by the backend in module_boot. Without
# this you end up with js, css but no qweb.
env['ir.module.module'].search([('name', '=', 'mail_to')], limit=1).state = 'installed'
# Handle messages in Odoo
res_users_ids = env['res.users'].search([])
res_users_ids.write({'notification_type': 'inbox'})
# demo messages
partner_ids = env['res.partner'].search([])
msg = env['mail.message'].create({
'subject': '_Test',
'body': self._testMethodName,
'subtype_id': self.ref('mail.mt_comment'),
'model': 'mail.channel',
'partner_ids': [(6, 0, [i.id for i in partner_ids])],
})
# notifications for everyone
for p in partner_ids.ids:
env['mail.notification'].create({
'res_partner_id': p,
'mail_message_id': msg.id,
'is_read': False,
})
code = """
setTimeout(function () {
console.log($('a.recipient_link').length && 'ok' || 'error');
}, 3000);
"""
link = '/web#%s' % url_encode({'action': 'mail.action_discuss'})
self.phantom_js(link, code, "odoo.__DEBUG__.services['web_tour.tour'].tours.mail_tour.ready", login="admin")