diff --git a/mail_all/static/src/js/test_mail_all.js b/mail_all/static/src/js/test_mail_all.js new file mode 100644 index 0000000..2352e1a --- /dev/null +++ b/mail_all/static/src/js/test_mail_all.js @@ -0,0 +1,29 @@ +/* # Copyright 2018 Kolushov Alexandr + # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). */ +odoo.define('mail_all.tour', function (require) { + "use strict"; + + var tour = require("web_tour.tour"); + var core = require('web.core'); + var _t = core._t; + + + var steps = [{ + trigger: 'a.full[href="#"]', + content: _t("Click to open app list"), + position: 'bottom', + }, { + trigger: 'a.dropdown-item.o_app:contains("Discuss")', + content: _t("Click to enter menu discuss"), + position: 'bottom', + }, { + content: _t("Open All Messages"), + trigger: '.o_channel_name.mail_all', + }, { + content: _t("Check that All Messages are opened"), + trigger: '.o_mail_discuss_title_main.o_mail_mailbox_title_all.o_mail_discuss_item.o_active', + }]; + + tour.register('tour_mail_all', { test: true, url: '/web' }, steps); + +}); diff --git a/mail_all/tests/test_js.py b/mail_all/tests/test_js.py index 91afbf0..bc41db4 100644 --- a/mail_all/tests/test_js.py +++ b/mail_all/tests/test_js.py @@ -6,17 +6,19 @@ import odoo.tests -@odoo.tests.common.at_install(False) +@odoo.tests.common.at_install(True) @odoo.tests.common.post_install(True) class TestUi(odoo.tests.HttpCase): def test_01_mail_all(self): - # wait till page loaded and then click and wait again - code = """ - setTimeout(function () { - $(".mail_all").click(); - setTimeout(function () {console.log('ok');}, 3000); - }, 1000); - """ + # 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. + self.env['ir.module.module'].search([('name', '=', 'mail_all')], limit=1).state = 'installed' + link = '/web#action=%s' % self.ref('mail.action_discuss') - self.phantom_js(link, code, "odoo.__DEBUG__.services['mail_all.all']", login="admin") + self.phantom_js(link, + "odoo.__DEBUG__.services['web_tour.tour'].run('tour_mail_all', 1000)", + "odoo.__DEBUG__.services['web_tour.tour'].tours.tour_mail_all.ready", + login="admin") diff --git a/mail_all/views/templates.xml b/mail_all/views/templates.xml index 6a90dbe..cd1749d 100644 --- a/mail_all/views/templates.xml +++ b/mail_all/views/templates.xml @@ -10,6 +10,7 @@ +