From 4ba425583ea19433866f634b5fbc4cc5ad1b471f Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Thu, 25 Aug 2016 15:01:03 +0200 Subject: [PATCH] [IMP] survey: convert tours to use web_tour.tour --- .../survey/static/src/js/tour_test_survey.js | 207 +++++++++--------- addons/survey/tests/test_survey_ui.py | 11 +- 2 files changed, 107 insertions(+), 111 deletions(-) diff --git a/addons/survey/static/src/js/tour_test_survey.js b/addons/survey/static/src/js/tour_test_survey.js index a3ee49244fc..e459336679a 100644 --- a/addons/survey/static/src/js/tour_test_survey.js +++ b/addons/survey/static/src/js/tour_test_survey.js @@ -1,198 +1,193 @@ odoo.define('survey.tour_test_survey', function (require) { 'use strict'; -var Core = require('web.core'); -var Tour = require('web.Tour'); -var _t = Core._t; + +var tour = require('web_tour.tour'); -Tour.register({ - id: 'test_survey', - name: _t("try to create and fill survey"), - path: '/survey/start/user-feedback-form-1/phantom', - mode: 'test', - steps: [ +tour.register('test_survey', { test: true, url: '/survey/start/user-feedback-form-1/phantom' }, + [ // Page-1 { - title: "Clicking on Start Survey", - element: 'a.btn.btn-primary.btn-lg:contains("Start Survey")', + content: "Clicking on Start Survey", + trigger: 'a.btn.btn-primary.btn-lg:contains("Start Survey")', }, // Question: Where do you develop your new features? { - title: "Selecting answer 'Yes, I use a version < 7.0'", - element: 'select[name="1_1_1"]', - sampleText:'1', + content: "Selecting answer 'Yes, I use a version < 7.0'", + trigger: 'select[name="1_1_1"]', + run: 'text 1', }, // Question: Which modules are you using/testing? { - title: "Ticking answer 'Sales Management'", - element: 'input[name="1_1_2_5"][value="5"]', - sampleText:'5', + content: "Ticking answer 'Sales Management'", + trigger: 'input[name="1_1_2_5"][value="5"]', + run: 'text 5', }, { - title: "Clicking on Next Page", - element: 'button[value="next"]', + content: "Clicking on Next Page", + trigger: 'button[value="next"]', }, // Page-2 // Question: What do you think about the documentation available on doc.odoo.com? { - title: "For 'It is up-to-date' checking 'Totally disagree'", - element: 'input[name="1_2_3_15"][value="11"]', - sampleText:'11', + content: "For 'It is up-to-date' checking 'Totally disagree'", + trigger: 'input[name="1_2_3_15"][value="11"]', + run: 'text 11', }, { - title: "For 'It helps in the beginning' ckecking 'Disagree'", - element: 'input[name="1_2_3_16"][value="12"]', - sampleText:'12', + content: "For 'It helps in the beginning' ckecking 'Disagree'", + trigger: 'input[name="1_2_3_16"][value="12"]', + run: 'text 12', }, { - title: "For 'I use the contextual help in Odoo' checking 'Agree'", - element: 'input[name="1_2_3_17"][value="13"]', - sampleText:'13', + content: "For 'I use the contextual help in Odoo' checking 'Agree'", + trigger: 'input[name="1_2_3_17"][value="13"]', + run: 'text 13', }, { - title: "For 'It is complete' checking 'Totally disagree'", - element: 'input[name="1_2_3_18"][value="11"]', - sampleText:'11', + content: "For 'It is complete' checking 'Totally disagree'", + trigger: 'input[name="1_2_3_18"][value="11"]', + run: 'text 11', }, { - title: "For 'It is clear' checking 'Disagree'", - element: 'input[name="1_2_3_19"][value="12"]', - sampleText:'12', + content: "For 'It is clear' checking 'Disagree'", + trigger: 'input[name="1_2_3_19"][value="12"]', + run: 'text 12', }, // Question: What do you think about the process views of Odoo, available in the web client ? { - title: "For 'They help new users to understand Odoo' checking 'Totally disagree'", - element: 'input[name="1_2_4_24"][value="20"]', - sampleText:'20', + content: "For 'They help new users to understand Odoo' checking 'Totally disagree'", + trigger: 'input[name="1_2_4_24"][value="20"]', + run: 'text 20', }, { - title: "For 'They are clean and correct' checking 'Totally disagree'", - element: 'input[name="1_2_4_25"][value="20"]', - sampleText:'20', + content: "For 'They are clean and correct' checking 'Totally disagree'", + trigger: 'input[name="1_2_4_25"][value="20"]', + run: 'text 20', }, { - title: "For 'They are useful on a daily usage' checking 'Totally disagree'", - element: 'input[name="1_2_4_26"][value="20"]', - sampleText:'20', + content: "For 'They are useful on a daily usage' checking 'Totally disagree'", + trigger: 'input[name="1_2_4_26"][value="20"]', + run: 'text 20', }, { - title: "For 'A process is defined for all enterprise flows' checking 'Disagree'", - element: 'input[name="1_2_4_27"][value="21"]', - sampleText:'21', + content: "For 'A process is defined for all enterprise flows' checking 'Disagree'", + trigger: 'input[name="1_2_4_27"][value="21"]', + run: 'text 21', }, { - title: "For 'It's easy to find the process you need' checking 'Agree'", - element: 'input[name="1_2_4_28"][value="22"]', - sampleText:'22', + content: "For 'It's easy to find the process you need' checking 'Agree'", + trigger: 'input[name="1_2_4_28"][value="22"]', + run: 'text 22', }, // Question: Do you have suggestions on how to improve the process view? { - title: "Writing answer", - element: 'textarea[name="1_2_5"]', - sampleText:'I do not want to provide any suggestions.', + content: "Writing answer", + trigger: 'textarea[name="1_2_5"]', + run: 'text I do not want to provide any suggestions.', }, // Question: What do you think about the structure of the menus? { - title: "Checking 'It can be improved'", - element: 'input[name="1_2_6_30"][value="30"]', - sampleText:'30', + content: "Checking 'It can be improved'", + trigger: 'input[name="1_2_6_30"][value="30"]', + run: 'text 30', }, // Question: What do you think about the groups of users? { - title: "For 'The security rules defined on groups are useful' checking 'Agree'", - element: 'input[name="1_2_7_36"][value="32"]', - sampleText:'32', + content: "For 'The security rules defined on groups are useful' checking 'Agree'", + trigger: 'input[name="1_2_7_36"][value="32"]', + run: 'text 32', }, { - title: "For 'Those security rules are standard and can be used out-of-the-box in most cases' checking 'Totally agree'", - element: 'input[name="1_2_7_37"][value="35"]', - sampleText:'35', + content: "For 'Those security rules are standard and can be used out-of-the-box in most cases' checking 'Totally agree'", + trigger: 'input[name="1_2_7_37"][value="35"]', + run: 'text 35', }, { - title: "For 'The 'Usability/Extended View' group helps in daily work' checking 'Totally agree'", - element: 'input[name="1_2_7_38"][value="35"]', - sampleText:'35', + content: "For 'The 'Usability/Extended View' group helps in daily work' checking 'Totally agree'", + trigger: 'input[name="1_2_7_38"][value="35"]', + run: 'text 35', }, { - title: "For 'The 'Usability/Extended View' group hides only optional fields' checking 'Totally agree'", - element: 'input[name="1_2_7_39"][value="33"]', - sampleText:'33', + content: "For 'The 'Usability/Extended View' group hides only optional fields' checking 'Totally agree'", + trigger: 'input[name="1_2_7_39"][value="33"]', + run: 'text 33', }, { - title: "For 'The groups set on menu items are relevant' checking 'Totally disagree'", - element: 'input[name="1_2_7_40"][value="32"]', - sampleText:'32', + content: "For 'The groups set on menu items are relevant' checking 'Totally disagree'", + trigger: 'input[name="1_2_7_40"][value="32"]', + run: 'text 32', }, // Question: What do you think about the structure of the menus? { - title: "Checking 'There are too few groups defined, security isn't accurate enough'", - element: 'input[name="1_2_8"][value="42"]', - sampleText:'42', + content: "Checking 'There are too few groups defined, security isn't accurate enough'", + trigger: 'input[name="1_2_8"][value="42"]', + run: 'text 42', }, // Question: What do you think about configuration wizards? { - title: "For 'Descriptions and help tooltips are clear enough' checking 'Agree'", - element: 'input[name="1_2_9_48"][value="46"]', - sampleText:'46', + content: "For 'Descriptions and help tooltips are clear enough' checking 'Agree'", + trigger: 'input[name="1_2_9_48"][value="46"]', + run: 'text 46', }, { - title: "For 'Configuration wizard exists for each important setting' checking 'Agree'", - element: 'input[name="1_2_9_49"][value="46"]', - sampleText:'46', + content: "For 'Configuration wizard exists for each important setting' checking 'Agree'", + trigger: 'input[name="1_2_9_49"][value="46"]', + run: 'text 46', }, { - title: "For 'Extra modules proposed are relevant' checking 'Totally agree'", - element: 'input[name="1_2_9_50"][value="47"]', - sampleText:'47', + content: "For 'Extra modules proposed are relevant' checking 'Totally agree'", + trigger: 'input[name="1_2_9_50"][value="47"]', + run: 'text 47', }, { - title: "For 'Running the configuration wizards is a good way to spare time' checking 'Totally disagree'", - element: 'input[name="1_2_9_51"][value="44"]', - sampleText:'44', + content: "For 'Running the configuration wizards is a good way to spare time' checking 'Totally disagree'", + trigger: 'input[name="1_2_9_51"][value="44"]', + run: 'text 44', }, { - title: "Clicking on Next Page", - element: 'button[value="next"]', + content: "Clicking on Next Page", + trigger: 'button[value="next"]', }, // Page-3 // Question: How do you contribute or plan to contribute to Odoo? { - title: "Checking 'I would like to contribute but I don not know how?'", - element: 'input[name="1_3_10_53"][value="53"]', - sampleText:'53', + content: "Checking 'I would like to contribute but I don not know how?'", + trigger: 'input[name="1_3_10_53"][value="53"]', + run: 'text 53', }, // Question: Do you have a proposition to help people to contribute? { - title: "Writing answer", - element: 'textarea[name="1_3_11"]', - sampleText:'No. I do not have any proposition to help people to contribute.', + content: "Writing answer", + trigger: 'textarea[name="1_3_11"]', + run: 'text No. I do not have any proposition to help people to contribute.', }, // Question: Do you have a proposition to attract new contributors? { - title: "Writing answer", - element: 'textarea[name="1_3_12"]', - sampleText:'No. I do not have any proposition to Attract new contributors.', + content: "Writing answer", + trigger: 'textarea[name="1_3_12"]', + run: 'text No. I do not have any proposition to Attract new contributors.', }, { - title: "Clicking on Next Page", - element: 'button[value="next"]', + content: "Clicking on Next Page", + trigger: 'button[value="next"]', }, // Page-4 // Question: Where do you develop your new features? { - title: "Checking 'I host them on my own website'", - element: 'input[name="1_4_13_59"][value="59"]', - sampleText:'59', + content: "Checking 'I host them on my own website'", + trigger: 'input[name="1_4_13_59"][value="59"]', + run: 'text 59', }, { - title: "Finish Survey", - element: 'button[value="finish"]', + content: "Finish Survey", + trigger: 'button[value="finish"]', }, { - title: "Thank you", - element: 'h1:contains("Thank you!")', + content: "Thank you", + trigger: 'h1:contains("Thank you!")', } ] -}); +); }); diff --git a/addons/survey/tests/test_survey_ui.py b/addons/survey/tests/test_survey_ui.py index bea83b1ea7e..8c1b4616eb0 100644 --- a/addons/survey/tests/test_survey_ui.py +++ b/addons/survey/tests/test_survey_ui.py @@ -2,15 +2,16 @@ import odoo.tests # Part of Odoo. See LICENSE file for full copyright and licensing details. -@odoo.tests.common.at_install(False) -@odoo.tests.common.post_install(True) class TestUi(odoo.tests.HttpCase): + post_install = True + at_install = False + def test_01_admin_survey_tour(self): - self.phantom_js("/", "odoo.__DEBUG__.services['web.Tour'].run('test_survey', 'test')", "odoo.__DEBUG__.services['web.Tour'].tours.test_survey", login="admin") + self.phantom_js("/", "odoo.__DEBUG__.services['web_tour.tour'].run('test_survey')", "odoo.__DEBUG__.services['web_tour.tour'].tours.test_survey.ready", login="admin") def test_02_demo_survey_tour(self): - self.phantom_js("/", "odoo.__DEBUG__.services['web.Tour'].run('test_survey', 'test')", "odoo.__DEBUG__.services['web.Tour'].tours.test_survey", login="demo") + self.phantom_js("/", "odoo.__DEBUG__.services['web_tour.tour'].run('test_survey')", "odoo.__DEBUG__.services['web_tour.tour'].tours.test_survey.ready", login="demo") def test_03_public_survey_tour(self): - self.phantom_js("/", "odoo.__DEBUG__.services['web.Tour'].run('test_survey', 'test')", "odoo.__DEBUG__.services['web.Tour'].tours.test_survey") + self.phantom_js("/", "odoo.__DEBUG__.services['web_tour.tour'].run('test_survey')", "odoo.__DEBUG__.services['web_tour.tour'].tours.test_survey.ready")