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.

46 lines
1.7 KiB

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