summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorChristophe Matthieu <chm@odoo.com>2016-08-25 15:03:05 +0200
committerqsm-odoo <qsm@odoo.com>2016-08-30 13:54:28 +0200
commitd39fbea9ad5d8dc130171488297312a27cd347aa (patch)
treec7193e38fa9b51a3cb41c10e82e6f6bca9462136 /addons
parent3fe48f7f495f07b151f21936da5c8185343f36f5 (diff)
[IMP] website_forum: convert tours to use web_tour.tour
Diffstat (limited to 'addons')
-rw-r--r--addons/website_forum/static/src/js/website_tour_forum_question.js136
-rw-r--r--addons/website_forum/tests/test_forum_process.py9
2 files changed, 56 insertions, 89 deletions
diff --git a/addons/website_forum/static/src/js/website_tour_forum_question.js b/addons/website_forum/static/src/js/website_tour_forum_question.js
index fe12a1a244c..34c0737cc8b 100644
--- a/addons/website_forum/static/src/js/website_tour_forum_question.js
+++ b/addons/website_forum/static/src/js/website_tour_forum_question.js
@@ -1,89 +1,55 @@
odoo.define('website_forum.tour_forum_question', function (require) {
-'use strict';
+ 'use strict';
-var Tour = require('web.Tour');
+ var tour = require("web_tour.tour");
+ var base = require("web_editor.base");
-Tour.register({
- id: 'forum_question',
- name: "try to create question",
- path: '/forum/help-1',
- mode: 'test',
- steps: [
- {
- title: "Ask a Question",
- element: '.btn-block a:first',
- placement: 'left',
- content: "Ask the question in this forum by clicking on the button.",
- },
- {
- title: "Question Title",
- element: 'input[name=post_name]',
- sampleText:'First Question Title',
- placement: 'top',
- content: "Give your question title.",
- },
- {
- title: "Question",
- waitNot: "input[name=post_name]:propValue('')",
- element: '.note-editable p',
- sampleText: 'First Question',
- placement: 'top',
- content: "Put your question here.",
- },
- {
- title: "Give Tag",
- waitFor: '.note-editable:not(:has(br))',
- element: '.select2-choices',
- sampleText:'Tag',
- placement: 'top',
- content: "Insert tags related to your question.",
- },
- {
- title: "Post Question",
- waitNot: "input[id=s2id_autogen2]:propValue('')",
- element: 'button:contains("Post Your Question")',
- placement: 'bottom',
- content: "Click to post your question.",
- },
- {
- title: "New Question Created",
- waitFor: 'body:has(".fa-star")',
- content: "This page contain new created question.",
- popover: { next: "Continue" },
- },
- {
- title: "Answer",
- element: '.note-editable p',
- sampleText: 'First Answer',
- placement: 'top',
- content: "Put your answer here.",
- },
- {
- title: "Post Answer",
- waitFor: '.note-editable:not(:has(br))',
- element: 'button:contains("Post Answer")',
- placement: 'bottom',
- content: "Click to post your answer.",
- },
- {
- title: "Answer Posted",
- waitFor: 'body:has(".fa-check-circle")',
- content: "This page contain new created question and its answer.",
- popover: { next: "Continue" },
- },
- {
- title: "Accept Answer",
- element: 'a[data-karma="20"]:first',
- placement: 'right',
- content: "Click here to accept this answer.",
- },
- {
- title: "Congratulations",
- waitFor: 'body:has(".oe_answer_true")',
- content: "Congratulations! You just created and post your first question and answer.",
- popover: { next: "Close Tutorial" },
- },
- ]
+ tour.register('forum_question', {
+ test: true,
+ url: '/forum/help-1',
+ wait_for: base.ready(),
+ }, [{
+ content: "Ask the question in this forum by clicking on the button.",
+ trigger: '.btn-block a:first',
+ }, {
+ content: "Give your question content.",
+ trigger: 'input[name=post_name]',
+ run: 'text First Question Title',
+ }, {
+ content: "Put your question here.",
+ extra_trigger: "#wrap:not(:has(input[name=post_name]:propValue('')))",
+ trigger: '.note-editable p',
+ run: 'text First Question',
+ }, {
+ content: "Insert tags related to your question.",
+ extra_trigger: '.note-editable:not(:has(br))',
+ trigger: '.select2-choices',
+ run: 'text Tag',
+ }, {
+ content: "Click to post your question.",
+ extra_trigger: "#wrap:not(:has(input[id=s2id_autogen2]:propValue('')))",
+ trigger: 'button:contains("Post Your Question")',
+ }, {
+ content: "This page contain new created question.",
+ extra_trigger: '#wrap:has(".fa-star")',
+ trigger: 'button[data-dismiss="modal"]',
+ }, {
+ content: "Put your answer here.",
+ trigger: '.note-editable p',
+ run: 'text First Answer',
+ }, {
+ content: "Click to post your answer.",
+ extra_trigger: '.note-editable:not(:has(br))',
+ trigger: 'button:contains("Post Answer")',
+ }, {
+ content: "This page contain new created question and its answer.",
+ extra_trigger: '#wrap:has(".fa-check-circle")',
+ trigger: 'button[data-dismiss="modal"]',
+ }, {
+ content: "Click here to accept this answer.",
+ trigger: 'a[data-karma="20"]:first',
+ }, {
+ content: "Congratulations! You just created and post your first question and answer.",
+ trigger: '#wrap:has(".oe_answer_true")',
+ }]);
});
-
-}); \ No newline at end of file
diff --git a/addons/website_forum/tests/test_forum_process.py b/addons/website_forum/tests/test_forum_process.py
index a81140c6cd3..2f23ebae67e 100644
--- a/addons/website_forum/tests/test_forum_process.py
+++ b/addons/website_forum/tests/test_forum_process.py
@@ -2,10 +2,11 @@
import odoo.tests
-
-@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_forum_tour(self):
self.phantom_js("/", "odoo.__DEBUG__.services['web_tour.tour'].run('question')", "odoo.__DEBUG__.services['web_tour.tour'].tours.question.ready", login="admin")
@@ -15,4 +16,4 @@ class TestUi(odoo.tests.HttpCase):
forum = env.ref('website_forum.forum_help')
demo = env.ref('base.user_demo')
demo.karma = forum.karma_post + 1
- self.phantom_js("/", "odoo.__DEBUG__.services['web.Tour'].run('forum_question', 'test')", "odoo.__DEBUG__.services['web.Tour'].tours.forum_question", login="demo")
+ self.phantom_js("/", "odoo.__DEBUG__.services['web_tour.tour'].run('forum_question')", "odoo.__DEBUG__.services['web_tour.tour'].tours.forum_question.ready", login="demo")