[IMP] website: add tests for scss edition on html editor

As this behavior was recently broken (fixed in #30403), this commit
adds a test tour for that flow.

task-1934279
Fix #30447
This commit is contained in:
Romain Derie
2019-01-29 16:06:23 +00:00
parent 6bd579bd6b
commit 751ea9634a
2 changed files with 70 additions and 0 deletions
@@ -72,4 +72,71 @@ tour.register('html_editor_multiple_templates', {
},
]
);
tour.register('test_html_editor_scss', {
test: true,
url: '/aboutus',
wait_for: base.ready(),
},
[
// 1. Open Html Editor and select a scss file
{
content: "open customize menu",
extra_trigger: '#wrap:visible', // ensure state for later
trigger: '#customize-menu > a',
},
{
content: "open html editor",
trigger: '#html_editor',
},
{
content: "open type switcher",
trigger: '.o_ace_type_switcher button',
},
{
content: "select scss files",
trigger: '.o_ace_type_switcher_choice[data-type="scss"]',
},
{
content: "select 'website.ui.scss'",
trigger: '#ace-scss-list',
run: function () {
var scssId = $('#ace-scss-list option:contains("website.ui")').val();
$('#ace-scss-list').val(scssId).trigger('change');
},
},
// 2. Edit that file and ensure it was saved then reset it
{
content: "add some scss content in the file",
trigger: 'div.ace_line .ace_variable:contains("body.o_connected_user")',
run: function () {
ace.edit('ace-view-editor').getSession().insert({row: 2, column: 0}, '#wrap {display: none;}\n');
},
},
{
content: "save the html editor",
extra_trigger: 'div.ace_line:contains("#wrap {display: none;}")',
trigger: ".o_ace_view_editor button[data-action=save]",
},
{
content: "check that the scss modification got applied",
trigger: 'body:has(#wrap:hidden)',
run: function () {}, // it's a check
},
{
content: "reset view (after reload, html editor should have been reopened where it was)",
trigger: '#ace-view-id button[data-action="reset"]',
},
{
content: "confirm reset warning",
trigger: '.modal-footer .btn-primary',
},
{
content: "check that the scss file was reset correctly, wrap content should now be visible again",
trigger: '#wrap:visible',
run: function () {}, // it's a check
},
]
);
});
+3
View File
@@ -29,6 +29,9 @@ class TestUiHtmlEditor(odoo.tests.HttpCase):
self.assertTrue(specific_aboutus.arch != oe_structure_layout, "Specific Aboutus view should have been changed")
self.assertEqual(len(specific_aboutus.inherit_children_ids.filtered(lambda v: 'oe_structure' in v.name)), 1, "oe_structure view should have been created on the specific tree")
def test_html_editor_scss(self):
self.phantom_js("/", "odoo.__DEBUG__.services['web_tour.tour'].run('test_html_editor_scss')", "odoo.__DEBUG__.services['web_tour.tour'].tours.test_html_editor_scss.ready", login='admin')
class TestUiTranslate(odoo.tests.HttpCase):
def test_admin_tour_rte_translator(self):