[IMP] event UI tests
bzr revid: ddm@openerp.com-20140108171225-tzarqg6xy8a7sez3
This commit is contained in:
parent
01cae7cf52
commit
38ffa6f93e
|
@ -299,11 +299,11 @@
|
|||
this.reset();
|
||||
}
|
||||
var actionSteps = _.filter(tour.steps, function (step) {
|
||||
return step.trigger;
|
||||
return step.trigger || step.sampleText;
|
||||
});
|
||||
function executeStep (step) {
|
||||
window.localStorage.setItem(testId, step.stepId);
|
||||
step.triggers(function () {
|
||||
function next () {
|
||||
var nextStep = actionSteps.shift();
|
||||
if (nextStep) {
|
||||
// Ensure the previous step has been fully propagated
|
||||
|
@ -315,15 +315,18 @@
|
|||
} else {
|
||||
window.localStorage.removeItem(testId);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (step.triggers) step.triggers(next);
|
||||
var $element = $(step.element);
|
||||
if (step.snippet && step.trigger === 'drag') {
|
||||
website.TestConsole.dragAndDropSnippet(step.snippet);
|
||||
} else if (step.trigger.id === 'change') {
|
||||
} else if (step.sampleText) {
|
||||
$element.val(step.sampleText);
|
||||
$element.trigger($.Event("change", { srcElement: $element }));
|
||||
} else {
|
||||
$element.trigger($.Event("click", { srcElement: $element }));
|
||||
}
|
||||
if (!step.triggers) next();
|
||||
}
|
||||
var url = new website.UrlParser(window.location.href);
|
||||
if (tour.path && url.pathname !== tour.path) {
|
||||
|
|
|
@ -6,5 +6,5 @@ def full_path(filename):
|
|||
return os.path.join(os.path.join(os.path.dirname(__file__), 'ui_suite'), filename)
|
||||
|
||||
def load_tests(loader, base, _):
|
||||
base.addTest(test_ui.WebsiteUiSuite(full_path('post_test.js'), { 'action': 'website.action_website_homepage' }, 120.0))
|
||||
base.addTest(test_ui.WebsiteUiSuite(full_path('post_test.js'), { 'action': 'website.action_website_homepage' }, 60.0))
|
||||
return base
|
|
@ -2,7 +2,7 @@ var testRunner = require('../../../website/tests/ui_suite/ui_test_runner.js');
|
|||
|
||||
var waitFor = testRunner.waitFor;
|
||||
|
||||
testRunner.run(function homepageTest (page, timeout) {
|
||||
testRunner.run(function blogTest (page, timeout) {
|
||||
page.evaluate(function () { localStorage.clear(); });
|
||||
waitFor(function clientReady () {
|
||||
return page.evaluate(function () {
|
||||
|
|
|
@ -49,10 +49,19 @@
|
|||
{
|
||||
stepId: 'choose-name',
|
||||
element: '.modal input',
|
||||
sampleText: 'Advanced Technical Training',
|
||||
placement: 'right',
|
||||
title: "Create an Event Name",
|
||||
content: "Create a name for your new event and click <em>'Continue'</em>. e.g: Technical Training",
|
||||
},
|
||||
{
|
||||
stepId: 'continue-name',
|
||||
element: '.modal button.btn-primary',
|
||||
placement: 'right',
|
||||
title: "Create Event",
|
||||
content: "Click <em>Continue</em> to create the event.",
|
||||
trigger: 'click',
|
||||
},
|
||||
{
|
||||
stepId: 'event-page',
|
||||
title: "New Event Created",
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
from openerp.addons.website_blog.tests import test_controllers
|
||||
|
||||
import test_ui
|
||||
|
||||
checks = [
|
||||
test_controllers,
|
||||
]
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
import os
|
||||
|
||||
import openerp.addons.website.tests.test_ui as test_ui
|
||||
|
||||
def full_path(filename):
|
||||
return os.path.join(os.path.join(os.path.dirname(__file__), 'ui_suite'), filename)
|
||||
|
||||
def load_tests(loader, base, _):
|
||||
base.addTest(test_ui.WebsiteUiSuite(full_path('event_test.js'), { 'action': 'website.action_website_homepage' }, 60.0))
|
||||
return base
|
|
@ -0,0 +1,35 @@
|
|||
var testRunner = require('../../../website/tests/ui_suite/ui_test_runner.js');
|
||||
|
||||
var waitFor = testRunner.waitFor;
|
||||
|
||||
testRunner.run(function eventTest (page, timeout) {
|
||||
page.evaluate(function () { localStorage.clear(); });
|
||||
waitFor(function clientReady () {
|
||||
return page.evaluate(function () {
|
||||
return window.$ && window.openerp && window.openerp.website
|
||||
&& window.openerp.website.TestConsole
|
||||
&& window.openerp.website.TestConsole.test('event');
|
||||
});
|
||||
}, function executeTest () {
|
||||
page.evaluate(function () {
|
||||
window.openerp.website.TestConsole.test('event').run(true);
|
||||
});
|
||||
waitFor(function testExecuted () {
|
||||
var after = page.evaluate(function () {
|
||||
return window.$ && $('button[data-action=edit]').is(":visible") && {
|
||||
banner: $('#wrap [data-snippet-id=carousel]').length,
|
||||
text: $('#wrap [data-snippet-id=text-block]').length,
|
||||
image: $('#wrap [data-snippet-id=three-columns]').length,
|
||||
};
|
||||
});
|
||||
var result = after && (after.banner === 1) && (after.text === 1) && (after.image === 1);
|
||||
if (!result && window.location.href.indexOf('/event/') > 0) {
|
||||
window.location.reload();
|
||||
}
|
||||
return result;
|
||||
}, function finish () {
|
||||
console.log('{ "event": "success" }');
|
||||
phantom.exit();
|
||||
}, 4*timeout/5);
|
||||
}, timeout/5);
|
||||
});
|
Loading…
Reference in New Issue