[IMP] Improve automated tests
authorddm <ddm@openerp.com>
Tue, 10 Dec 2013 16:35:22 +0000 (17:35 +0100)
committerddm <ddm@openerp.com>
Tue, 10 Dec 2013 16:35:22 +0000 (17:35 +0100)
bzr revid: ddm@openerp.com-20131210163522-p23703mcu8pfdsl0

addons/website/static/src/js/website.tour.js
addons/website_blog/static/src/js/website.tour.blog.js
addons/website_event/static/src/js/website.tour.event.js
addons/website_sale/static/src/js/website.tour.shop.js

index c79c483..1f45808 100644 (file)
             var $thumbnail = $(selector).first();
             var thumbnailPosition = $thumbnail.position();
             $thumbnail.trigger($.Event("mousedown", { which: 1, pageX: thumbnailPosition.left, pageY: thumbnailPosition.top }));
-            $thumbnail.trigger($.Event("mousemove", { which: 1, pageX: thumbnailPosition.left+100, pageY: thumbnailPosition.top+700 }));
+            $thumbnail.trigger($.Event("mousemove", { which: 1, pageX: thumbnailPosition.left, pageY: thumbnailPosition.top+500 }));
             var $dropZone = $(".oe_drop_zone").first();
             var dropPosition = $dropZone.position();
             $dropZone.trigger($.Event("mouseup", { which: 1, pageX: dropPosition.left, pageY: dropPosition.top }));
         registerTour: function (tour) {
             var testId = 'test_'+tour.id+'_tour';
             this.tours.push(tour);
-            TestConsole.tests.push({
+            var test = {
                 id: tour.id,
                 run: function (force) {
                     var url = new website.UrlParser(window.location.href);
                         step.triggers(function () {
                             var nextStep = actionSteps.shift();
                             if (nextStep) {
+                                // Ensure the previous step has been fully propagated
                                 setTimeout(function () {
-                                    executeStep(nextStep);
+                                    setTimeout(function () {
+                                        executeStep(nextStep);
+                                    }, 0);
                                 }, 0);
+                            } else {
+                                window.localStorage.removeItem(testId);
                             }
                         });
                         var $element = $(step.element);
                 reset: function () {
                     window.localStorage.removeItem(testId);
                 },
-            });
+            };
+            TestConsole.tests.push(test);
+            if (window.localStorage.getItem(testId)) {
+                test.run();
+            }
         },
     });
 
index 97e6d0d..61f678e 100644 (file)
@@ -60,6 +60,7 @@
                     placement: 'right',
                     title: "Create Blog Post",
                     content: "Click <em>Continue</em> to create the blog post.",
+                    trigger: 'click',
                 },
                 {
                     stepId: 'post-page',
                     placement: 'bottom',
                     title: "Layout Your Blog Post",
                     content: "Use well designed building blocks to structure the content of your blog. Click 'Insert Blocks' to add new content.",
-                    trigger: 'click',
+                    trigger: {
+                        emitter: editor,
+                        type: 'openerp',
+                        id: 'rte:ready',
+                    },
                 },
                 {
                     stepId: 'drag-image-text',
index 1058287..a557eda 100644 (file)
                     placement: 'bottom',
                     title: "Layout your event",
                     content: "Insert blocks like 'Banner' to layout the body of your event.",
-                    trigger: 'click',
+                    trigger: {
+                        emitter: editor,
+                        type: 'openerp',
+                        id: 'rte:ready',
+                    },
                 },
                 {
                     stepId: 'drag-banner',
index 5a4d0c0..de84aa2 100644 (file)
                     placement: 'bottom',
                     title: "Describe the product for your audience",
                     content: "Insert blocks like text-image, or gallery to fully describe the product and make your visitors want to buy this product.",
-                    trigger: 'click',
+                    trigger: {
+                        emitter: editor,
+                        type: 'openerp',
+                        id: 'rte:ready',
+                    },
                 },
                 {
                     stepId: 'drag-big-picture',