Currently, I'm using web.Tour from odoo to testing. Although it run successfully on browser console with command:
odoo.__DEBUG__.services['web.Tour'].run('create_new_cpo', 'test');
But when I trying to running on Terminal console with this command:
./openerp-server --addons-path my_path -d my_database --log-level=test -u my_module --test-enable
I get the error:
openerp.tests.common: phantomjs: u"ReferenceError: Can't find variable: odoo\n at :1\n(leaf frame on top)"
Here is my log:
INFO my_database openerp.tests.common: phantomjs: loaded http://127.0.0.1:8069/ success
INFO my_database openerp.tests.common: phantomjs: PhantomTest.run: wait for condition: odoo.__DEBUG__.services['web.Tour'].tours.create_new_cpo
INFO my_database openerp.tests.common: phantomjs: page.evaluate eval expr: odoo.__DEBUG__.services['web.Tour'].tours.create_new_cpo
INFO my_database openerp.tests.common: phantomjs: page.evaluate eval result: false
INFO my_database openerp.tests.common: phantomjs: PhantomTest.run: condition statified, executing: odoo.__DEBUG__.services['web.Tour'].run('create_new_cpo', 'test')
ERROR my_database openerp.tests.common: phantomjs: u"ReferenceError: Can't find variable: odoo\n at :1\n(leaf frame on top)"
Here is my .py test script
from openerp.tests import HttpCase
class TestCPO(HttpCase):
post_install = True
at_install = False
def test_01_create_cpo(self):
self.phantom_js(
"/",
"odoo.__DEBUG__.services['web.Tour'].run('create_new_cpo', 'test')",
"odoo.__DEBUG__.services['web.Tour'].tours.create_new_cpo",
login="admin")