From eaf8e82efbe99eec013650890f7605d63526b7bc Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Wed, 13 Jul 2016 14:06:33 +0200 Subject: [PATCH] [IMP] *: activate automatic tour tests * project, crm, point_of_sale, website, website_sale, website_blog, website_event, website_forum --- addons/crm/static/src/js/tour.js | 43 ++++-- addons/crm/tests/__init__.py | 1 + addons/crm/tests/test_crm_ui.py | 9 ++ addons/point_of_sale/static/src/js/tour.js | 4 +- addons/point_of_sale/tests/__init__.py | 1 + .../tests/test_point_of_sale_ui.py | 9 ++ addons/project/static/src/js/tour.js | 43 ++++-- addons/project/tests/__init__.py | 2 +- addons/project/tests/test_project_ui.py | 9 ++ .../static/src/js/website.tour.banner.js | 106 -------------- addons/website/tests/test_ui.py | 2 +- .../static/src/js/website.tour.blog.js | 128 +---------------- addons/website_blog/tests/test_ui.py | 2 +- .../static/src/js/website.tour.event.js | 84 +---------- addons/website_event/tests/test_ui.py | 2 +- .../static/src/js/website_tour_forum.js | 134 ++---------------- .../website_forum/tests/test_forum_process.py | 3 +- .../static/src/js/website_sale_tour_shop.js | 118 +-------------- .../website_sale/tests/test_sale_process.py | 2 +- 19 files changed, 123 insertions(+), 579 deletions(-) create mode 100644 addons/crm/tests/test_crm_ui.py create mode 100644 addons/point_of_sale/tests/test_point_of_sale_ui.py create mode 100644 addons/project/tests/test_project_ui.py diff --git a/addons/crm/static/src/js/tour.js b/addons/crm/static/src/js/tour.js index 48cf6b11958..7d72a2e98b4 100644 --- a/addons/crm/static/src/js/tour.js +++ b/addons/crm/static/src/js/tour.js @@ -6,12 +6,14 @@ var tour = require('web_tour.tour'); var _t = core._t; -tour.register('crm_tour', [{ +tour.register('crm_tour', { + url: "/web", +}, [tour.STEPS.MENU_MORE, { trigger: '.o_app[data-menu-xmlid="sales_team.menu_base_partner"], .oe_menu_toggler[data-menu-xmlid="sales_team.menu_base_partner"]', content: _t("Ready to boost you sales? Your sales pipeline can be found here, under this app."), position: 'bottom', }, { - trigger: ".o_welcome_content .o_dashboard_action", + trigger: ".o_sales_dashboard .o_dashboard_action[name=\"crm.action_your_pipeline\"]:last", extra_trigger: '.o_sales_dashboard', content: _t("Let\'s have a look at your opportunities pipeline."), position: "bottom" @@ -21,24 +23,39 @@ tour.register('crm_tour', [{ content: _t("Click here to create your first opportunity and add it to your pipeline."), position: "right" }, { - trigger: ".o_opportunity_kanban .o_kanban_record:nth-child(2)", - content: _t("Drag & drop opportunities between columns as you progress in your sales cycle."), - position: "right" + trigger: ".modal-body input:first", + auto: true, + run: function (actions) { + actions.auto(); + actions.auto(".modal-footer .btn-primary"); + }, }, { - trigger: ".o_kanban_record .oe_kanban_status_red", + trigger: ".o_opportunity_kanban .o_kanban_group:first-child .o_kanban_record:last-child", + content: _t("Drag & drop opportunities between columns as you progress in your sales cycle."), + position: "right", + run: "drag_and_drop .o_opportunity_kanban .o_kanban_group:nth-child(2)", +}, { + trigger: ".o_kanban_record:not(.o_updating) .oe_kanban_status_red", extra_trigger: ".o_opportunity_kanban", content: _t("This opportunity has no next activity scheduled. Click to set one."), position: "bottom" }, { - trigger: ".o_recommended_activity .o_radio_item:first()", + trigger: ".o_recommended_activity .o_radio_item", extra_trigger: ".o_opportunity_kanban", content: _t("

You will be able to customize your followup activities. Examples:

  1. introductory email
  2. call 10 days after
  3. second call 3 days after, ...

Select a standard activity for now on.

"), - position: "left" + position: "left", + run: function (actions) { + actions.auto(this.$anchor.children("input").first()); + actions.auto(".modal-footer .btn-primary"); + }, }, { trigger: ".o_kanban_record", extra_trigger: ".o_opportunity_kanban", content: _t("Click on an opportunity to zoom to it."), - position: "bottom" + position: "bottom", + run: function (actions) { + actions.auto(".o_kanban_record .oe_kanban_action[data-type=edit]"); + }, }, { trigger: ".o_opportunity_form .o_chatter_button_new_message", content: _t('

Send messages to your prospect and get replies automatically attached to this opportunity.

Type \'@\' to mention people - it\'s like cc-ing on emails.

'), @@ -48,12 +65,8 @@ tour.register('crm_tour', [{ extra_trigger: '.o_opportunity_form', content: _t("Use the breadcrumbs to go back to your sales pipeline."), position: "bottom" -}, { - trigger: ".o_main_navbar .o_menu_toggle", - content: _t('Click the Home icon to navigate across apps.'), - edition: "enterprise", - position: "bottom" -}, { +}, tour.STEPS.TOGGLE_APPSWITCHER, +tour.STEPS.MENU_MORE, { trigger: '.o_app[data-menu-xmlid="base.menu_administration"], .oe_menu_toggler[data-menu-xmlid="base.menu_administration"]', content: _t("Configuration options are available in the Settings app."), position: "bottom" diff --git a/addons/crm/tests/__init__.py b/addons/crm/tests/__init__.py index a9f725fd17f..ed686ecdda8 100644 --- a/addons/crm/tests/__init__.py +++ b/addons/crm/tests/__init__.py @@ -4,3 +4,4 @@ import test_crm_lead import test_new_lead_notification import test_lead2opportunity import test_crm_activity +import test_crm_ui diff --git a/addons/crm/tests/test_crm_ui.py b/addons/crm/tests/test_crm_ui.py new file mode 100644 index 00000000000..cbe8105ed15 --- /dev/null +++ b/addons/crm/tests/test_crm_ui.py @@ -0,0 +1,9 @@ +import openerp.tests +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +@openerp.tests.common.at_install(False) +@openerp.tests.common.post_install(True) +class TestUi(openerp.tests.HttpCase): + + def test_01_crm_tour(self): + self.phantom_js("/web", "odoo.__DEBUG__.services['web_tour.tour'].run('crm_tour')", "odoo.__DEBUG__.services['web_tour.tour'].tours.crm_tour", login="admin") diff --git a/addons/point_of_sale/static/src/js/tour.js b/addons/point_of_sale/static/src/js/tour.js index b54d4b4063d..6004090af1b 100644 --- a/addons/point_of_sale/static/src/js/tour.js +++ b/addons/point_of_sale/static/src/js/tour.js @@ -6,7 +6,9 @@ var tour = require('web_tour.tour'); var _t = core._t; -tour.register('point_of_sale_tour', [{ +tour.register('point_of_sale_tour', { + url: "/web", +}, [{ trigger: '.o_app[data-menu-xmlid="point_of_sale.menu_point_root"], .oe_menu_toggler[data-menu-xmlid="point_of_sale.menu_point_root"]', content: _t("Ready to launch your point of sale? Click here."), position: 'bottom', diff --git a/addons/point_of_sale/tests/__init__.py b/addons/point_of_sale/tests/__init__.py index 9a85a649161..2e1ff183381 100644 --- a/addons/point_of_sale/tests/__init__.py +++ b/addons/point_of_sale/tests/__init__.py @@ -3,3 +3,4 @@ import test_point_of_sale_flow import test_frontend +import test_point_of_sale_ui diff --git a/addons/point_of_sale/tests/test_point_of_sale_ui.py b/addons/point_of_sale/tests/test_point_of_sale_ui.py new file mode 100644 index 00000000000..217d8b83265 --- /dev/null +++ b/addons/point_of_sale/tests/test_point_of_sale_ui.py @@ -0,0 +1,9 @@ +import openerp.tests +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +@openerp.tests.common.at_install(False) +@openerp.tests.common.post_install(True) +class TestUi(openerp.tests.HttpCase): + + def test_01_point_of_sale_tour(self): + self.phantom_js("/web", "odoo.__DEBUG__.services['web_tour.tour'].run('point_of_sale_tour')", "odoo.__DEBUG__.services['web_tour.tour'].tours.point_of_sale_tour", login="admin") diff --git a/addons/project/static/src/js/tour.js b/addons/project/static/src/js/tour.js index 44d82251ed4..28cd1c61d5e 100644 --- a/addons/project/static/src/js/tour.js +++ b/addons/project/static/src/js/tour.js @@ -6,7 +6,9 @@ var tour = require('web_tour.tour'); var _t = core._t; -tour.register('project_tour', [{ +tour.register('project_tour', { + url: "/web", +}, [tour.STEPS.MENU_MORE, { trigger: '.o_app[data-menu-xmlid="base.menu_main_pm"], .oe_menu_toggler[data-menu-xmlid="base.menu_main_pm"]', content: _t('Want a better way to manage your projects? It starts here.'), position: 'bottom', @@ -20,10 +22,17 @@ tour.register('project_tour', [{ trigger: 'input.o_project_name', content: _t('Choose a project name. (e.g. Website Launch, Product Development, Office Party, etc.)'), position: 'right', + run: function (actions) { + actions.auto(); + actions.auto(".modal:visible .btn.btn-primary"); + }, }, { trigger: '.o_project_kanban .o_kanban_record:first-child', content: _t('Click on the card to go to your project and start organizing tasks.'), position: 'right', + run: function (actions) { + actions.auto(this.$anchor.find(".o_project_kanban_box:first > a")); + }, }, { trigger: ".o_kanban_project_tasks .o_column_quick_create", content: _t("Add columns to configure stages for your tasks.
e.g. Specification > Development > Done"), @@ -34,22 +43,26 @@ tour.register('project_tour', [{ content: _t("Now that the project is setup, create a few tasks."), position: "right" }, { - trigger: ".o_kanban_record:nth-child(3)", + trigger: ".o_kanban_group:first-child .o_kanban_record:last-child", extra_trigger: '.o_kanban_project_tasks', content: _t("Drag & drop tasks between columns as you work on them."), - position: "right" + position: "right", + run: "drag_and_drop .o_kanban_group:nth-child(2)", }, { trigger: ".o_kanban_record .o_priority_star", extra_trigger: '.o_kanban_project_tasks', content: _t("Star tasks to mark team priorities."), - position: "bottom" + position: "bottom", }, { trigger: ".o_kanban_record", extra_trigger: '.o_kanban_project_tasks', content: _t("Click on a card to get the details of the task."), - position: "bottom" + position: "bottom", + run: function (actions) { + actions.auto(".o_kanban_record .oe_kanban_action[data-type=edit]"); + }, }, { - trigger: ".o_form_button_edit:visible", + trigger: ".o_form_button_edit", extra_trigger: '.o_form_project_tasks', content: _t('Click on this button to modify the task.'), position: "bottom" @@ -57,7 +70,13 @@ tour.register('project_tour', [{ trigger: ".o_form_field.o_task_user_field", extra_trigger: '.o_form_project_tasks.o_form_editable', content: _t('Assign the task to someone. You can create and invite a new user on the fly.'), - position: "bottom" + position: "bottom", + run: function (actions) { + actions.text("Demo User", this.$anchor.find("input")); + }, +}, { + trigger: ".ui-autocomplete > li > a", + auto: true, }, { trigger: ".o_form_button_save", extra_trigger: '.o_form_project_tasks.o_form_editable', @@ -65,15 +84,11 @@ tour.register('project_tour', [{ position: "bottom" }, { trigger: ".breadcrumb li:not(.active):last", - extra_trigger: '.o_form_project_tasks', + extra_trigger: '.o_form_project_tasks.o_form_readonly', content: _t("Click on layers in the path to easily return to tasks."), position: "bottom" -}, { - trigger: ".o_main_navbar .o_menu_toggle", - content: _t('Click the Home icon to navigate across apps.'), - edition: "enterprise", - position: "bottom" -}, { +}, tour.STEPS.TOGGLE_APPSWITCHER, +tour.STEPS.MENU_MORE, { trigger: '.o_app[data-menu-xmlid="base.menu_administration"], .oe_menu_toggler[data-menu-xmlid="base.menu_administration"]', content: _t("Configuration options are available in the Settings app."), position: "bottom" diff --git a/addons/project/tests/__init__.py b/addons/project/tests/__init__.py index b8bfa3b8521..8e85c184df2 100644 --- a/addons/project/tests/__init__.py +++ b/addons/project/tests/__init__.py @@ -1,3 +1,3 @@ # -*- coding: utf-8 -*- -from . import test_project_base, test_project_flow, test_access_rights +from . import test_project_base, test_project_flow, test_access_rights, test_project_ui diff --git a/addons/project/tests/test_project_ui.py b/addons/project/tests/test_project_ui.py new file mode 100644 index 00000000000..73d308f67a2 --- /dev/null +++ b/addons/project/tests/test_project_ui.py @@ -0,0 +1,9 @@ +import openerp.tests +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +@openerp.tests.common.at_install(False) +@openerp.tests.common.post_install(True) +class TestUi(openerp.tests.HttpCase): + + def test_01_project_tour(self): + self.phantom_js("/web", "odoo.__DEBUG__.services['web_tour.tour'].run('project_tour')", "odoo.__DEBUG__.services['web_tour.tour'].tours.project_tour", login="admin") diff --git a/addons/website/static/src/js/website.tour.banner.js b/addons/website/static/src/js/website.tour.banner.js index 9ca3b626fd8..5da3a497c3e 100644 --- a/addons/website/static/src/js/website.tour.banner.js +++ b/addons/website/static/src/js/website.tour.banner.js @@ -2,118 +2,12 @@ odoo.define("website.tour.banner", function (require) { "use strict"; var core = require("web.core"); - var Tour = require('web.Tour'); var tour = require("web_tour.tour"); var base = require("web_editor.base"); var _t = core._t; base.ready().done(function () { - Tour.register({ - id: 'banner', - mode: 'test', - name: _t("Build a page"), - path: '/page/homepage', - steps: [ - { - waitNot: 'body.editor_enable', - title: _t("Welcome to your website!"), - content: _t("This tutorial will guide you to build your home page. We will start by adding a banner."), - popover: { next: _t("Start Tutorial"), end: _t("Skip It") }, - }, - { - waitNot: '.popover.tour', - element: 'a[data-action=edit]', - placement: 'bottom', - title: _t("Edit this page"), - content: _t("Every page of your website can be modified through the Edit button."), - popover: { fixed: true }, - }, - { - snippet: '#snippet_structure .oe_snippet:eq(1)', - placement: 'bottom', - title: _t("Drag & Drop a Banner"), - content: _t("Drag the Banner block and drop it in your page."), - popover: { fixed: true }, - }, - { - waitFor: '.oe_overlay_options .oe_options:visible', - element: '#wrapwrap .s_text_block_image_fw h2', - placement: 'top', - title: _t("Customize banner's text"), - content: _t("Click in the title text and start editing it."), - sampleText: 'Here, a customized text', - }, - { - waitFor: '#wrapwrap .s_text_block_image_fw h2:not(:containsExact(\"Headline\"))', - element: '.oe_snippet_parent:visible', - placement: 'bottom', - title: _t("Get banner properties"), - content: _t("Select the parent container to get the global options of the banner."), - popover: { fixed: true }, - }, - { - element: '.oe_overlay_options .oe_options:visible', - placement: 'bottom', - title: _t("Customize the banner"), - content: _t("Customize any block through this menu. Try to change the background of the banner."), - popover: { next: _t("Continue") }, - }, - { - waitNot: '.popover.tour', - snippet: '#snippet_structure .oe_snippet:eq(6)', - placement: 'bottom', - title: _t("Drag & Drop This Block"), - content: _t("Drag the 'Features' block and drop it below the banner."), - popover: { fixed: true }, - }, - { - waitFor: '.oe_overlay_options .oe_options:visible', - element: 'button[data-action=save]', - placement: 'bottom', - title: _t("Save your modifications"), - content: _t("Publish your page by clicking on the 'Save' button."), - popover: { fixed: true }, - }, - { - waitNot: 'body.editor_enable', - title: _t("Good Job!"), - content: _t("Well done, you created your homepage."), - popover: { next: _t("Continue") }, - }, - { - waitNot: '.popover.tour', - element: 'a[data-action=show-mobile-preview]', - placement: 'bottom', - title: _t("Test Your Mobile Version"), - content: _t("Let's check how your homepage looks like on mobile devices."), - popover: { fixed: true }, - }, - { - element: '.modal-dialog:has(#mobile-viewport) button[data-dismiss=modal]', - placement: 'right', - title: _t("Check Mobile Preview"), - content: _t("Scroll to check rendering and then close the mobile preview."), - }, - { - waitNot: '.modal-dialog:has(#mobile-viewport)', - element: '#content-menu-button', - placement: 'right', - title: _t("Pages and menus"), - content: _t("The 'Content' menu allows you to rename and delete pages or add them to the top menu."), - popover: { next: _t("Continue") }, - }, - { - waitNot: '.popover.tour', - element: '#oe_main_menu_navbar a[data-action=new_page]', - placement: 'bottom', - title: _t("Add new pages"), - content: _t("Use this button to add pages"), - popover: { next: _t("Close Tutorial") }, - }, - ] - }); - tour.register("banner", { url: "/", }, [{ diff --git a/addons/website/tests/test_ui.py b/addons/website/tests/test_ui.py index f2729f934b6..dfc58e847db 100644 --- a/addons/website/tests/test_ui.py +++ b/addons/website/tests/test_ui.py @@ -9,7 +9,7 @@ class TestUi(openerp.tests.HttpCase): self.phantom_js("/", "console.log('ok')", "'website.snippets.editor' in odoo.__DEBUG__.services", login='admin') def test_03_admin_tour_banner(self): - self.phantom_js("/", "odoo.__DEBUG__.services['web.Tour'].run('banner', 'test')", "odoo.__DEBUG__.services['web.Tour'].tours.banner", login='admin') + self.phantom_js("/", "odoo.__DEBUG__.services['web_tour.tour'].run('banner')", "odoo.__DEBUG__.services['web_tour.tour'].tours.banner", login='admin') def test_03_admin_tour_rte_translator(self): self.phantom_js("/", "odoo.__DEBUG__.services['web.Tour'].run('rte_translator', 'test')", "odoo.__DEBUG__.services['web.Tour'].tours.rte_translator", login='admin') diff --git a/addons/website_blog/static/src/js/website.tour.blog.js b/addons/website_blog/static/src/js/website.tour.blog.js index c9a6e0c9a2d..c9e3b11dd37 100644 --- a/addons/website_blog/static/src/js/website.tour.blog.js +++ b/addons/website_blog/static/src/js/website.tour.blog.js @@ -2,142 +2,24 @@ odoo.define("website_blog.tour", function (require) { "use strict"; var core = require("web.core"); - var Tour = require("web.Tour"); var tour = require("web_tour.tour"); var base = require("web_editor.base"); var _t = core._t; base.ready().done(function () { - Tour.register({ - id: 'blog', - mode: 'test', - name: _t("Create a blog post"), - steps: [ - { - title: _t("New Blog Post"), - content: _t("Let's go through the first steps to write beautiful blog posts."), - popover: { next: _t("Start Tutorial"), end: _t("Skip") }, - }, - { - element: '#oe_main_menu_navbar a[data-action=new_page]', - placement: 'bottom', - title: _t("Add Content"), - content: _t("Use this button to create a new blog post like any other document (page, menu, products, event, ...)."), - popover: { fixed: true }, - }, - { - element: 'a[data-action=new_blog_post]', - placement: 'left', - title: _t("New Blog Post"), - content: _t("Select this menu item to create a new blog post."), - popover: { fixed: true }, - }, - { - waitFor: '#o_scroll .oe_snippet', - title: _t("Blog Post Created"), - content: _t("This is your new blog post. Let's edit it."), - popover: { next: _t("Continue") }, - }, - { - element: 'h1[data-oe-expression="blog_post.name"]', - placement: 'top', - title: _t("Post Headline"), - sampleText:'Blog Post Title', - content: _t("Write a title, the subtitle is optional."), - popover: { fixed: true }, - }, - { - waitNot: '#wrap h1[data-oe-expression="blog_post.name"]:'+'containsExact("")', - element: '#oe_manipulators .oe_overlay.oe_active a.btn.btn-primary.btn-sm', - placement: 'right', - title: _t("Customize Cover"), - content: _t("Change and customize your blog post cover."), - popover: { fixed: true }, - }, - { - element: 'a:'+ 'containsExact(' + _t("Change Cover")+ '):eq(1)', - placement: 'right', - title: _t("Cover"), - content: _t("Select this menu item to change blog cover."), - popover: { fixed: true }, - }, - { - waitFor: '.modal:has(.o_existing_attachment_cell:nth(1))', - element: '.modal .o_existing_attachment_cell:nth(1) img', - placement: 'top', - title: _t("Choose an image"), - content: _t("Choose an image from the library."), - popover: { fixed: true }, - }, - { - waitFor: '.o_existing_attachment_cell.o_selected', - element: '.modal-content button.o_save_button', - placement: 'top', - title: _t("Save"), - content: _t("Click on 'Save' to set the picture as cover."), - popover: { fixed: true }, - }, - { - waitNot: '.modal-content:visible', - element: '.blog_content section.mt16', - placement: 'top', - title: _t("Content"), - content: _t("Start writing your story here."), - sampleText: ' ', - popover: { fixed: true }, - }, - { - waitNot: '#blog_content section:first p:first:containsExact(' + _t('Start writing here...') + ')', - element: 'button[data-action=save]', - placement: 'bottom', - title: _t("Save your modifications once you are done"), - content: _t("Click on 'Save' button to record changes on the page."), - popover: { fixed: true }, - }, - { - waitNot: 'button[data-action=save]:visible', - element: 'a[data-action=show-mobile-preview]', - placement: 'bottom', - title: _t("Mobile Preview"), - content: _t("Click on the mobile icon to preview how your blog post will be displayed on a mobile device."), - popover: { fixed: true }, - }, - { - waitFor: '.modal:has(#mobile-viewport):visible', - element: '.modal:has(#mobile-viewport) button[data-dismiss=modal]', - placement: 'right', - title: _t("Check Mobile Preview"), - content: _t("Scroll to check rendering and then close the mobile preview."), - popover: { fixed: true }, - }, - { - waitNot: '.modal:has(#mobile-viewport) button[data-dismiss=modal]:visible', - element: 'button.btn-danger.js_publish_btn', - placement: 'top', - title: _t("Publishing status"), - content: _t(" Click on this button to send your blog post online."), - popover: { fixed: true }, - }, - { - waitFor: '.js_publish_management button.js_publish_btn.btn-success:visible', - title: "Thanks!", - content: _t("This tutorial is over. To discover more features and improve the content of this page, go to the upper left customize menu. You can also add some cool content with your text in the edit mode with the upper right button."), - popover: { next: _t("Close Tutorial") }, - }, - ] - }); - tour.register("blog", { url: "/", - }, [{ + }, [tour.STEPS.WEBSITE_NEW_PAGE, { trigger: "a[data-action=new_blog_post]", content: _t("Select this menu item to create a new blog post."), position: "bottom", }, { trigger: "h1[data-oe-expression=\"blog_post.name\"]", + extra_trigger: "body.editor_has_snippets", content: _t("Write a title, the subtitle is optional."), position: "top", + run: "text", }, { trigger: "#oe_manipulators .oe_overlay.oe_active a.btn.btn-primary.btn-sm", extra_trigger: "#wrap h1[data-oe-expression=\"blog_post.name\"]:not(:containsExact(\"\"))", @@ -161,6 +43,10 @@ odoo.define("website_blog.tour", function (require) { trigger: ".blog_content section.mt16", content: _t("Start writing your story here."), position: "top", + run: function (actions) { + actions.auto(); + actions.text("Blog content", this.$anchor.find("p")); + }, }, { trigger: "button[data-action=save]", extra_trigger: "#blog_content section:first p:first:not(:containsExact(" + _t("Start writing here...") + "))", diff --git a/addons/website_blog/tests/test_ui.py b/addons/website_blog/tests/test_ui.py index 567878fad64..4f359565628 100644 --- a/addons/website_blog/tests/test_ui.py +++ b/addons/website_blog/tests/test_ui.py @@ -4,4 +4,4 @@ import openerp.tests @openerp.tests.common.post_install(True) class TestUi(openerp.tests.HttpCase): def test_admin(self): - self.phantom_js("/", "odoo.__DEBUG__.services['web.Tour'].run('blog', 'test')", "odoo.__DEBUG__.services['web.Tour'].tours.blog", login='admin') + self.phantom_js("/", "odoo.__DEBUG__.services['web_tour.tour'].run('blog')", "odoo.__DEBUG__.services['web_tour.tour'].tours.blog", login='admin') diff --git a/addons/website_event/static/src/js/website.tour.event.js b/addons/website_event/static/src/js/website.tour.event.js index 3013c62d726..d9144df2d2f 100644 --- a/addons/website_event/static/src/js/website.tour.event.js +++ b/addons/website_event/static/src/js/website.tour.event.js @@ -2,94 +2,15 @@ odoo.define("website_event.tour", function (require) { "use strict"; var core = require("web.core"); - var Tour = require("web.Tour"); var tour = require("web_tour.tour"); var base = require("web_editor.base"); var _t = core._t; base.ready().done(function () { - Tour.register({ - id: 'event', - mode: 'test', - name: _t("Create an event"), - steps: [ - { - title: _t("Create an Event"), - content: _t("Let's go through the first steps to publish a new event."), - popover: { next: _t("Start Tutorial"), end: _t("Skip It") }, - }, - { - element: '#oe_main_menu_navbar a[data-action=new_page]', - placement: 'bottom', - title: _t("Add Content"), - content: _t("This button allows you to create new pages, events, menus, etc."), - popover: { fixed: true }, - }, - { - element: 'a[data-action=new_event]', - placement: 'left', - title: _t("New Event"), - content: _t("Click here to create a new event."), - popover: { fixed: true }, - }, - { - element: '.modal-dialog #editor_new_event input[type=text]', - sampleText: 'Advanced Technical Training', - placement: 'right', - title: _t("Create an Event Name"), - content: _t("Create a name for your new event and click 'Continue'. e.g: Technical Training"), - }, - { - waitNot: '.modal-dialog #editor_new_event input[type=text]:not([value!=""])', - element: '.modal-dialog button.btn-primary.btn-continue', - placement: 'right', - title: _t("Create Event"), - content: _t("Click Continue to create the event."), - }, - { - waitFor: '#o_scroll .oe_snippet', - title: _t("New Event Created"), - content: _t("This is your new event page. We will edit the event presentation page."), - popover: { next: _t("Continue") }, - }, - { - snippet: '#snippet_structure .oe_snippet:eq(2)', - placement: 'bottom', - title: _t("Drag & Drop a block"), - content: _t("Drag the 'Image-Text' block and drop it in your page."), - popover: { fixed: true }, - }, - { - element: 'button[data-action=save]', - placement: 'bottom', - title: _t("Save your modifications"), - content: _t("Once you click on save, your event is updated."), - popover: { fixed: true }, - }, - { - waitNot: '#web_editor-top-edit', - element: 'button.btn-danger.js_publish_btn', - placement: 'top', - title: _t("Publish your event"), - content: _t("Click to publish your event."), - }, - { - waitFor: '.js_publish_management button.js_publish_btn.btn-success:visible', - element: '.js_publish_management button[data-toggle="dropdown"]', - placement: 'left', - title: _t("Customize your event"), - content: _t("Click here to customize your event further."), - }, - { - element: '.js_publish_management ul>li>a:last:visible', - }, - ] - }); - tour.register("event", { url: "/", - }, [{ + }, [tour.STEPS.WEBSITE_NEW_PAGE, { trigger: "a[data-action=new_event]", content: _t("Click here to create a new event."), position: "bottom", @@ -103,9 +24,10 @@ odoo.define("website_event.tour", function (require) { content: _t("Click Continue to create the event."), position: "right", }, { - trigger: "#snippet_structure .oe_snippet:eq(2)", + trigger: "#snippet_structure .oe_snippet:eq(2) .oe_snippet_thumbnail", content: _t("Drag this block and drop it in your page."), position: "bottom", + run: "drag_and_drop", }, { trigger: "button[data-action=save]", content: _t("Once you click on save, your event is updated."), diff --git a/addons/website_event/tests/test_ui.py b/addons/website_event/tests/test_ui.py index 4cee4417fa4..a8de31fbfbb 100644 --- a/addons/website_event/tests/test_ui.py +++ b/addons/website_event/tests/test_ui.py @@ -5,4 +5,4 @@ import odoo.tests @odoo.tests.common.post_install(True) class TestUi(odoo.tests.HttpCase): def test_admin(self): - self.phantom_js("/", "odoo.__DEBUG__.services['web.Tour'].run('event', 'test')", "odoo.__DEBUG__.services['web.Tour'].tours.event", login='admin') + self.phantom_js("/", "odoo.__DEBUG__.services['web_tour.tour'].run('event')", "odoo.__DEBUG__.services['web_tour.tour'].tours.event", login='admin') diff --git a/addons/website_forum/static/src/js/website_tour_forum.js b/addons/website_forum/static/src/js/website_tour_forum.js index d0d2f2e8d85..508ca40b4c4 100644 --- a/addons/website_forum/static/src/js/website_tour_forum.js +++ b/addons/website_forum/static/src/js/website_tour_forum.js @@ -2,136 +2,15 @@ odoo.define("website_forum.tour_forum", function (require) { "use strict"; var core = require("web.core"); - var Tour = require("web.Tour"); var tour = require("web_tour.tour"); var base = require("web_editor.base"); var _t = core._t; base.ready().done(function () { - Tour.register({ - id: 'question', - mode: 'test', - name: _t("Create a question"), - steps: [ - { - title: _t("Create a Question!"), - content: _t("Let's go through the first steps to create a new question."), - popover: { next: _t("Start Tutorial"), end: _t("Skip It") }, - }, - { - title: _t("Add Content"), - element: '#oe_main_menu_navbar a[data-action=new_page]', - placement: 'bottom', - content: _t("Use this button to create a new forum like any other document (page, menu, products, event, ...)."), - popover: { fixed: true }, - }, - { - title: _t("New Forum"), - element: 'a[data-action=new_forum]', - placement: 'left', - content: _t("Select this menu item to create a new forum."), - popover: { fixed: true }, - }, - { - title: _t("Forum Name"), - element: '.modal #editor_new_forum input[type=text]', - sampleText:'New Forum', - placement: 'right', - content: _t("Enter a name for your new forum."), - }, - { - title: _t("Create Forum"), - waitNot: ".modal #editor_new_forum input[type=text]:propValue('')", - element: '.modal button.btn-primary', - placement: 'right', - content: _t("Click Continue to create the forum."), - }, - { - title: _t("New Forum Created"), - waitNot: '.modal:visible', - content: _t("This page contains all the information related to the new forum."), - popover: { next: _t("Continue") }, - }, - { - title: _t("Ask a Question"), - element: '.btn-block a:first', - placement: 'left', - content: _t("Ask the question in this forum by clicking on the button."), - }, - { - title: _t("Question Title"), - element: 'input[name=post_name]', - sampleText:'First Question Title', - placement: 'top', - content: _t("Give your question title."), - }, - { - title: _t("Question"), - waitNot: "input[name=post_name]:propValue('')", - element: '.note-editable p', - sampleText: 'First Question', - placement: 'top', - content: _t("Put your question here."), - }, - { - title: _t("Give Tag"), - waitNot: '.note-editable p:containsExact("
")', - element: '.select2-choices', - placement: 'top', - content: _t("Insert tags related to your question."), - }, - { - title: _t("Post Question"), - waitNot: "input[id=s2id_autogen2]:propValue('Tags')", - element: 'button:contains("Post Your Question")', - placement: 'bottom', - content: _t("Click to post your question."), - }, - { - title: _t("New Question Created"), - waitFor: '.fa-star', - content: _t("This page contains the newly created questions."), - popover: { next: _t("Continue") }, - }, - { - title: _t("Answer"), - element: '.note-editable p', - sampleText: 'First Answer', - placement: 'top', - content: _t("Put your answer here."), - }, - { - title: _t("Post Answer"), - waitNot: '.note-editable p:containsExact("
")', - element: 'button:contains("Post Answer")', - placement: 'bottom', - content: _t("Click to post your answer."), - }, - { - title: _t("Answer Posted"), - waitFor: '.fa-check-circle', - content: _t("This page contains the newly created questions and its answers."), - popover: { next: _t("Continue") }, - }, - { - title: _t("Accept Answer"), - element: 'a[data-karma="20"]:first', - placement: 'right', - content: _t("Click here to accept this answer."), - }, - { - title: _t("Congratulations"), - waitFor: '.oe_answer_true', - content: _t("Congratulations! You just created and post your first question and answer."), - popover: { next: _t("Close Tutorial") }, - }, - ] - }); - tour.register("question", { url: "/", - }, [{ + }, [tour.STEPS.WEBSITE_NEW_PAGE, { trigger: "a[data-action=new_forum]", content: _t("Select this menu item to create a new forum."), position: "bottom", @@ -157,25 +36,36 @@ odoo.define("website_forum.tour_forum", function (require) { extra_trigger: "input[name=post_name]:not(:propValue(\"\"))", content: _t("Put your question here."), position: "bottom", + run: "text", }, { trigger: ".select2-choices", extra_trigger: ".note-editable p:not(:containsExact(\"
\"))", content: _t("Insert tags related to your question."), position: "top", + run: function (actions) { + actions.auto("input[id=s2id_autogen2]"); + }, }, { trigger: "button:contains(\"Post Your Question\")", extra_trigger: "input[id=s2id_autogen2]:not(:propValue(\"Tags\"))", content: _t("Click to post your question."), position: "bottom", + }, { + trigger: ".modal-header button.close", + auto: true, }, { trigger: ".note-editable p", content: _t("Put your answer here."), position: "bottom", + run: "text", }, { trigger: "button:contains(\"Post Answer\")", extra_trigger: ".note-editable p:not(:containsExact(\"
\"))", content: _t("Click to post your answer."), position: "bottom", + }, { + trigger: ".modal-header button.close", + auto: true, }, { trigger: "a[data-karma=\"20\"]:first", content: _t("Click here to accept this answer."), diff --git a/addons/website_forum/tests/test_forum_process.py b/addons/website_forum/tests/test_forum_process.py index e367c845af0..18f8812346e 100644 --- a/addons/website_forum/tests/test_forum_process.py +++ b/addons/website_forum/tests/test_forum_process.py @@ -4,8 +4,7 @@ import openerp.tests @openerp.tests.common.post_install(True) class TestUi(openerp.tests.HttpCase): def test_01_admin_forum_tour(self): - self.phantom_js("/", "odoo.__DEBUG__.services['web.Tour'].run('question', 'test')", "odoo.__DEBUG__.services['web.Tour'].tours.question", login="admin") + self.phantom_js("/", "odoo.__DEBUG__.services['web_tour.tour'].run('question')", "odoo.__DEBUG__.services['web_tour.tour'].tours.question", login="admin") def test_02_demo_question(self): self.phantom_js("/", "odoo.__DEBUG__.services['web.Tour'].run('forum_question', 'test')", "odoo.__DEBUG__.services['web.Tour'].tours.forum_question", login="demo") - diff --git a/addons/website_sale/static/src/js/website_sale_tour_shop.js b/addons/website_sale/static/src/js/website_sale_tour_shop.js index e158e795219..0df707739bd 100644 --- a/addons/website_sale/static/src/js/website_sale_tour_shop.js +++ b/addons/website_sale/static/src/js/website_sale_tour_shop.js @@ -2,122 +2,15 @@ odoo.define("website_sale.tour_shop", function (require) { "use strict"; var core = require("web.core"); - var Tour = require("web.Tour"); var tour = require("web_tour.tour"); var base = require("web_editor.base"); var _t = core._t; base.ready().done(function () { - Tour.register({ - id: 'shop', - mode: 'test', - name: _t("Create a product"), - steps: [ - { - title: _t("Welcome to your shop"), - content: _t("You successfully installed the e-commerce. This guide will help you to create your product and promote your sales."), - popover: { next: _t("Start Tutorial"), end: _t("Skip It") }, - }, - { - element: '#oe_main_menu_navbar a[data-action=new_page]', - placement: 'bottom', - title: _t("Create your first product"), - content: _t("Click here to add a new product."), - popover: { fixed: true }, - }, - { - element: 'a[data-action=new_product]', - placement: 'left', - title: _t("Create a new product"), - content: _t("Select New Product to create it and manage its properties to boost your sales."), - popover: { fixed: true }, - }, - { - element: '.modal-dialog #editor_new_product input[type=text]', - sampleText: 'New Product', - placement: 'right', - title: _t("Choose name"), - content: _t("Enter a name for your new product"), - }, - { - waitNot: '.modal-dialog #editor_new_product input[type=text]:not([value!=""])', - element: '.modal-dialog button.btn-primary.btn-continue', - placement: 'right', - title: _t("Create Product"), - content: _t("Click on Continue to create the product."), - }, - { - waitFor: '#o_scroll .oe_snippet', - title: _t("New product created"), - content: _t("This page contains all the information related to the new product."), - popover: { next: _t("Continue") }, - }, - { - element: '.product_price .oe_currency_value:visible:first', - sampleText: '20.50', - placement: 'bottom', - title: _t("Change the price"), - content: _t("Edit the price of this product by clicking on the amount."), - }, - { - waitNot: '.product_price .oe_currency_value:visible:first:containsExact(1.00)', - element: '#wrap img.product_detail_img', - placement: 'top', - title: _t("Update image"), - content: _t("Click here to set an image describing your product."), - }, - { - element: '.modal .o_existing_attachment_cell:nth(2) img', - placement: 'top', - title: _t("Choose an image"), - content: _t("Choose an image from the library."), - popover: { fixed: true }, - onload: function () { - $('form[action="/web_editor/attachment/add"] .well > *').hide(); - } - }, - { - element: '.modal .btn.o_save_button', - placement: 'right', - waitFor: '.o_existing_attachment_cell.o_selected', - title: _t("Save"), - content: _t("Click on Save to add the image to the product description."), - }, - { - waitNot: '.modal-content:visible', - snippet: '#snippet_structure .oe_snippet:eq(8)', - placement: 'bottom', - title: _t("Drag & Drop a block"), - content: _t("Drag this website block and drop it in your page."), - popover: { fixed: true }, - }, - { - element: 'button[data-action=save]', - placement: 'bottom', - title: _t("Save your modifications"), - content: _t("Once you click on Save, your product is updated."), - popover: { fixed: true }, - }, - { - waitNot: '#web_editor-top-edit', - element: '.js_publish_management button.js_publish_btn.btn-danger', - placement: 'top', - title: _t("Publish your product"), - content: _t("Click on Publish your product so your customers can see it."), - }, - { - waitFor: '.js_publish_management button.js_publish_btn.btn-success:visible', - title: _t("Congratulations"), - content: _t("Congratulations! You just created and published your first product."), - popover: { next: _t("Close Tutorial") }, - }, - ] - }); - tour.register("shop", { url: "/", - }, [{ + }, [tour.STEPS.WEBSITE_NEW_PAGE, { trigger: "a[data-action=new_product]", content: _t("Select New Product to create it and manage its properties to boost your sales."), position: "bottom", @@ -127,16 +20,16 @@ odoo.define("website_sale.tour_shop", function (require) { position: "right", }, { trigger: ".modal-dialog button.btn-primary.btn-continue", - extra_trigger: ".modal-dialog #editor_new_product input[type=text][value!=\"\"]", content: _t("Click on Continue to create the product."), position: "right", }, { - trigger: ".product_price .oe_currency_value:visible:first", + trigger: ".product_price .o_is_inline_editable .oe_currency_value", content: _t("Edit the price of this product by clicking on the amount."), position: "bottom", + run: "text 1.99", }, { trigger: "#wrap img.product_detail_img", - extra_trigger: ".product_price .oe_currency_value:visible:first:not(:containsExact(1.00))", + extra_trigger: ".product_price .o_is_inline_editable .oe_currency_value:not(:containsExact(1.00))", content: _t("Click here to set an image describing your product."), position: "top", }, { @@ -149,10 +42,11 @@ odoo.define("website_sale.tour_shop", function (require) { content: _t("Click on Save to add the image to the product description."), position: "right", }, { - trigger: "#snippet_structure .oe_snippet:eq(8)", + trigger: "#snippet_structure .oe_snippet:eq(8) .oe_snippet_thumbnail", extra_trigger: "body:not(.modal-open)", content: _t("Drag this website block and drop it in your page."), position: "bottom", + run: "drag_and_drop", }, { trigger: "button[data-action=save]", content: _t("Once you click on Save, your product is updated."), diff --git a/addons/website_sale/tests/test_sale_process.py b/addons/website_sale/tests/test_sale_process.py index bcdf740385b..5d33d767be9 100644 --- a/addons/website_sale/tests/test_sale_process.py +++ b/addons/website_sale/tests/test_sale_process.py @@ -7,7 +7,7 @@ import odoo.tests @odoo.tests.common.post_install(True) class TestUi(odoo.tests.HttpCase): def test_01_admin_shop_tour(self): - self.phantom_js("/", "odoo.__DEBUG__.services['web.Tour'].run('shop', 'test')", "odoo.__DEBUG__.services['web.Tour'].tours.shop", login="admin") + self.phantom_js("/", "odoo.__DEBUG__.services['web_tour.tour'].run('shop')", "odoo.__DEBUG__.services['web_tour.tour'].tours.shop", login="admin") def test_02_admin_checkout(self): self.phantom_js("/", "odoo.__DEBUG__.services['web.Tour'].run('shop_buy_product', 'test')", "odoo.__DEBUG__.services['web.Tour'].tours.shop_buy_product", login="admin")