Browse Source

🛡️ mail_all tests

pull/167/head
KolushovAlexandr 6 years ago
parent
commit
4cceaed378
No known key found for this signature in database GPG Key ID: C3E04B793421FD2
  1. 29
      mail_all/static/src/js/test_mail_all.js
  2. 20
      mail_all/tests/test_js.py
  3. 1
      mail_all/views/templates.xml

29
mail_all/static/src/js/test_mail_all.js

@ -0,0 +1,29 @@
/* # Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
# 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);
});

20
mail_all/tests/test_js.py

@ -6,17 +6,19 @@
import odoo.tests import odoo.tests
@odoo.tests.common.at_install(False)
@odoo.tests.common.at_install(True)
@odoo.tests.common.post_install(True) @odoo.tests.common.post_install(True)
class TestUi(odoo.tests.HttpCase): class TestUi(odoo.tests.HttpCase):
def test_01_mail_all(self): 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') 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")

1
mail_all/views/templates.xml

@ -10,6 +10,7 @@
<xpath expr="." position="inside"> <xpath expr="." position="inside">
<link rel="stylesheet" href="/mail_all/static/src/css/mail_all.css"/> <link rel="stylesheet" href="/mail_all/static/src/css/mail_all.css"/>
<script src="/mail_all/static/src/js/mail_all.js" type="text/javascript"></script> <script src="/mail_all/static/src/js/mail_all.js" type="text/javascript"></script>
<script src="/mail_all/static/src/js/test_mail_all.js" type="text/javascript"></script>
</xpath> </xpath>
</template> </template>
</odoo> </odoo>
Loading…
Cancel
Save