Browse Source

Merge pull request #39 from ilyasProgrammer/8_mail_count

[ADD] phantom tour and test
pull/3/head
Ivan Yelizariev 9 years ago
parent
commit
13147a454a
  1. 1
      res_partner_mails_count/__openerp__.py
  2. 46
      res_partner_mails_count/static/src/js/res_partner_mails_count_tour.js
  3. 16
      res_partner_mails_count/templates.xml
  4. 1
      res_partner_mails_count/tests/__init__.py
  5. 18
      res_partner_mails_count/tests/test_phantom.py

1
res_partner_mails_count/__openerp__.py

@ -15,6 +15,7 @@
"depends": [ "depends": [
'base', 'base',
'mail' , 'mail' ,
'web_tour_extra' ,
], ],
"external_dependencies": {"python": [], "bin": []}, "external_dependencies": {"python": [], "bin": []},
"data": [ "data": [

46
res_partner_mails_count/static/src/js/res_partner_mails_count_tour.js

@ -0,0 +1,46 @@
(function () {
'use strict';
var _t = openerp._t;
openerp.Tour.register({
id: 'mails_count_tour',
name: _t("Mails count Tour"),
mode: 'test',
path: '/web?res_partner_mails_count=tutorial#id=3&view_type=form&model=res.partner',
// mode: 'tutorial',
steps: [
{
title: _t("Mails count tutorial"),
content: _t("Let's see how mails count work."),
popover: { next: _t("Start Tutorial"), end: _t("Skip") },
},
{
title: _t("New fields"),
content: _t("Here is new fields with mails counters. Press one of it."),
element: '.mails_to',
},
{
waitNot: '.mails_to:visible',
title: _t("Send message from here"),
placement: 'left',
content: _t("Now you can see corresponding mails. You can send mail to this partner right from here. Press <em>'Send a mesage'</em>."),
element: '.oe_mail_wall .oe_msg.oe_msg_composer_compact>div>.oe_compose_post',
},
{
title: "New message",
placement: 'left',
content: _t("You can type message here."),
element: 'div.oe_msg_content>textarea.field_text',
},
{
wait: '7000',
title: "That's it",
content: _t("Enjoy your day! <br/> <br/><a href='https://www.it-projects.info/apps' target='_blank'>IT-Projects LLC</a> team "),
popover: { next: _t("Close Tutorial") },
},
]
});
}());

16
res_partner_mails_count/templates.xml

@ -7,6 +7,8 @@
<xpath expr="." position="inside"> <xpath expr="." position="inside">
<script src="/res_partner_mails_count/static/src/js/main.js" <script src="/res_partner_mails_count/static/src/js/main.js"
type="text/javascript"></script> type="text/javascript"></script>
<script src="/res_partner_mails_count/static/src/js/res_partner_mails_count_tour.js"
type="text/javascript"></script>
</xpath> </xpath>
</template> </template>
@ -29,13 +31,13 @@
<field name="priority" eval="50"/> <field name="priority" eval="50"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<xpath expr="//div[@name='buttons']" position="inside"> <xpath expr="//div[@name='buttons']" position="inside">
<button class="oe_inline oe_stat_button" type="action"
<button class="oe_inline oe_stat_button mails_to" type="action"
name="%(action_mails)d" name="%(action_mails)d"
context="{'search_default_notified_partner_ids': [active_id], 'default_model': 'res.partner', 'default_res_id': active_id}" context="{'search_default_notified_partner_ids': [active_id], 'default_model': 'res.partner', 'default_res_id': active_id}"
icon="fa-envelope"> icon="fa-envelope">
<field string="Mails to" name="mails_to" widget="statinfo"/> <field string="Mails to" name="mails_to" widget="statinfo"/>
</button> </button>
<button class="oe_inline oe_stat_button" type="action"
<button class="oe_inline oe_stat_button mails_from" type="action"
name="%(action_mails)d" name="%(action_mails)d"
context="{'search_default_author_id': active_id, 'default_model': 'res.partner', 'default_res_id': active_id}" context="{'search_default_author_id': active_id, 'default_model': 'res.partner', 'default_res_id': active_id}"
icon="fa-envelope-o"> icon="fa-envelope-o">
@ -44,5 +46,15 @@
</xpath> </xpath>
</field> </field>
</record> </record>
<record id="res_partner_mails_count_tutorial" model="ir.actions.act_url">
<field name="name">res_partner_mails_count Tutorial</field>
<field name="url" eval="'/web?debug=1&amp;res_partner_mails_count=tutorial#id='+str(ref('base.partner_root'))+'&amp;view_type=form&amp;model=res.partner&amp;/#tutorial_extra.mails_count_tour=true'"/>
<field name="target">self</field>
</record>
<record id="base.open_menu" model="ir.actions.todo">
<field name="action_id" ref="res_partner_mails_count_tutorial"/>
<field name="state">open</field>
<field name="sequence">200</field>
</record>
</data> </data>
</openerp> </openerp>

1
res_partner_mails_count/tests/__init__.py

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from . import test_mail from . import test_mail
from . import test_phantom

18
res_partner_mails_count/tests/test_phantom.py

@ -0,0 +1,18 @@
import openerp.tests
@openerp.tests.common.at_install(False)
@openerp.tests.common.post_install(True)
class TestUi(openerp.tests.HttpCase):
def test_01_res_partner_mails_to_count(self):
self.phantom_js('/', "openerp.Tour.run('mails_count_tour', 'test')", "openerp.Tour.tours.mails_count_tour", login="admin")
def test_02_res_partner_mails_from_count(self):
# wait till page loaded and then click and wait again
code = """
setTimeout(function () {
$(".mails_from").click();
setTimeout(function () {console.log('ok');}, 3000);
}, 3000);
"""
link = '/web#id=3&view_type=form&model=res.partner'
self.phantom_js(link, code, "openerp.Tour.tours.mails_count_tour", login="admin")
Loading…
Cancel
Save