[IMP] web_editor: tour testing inline editor saving (up to s11)

With 98ed53ce when a form view is saved when a html field is in code
view mode, the change is not lost.

This new backend tour check that when saving in or not in code view, the
content is saved effectively.

The test not in code view would ensure issues like #14381 #14351 #14394
are detected on runbot.

closes #14475
opw-693052

note: the old test system is used so this test is only for up to saas-11
This commit is contained in:
Nicolas Lempereur
2017-01-09 16:06:46 +01:00
parent 98ed53ce3a
commit 81b668c3e3
3 changed files with 61 additions and 0 deletions
@@ -392,6 +392,51 @@ Tour.register({
});
Tour.register({
id: 'rte_backend_inline',
name: "Test RTE in backend view",
mode: 'test',
steps: [
{
title: "Beginning test",
},
{
title: "Click on edit button",
element: '.o_form_button_edit, .oe_form_button_edit',
},
{
title: "Add text to inline html field and save",
element: '.o_form_button_save, .oe_form_button_save',
onload: function(){
$('.oe_form_field_html_text .note-editable > p').append('<i>world</i>');
},
},
{
title: "Verify saved data after edition then click on edit button",
waitFor: '.oe_form_field_html_text p > i:last-child:contains(world)',
element: '.o_form_button_edit, .oe_form_button_edit',
},
{
title: "Switch to code view mode",
element: 'button[data-event="codeview"]',
},
{
title: "Modify code view content and save",
element: '.o_form_button_save, .oe_form_button_save',
onload: function(){
$('.oe_form_field_html_text textarea.note-codable').val(function(_, val){
return val.replace('</p>', '<u>!</u></p>');
});
},
},
{
title: "Verify saved data after code view edition",
waitFor: '.oe_form_field_html_text p > u:last-child:contains(!)',
},
]
});
});
});
+1
View File
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import test_ui
import test_converter
import test_backend_view
@@ -0,0 +1,15 @@
from openerp.api import Environment
import openerp.tests
@openerp.tests.common.at_install(False)
@openerp.tests.common.post_install(True)
class TestBackendView(openerp.tests.HttpCase):
def test_01_rte_backend_inline(self):
""" Test saving inline editor in or out of code view mode. """
with self.registry.cursor() as test_cursor:
env = Environment(test_cursor, self.uid, {})
test_record = env['web_editor.converter.test'].create({'html': '<p>hello </p>'})
form_url = "/web?debug#id={}&view_type=form&model=web_editor.converter.test".format(test_record.id)
self.phantom_js(form_url, "odoo.__DEBUG__.services['web.Tour'].run('rte_backend_inline', 'test')", "odoo.__DEBUG__.services['web.Tour'].tours.rte", login="admin")