From 4a5adc481f42c8c107f52e8c14f39775f2ee56a0 Mon Sep 17 00:00:00 2001 From: Ilyas Date: Mon, 11 Apr 2016 11:56:57 +0500 Subject: [PATCH 1/2] [ADD] phantom test of sent button --- mail_sent/static/src/xml/menu.xml | 2 +- mail_sent/tests/__init__.py | 3 +++ mail_sent/tests/test_js.py | 15 +++++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 mail_sent/tests/__init__.py create mode 100644 mail_sent/tests/test_js.py diff --git a/mail_sent/static/src/xml/menu.xml b/mail_sent/static/src/xml/menu.xml index de92e3a..b3fb11b 100644 --- a/mail_sent/static/src/xml/menu.xml +++ b/mail_sent/static/src/xml/menu.xml @@ -4,7 +4,7 @@
- Sent + Sent
diff --git a/mail_sent/tests/__init__.py b/mail_sent/tests/__init__.py new file mode 100644 index 0000000..6731bb9 --- /dev/null +++ b/mail_sent/tests/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +import test_js \ No newline at end of file diff --git a/mail_sent/tests/test_js.py b/mail_sent/tests/test_js.py new file mode 100644 index 0000000..25c074f --- /dev/null +++ b/mail_sent/tests/test_js.py @@ -0,0 +1,15 @@ +import openerp.tests + +@openerp.tests.common.at_install(False) +@openerp.tests.common.post_install(True) +class TestUi(openerp.tests.HttpCase): + def test_01_mail_sent(self): + # wait till page loaded and then click and wait again + code = """ + setTimeout(function () { + $(".mail_sent").click(); + setTimeout(function () {console.log('ok');}, 3000); + }, 3000); + """ + link = '/web#action=%s' % self.ref('mail.mail_channel_action_client_chat') + self.phantom_js(link, code, "", login="demo") From ddcfbaf7bd3629040c203809f744afaf49372217 Mon Sep 17 00:00:00 2001 From: Ilyas Date: Mon, 11 Apr 2016 12:52:22 +0500 Subject: [PATCH 2/2] [IMP] ready condition for phantom --- mail_sent/tests/test_js.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mail_sent/tests/test_js.py b/mail_sent/tests/test_js.py index 25c074f..952c7e2 100644 --- a/mail_sent/tests/test_js.py +++ b/mail_sent/tests/test_js.py @@ -9,7 +9,7 @@ class TestUi(openerp.tests.HttpCase): setTimeout(function () { $(".mail_sent").click(); setTimeout(function () {console.log('ok');}, 3000); - }, 3000); + }, 1000); """ link = '/web#action=%s' % self.ref('mail.mail_channel_action_client_chat') - self.phantom_js(link, code, "", login="demo") + self.phantom_js(link, code, "odoo.__DEBUG__.services['mail_sent.sent']", login="demo")