diff options
| author | Christophe Matthieu <chm@openerp.com> | 2014-02-07 08:47:45 +0100 |
|---|---|---|
| committer | Christophe Matthieu <chm@openerp.com> | 2014-02-07 08:47:45 +0100 |
| commit | 4663f5b10ca78a2acbbffbbd8d68f7893e1d2f54 (patch) | |
| tree | 9cfbd561598c39eb68e3d16f8be44c333ddd36bb /addons/website/static | |
| parent | 062c4914889497f4c9219da0870dd250bf901828 (diff) | |
[IMP] website test: add a timeout in phantom js to raise a better error and improve log error
bzr revid: chm@openerp.com-20140207074745-ffrcoi2aj5m67i8m
Diffstat (limited to 'addons/website/static')
| -rw-r--r-- | addons/website/static/src/js/website.tour.js | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/addons/website/static/src/js/website.tour.js b/addons/website/static/src/js/website.tour.js index 4285656e39a..25d8ac89a12 100644 --- a/addons/website/static/src/js/website.tour.js +++ b/addons/website/static/src/js/website.tour.js @@ -75,9 +75,8 @@ website.Tour = openerp.Class.extend({ website.Tour.busy = true; - if (automatic) { - this.localStorage.setItem("tour-"+this.id+"-test-automatic", true); - } + this.localStorage.setItem("tour-"+this.id+"-test-automatic", automatic); + this.automatic = automatic; if (this.path) { // redirect to begin of the tour in function of the language @@ -93,12 +92,13 @@ website.Tour = openerp.Class.extend({ website.Tour.waitReady.call(this, function () {self._running();}); }, running: function () { + var self = this; if (+this.localStorage.getItem("tour-"+this.id+"-test") >= this.steps.length-1) { this.endTour(); return; } - if (website.Tour.is_busy() || !this.testPathUrl()) return; + if (website.Tour.is_busy()) return; // launch tour with url this.checkRunningUrl(); @@ -106,6 +106,21 @@ website.Tour = openerp.Class.extend({ // mark tour as busy (only one test running) if (this.localStorage.getItem("tour-"+this.id+"-test") != null) { website.Tour.busy = true; + this.automatic = !!this.localStorage.getItem("tour-"+this.id+"-test-automatic"); + } + + if (!this.testPathUrl()) { + if (this.automatic) { + this.timer = setTimeout(function () { + self.reset(); + throw new Error("Wrong url for running " + self.id + + '\ntestPath: ' + self.testPath + + '\nhref: ' + window.location.href + + "\nreferrer: " + document.referrer + ); + },this.defaultOverLaps); + } + return; } var self = this; @@ -115,7 +130,6 @@ website.Tour = openerp.Class.extend({ var stepId = this.localStorage.getItem("tour-"+this.id+"-test"); if (stepId != null) { - this.automatic = !!this.localStorage.getItem("tour-"+this.id+"-test-automatic"); this.registerTour(); this.nextStep(stepId, this.automatic ? this.autoNextStep : null, this.automatic ? this.defaultOverLaps : null); } |
