[TEST] website_forum: add testing tour for the forum.

This commit is contained in:
Mitesh Savani
2015-03-11 14:58:20 +01:00
committed by Thibault Delavallée
parent dc3fbb17fa
commit cf925c2a58
5 changed files with 229 additions and 0 deletions
+5
View File
@@ -2,6 +2,11 @@
<openerp>
<data>
<!-- Set demo karma for test tour as demo user-->
<record id="base.user_demo" model="res.users">
<field name="karma">20</field>
</record>
<!-- Tag -->
<record id="tags_0" model="forum.tag">
<field name="name">Contract</field>
@@ -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 <em>'Content'</em> 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 <em>Continue</em> 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") },
},
]
});
}());
@@ -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" },
},
]
});
}());
@@ -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")
@@ -5,6 +5,7 @@
<!-- Editor custom -->
<template id="assets_editor" inherit_id="website.assets_editor" name="Forum Editor Assets" groups="base.group_user">
<xpath expr="." position="inside">
<script type="text/javascript" src="/website_forum/static/src/js/website_tour_forum.js"/>
<script type="text/javascript" src="/website_forum/static/src/js/website_forum.editor.js"/>
</xpath>
</template>
@@ -19,6 +20,7 @@
<link rel='stylesheet' href='/website_forum/static/src/css/website_forum.css'/>
<script type="text/javascript" src="/website_forum/static/src/js/website_forum.js"/>
<script type="text/javascript" src="/website_forum/static/src/js/website_forum.share.js"/>
<script type="text/javascript" src="/website_forum/static/src/js/website_tour_forum_question.js"/>
<script type="text/javascript" src="/web/static/lib/jquery.textext/jquery.textext.js"/>
</xpath>
</template>