[IMP] website_forum: convert tours to use web_tour.tour
This commit is contained in:
committed by
qsm-odoo
parent
3fe48f7f49
commit
d39fbea9ad
@@ -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")',
|
||||
}]);
|
||||
});
|
||||
|
||||
});
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user