[FIX] website tests

bzr revid: al@openerp.com-20140217001148-2ub37hxyz8tbxrwe
This commit is contained in:
Antony Lesuisse 2014-02-17 01:11:48 +01:00
parent 98641cff67
commit e54758988a
4 changed files with 20 additions and 10 deletions

View File

@ -1,3 +1,3 @@
import controllers
import models
import tests

View File

@ -340,9 +340,9 @@ website.Tour = openerp.Class.extend({
},
endTour: function () {
if (parseInt(this.localStorage.getItem("tour-"+this.id+"-test"),10) >= this.steps.length-1) {
console.log('{ "event": "success" }');
console.log('ok');
} else {
console.log('{ "event": "canceled" }');
console.log('error');
}
this.reset();
},

View File

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
import test_converter
#import test_requests
#import test_ui
import test_ui
import test_views

View File

@ -1,14 +1,24 @@
import os
import openerp
class TestUi(openerp.tests.HttpCase):
def test_admin(self):
self.phantom_js("/", "console.log('ok')", "window.openerp.website")
self.phantom_js("/", "openerp.website.Tour.run_test('banner')", "openerp.website.Tour")
def test_01_pubic_homepage(self):
self.phantom_js("/", "console.log('ok')", "openerp.website.snippet");
def test_public(self):
def test_02_public_login_logout(self):
# Page injection works but chm code doesnt work:
# Can't find variable: Tour
return
inject = [
"./../../../website/static/src/js/website.tour.test.js",
"./../../../website/static/src/js/website.tour.test.admin.js",
("openerp.website.Tour", os.path.join(os.path.dirname(__file__), '../static/src/js/website.tour.js')),
("openerp.website.Tour.LoginEdit", os.path.join(os.path.dirname(__file__), "../static/src/js/website.tour.test.admin.js")),
]
self.phantom_js("/", "openerp.website.Tour.run_test('login_edit')", "openerp.website.Tour", inject=inject);
def test_03_admin_homepage(self):
self.phantom_js("/", "console.log('ok')", "openerp.website.editor", login='admin');
def test_04_admin_tour_banner(self):
self.phantom_js("/", "openerp.website.Tour.run_test('banner')", "openerp.website.Tour", login='admin')
# vim:et: