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

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