diff --git a/addons/website_forum/data/forum_demo.xml b/addons/website_forum/data/forum_demo.xml index 46dd7244b53..0fa118ce955 100644 --- a/addons/website_forum/data/forum_demo.xml +++ b/addons/website_forum/data/forum_demo.xml @@ -2,6 +2,11 @@ + + + 20 + + Contract diff --git a/addons/website_forum/static/src/js/website_tour_forum.js b/addons/website_forum/static/src/js/website_tour_forum.js new file mode 100644 index 00000000000..aece1170e61 --- /dev/null +++ b/addons/website_forum/static/src/js/website_tour_forum.js @@ -0,0 +1,124 @@ +(function () { + 'use strict'; + var _t = openerp._t; + + openerp.Tour.register({ + id: 'question', + 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: '#content-menu-button', + placement: 'left', + content: _t("Use this 'Content' menu 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 then click 'Continue'."), + }, + { + 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"), + waitFor: 'body:not(.modal-open)', + 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"), + waitFor: '.note-editable:not(:has(br))', + 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: 'body:has(".fa-star")', + content: _t("This page contain new created question."), + 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"), + waitFor: '.note-editable:not(:has(br))', + element: 'button:contains("Post Answer")', + placement: 'bottom', + content: _t("Click to post your answer."), + }, + { + title: _t("Answer Posted"), + waitFor: 'body:has(".fa-check-circle")', + content: _t("This page contain new created question and its answer."), + 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: 'body:has(".oe_answer_true")', + content: _t("Congratulations! You just created and post your first question and answer."), + popover: { next: _t("Close Tutorial") }, + }, + ] + }); + +}()); 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 new file mode 100644 index 00000000000..9db484081c2 --- /dev/null +++ b/addons/website_forum/static/src/js/website_tour_forum_question.js @@ -0,0 +1,87 @@ +(function () { + 'use strict'; + + openerp.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" }, + }, + ] + }); + +}()); diff --git a/addons/website_forum/tests/test_forum_process.py b/addons/website_forum/tests/test_forum_process.py new file mode 100644 index 00000000000..8cb1eacb93a --- /dev/null +++ b/addons/website_forum/tests/test_forum_process.py @@ -0,0 +1,11 @@ +import openerp.tests + +@openerp.tests.common.at_install(False) +@openerp.tests.common.post_install(True) +class TestUi(openerp.tests.HttpCase): + def test_01_admin_forum_tour(self): + self.phantom_js("/", "openerp.Tour.run('question', 'test')", "openerp.Tour.tours.question", login="admin") + + def test_02_demo_question(self): + self.phantom_js("/", "openerp.Tour.run('forum_question', 'test')", "openerp.Tour.tours.forum_question", login="demo") + diff --git a/addons/website_forum/views/website_forum.xml b/addons/website_forum/views/website_forum.xml index 3d4ad999f6a..0ef3bb3d71c 100644 --- a/addons/website_forum/views/website_forum.xml +++ b/addons/website_forum/views/website_forum.xml @@ -5,6 +5,7 @@