Skip to content

Commit 9ea6688

Browse files
author
Serhii Rubanskyi - seru
committed
Fix test_01_run_tour
1 parent f94d1c1 commit 9ea6688

File tree

3 files changed

+26
-17
lines changed

3 files changed

+26
-17
lines changed

addons/html_builder/static/src/snippets/snippet_service.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,9 @@ export class SnippetModel extends Reactive {
156156
this.orm.silent
157157
.call("ir.ui.view", "render_public_asset", [this.snippetsName, {}], { context })
158158
.then((html) => {
159-
const snippetsDocument = new DOMParser().parseFromString(html, "text/html");
160-
this.computeSnippetTemplates(snippetsDocument);
161-
this.setSnippetName(snippetsDocument);
159+
this.snippetsDocument = new DOMParser().parseFromString(html, "text/html");
160+
this.computeSnippetTemplates(this.snippetsDocument);
161+
this.setSnippetName(this.snippetsDocument);
162162
resolve();
163163
});
164164
});
@@ -274,6 +274,13 @@ export class SnippetModel extends Reactive {
274274
return;
275275
}
276276
snippet.title = newName;
277+
for (const snippetEl of this.snippetsDocument.body.querySelectorAll("snippets#snippet_custom > *")) {
278+
if (snippetEl.getAttribute("data-oe-snippet-key") === snippet.key) {
279+
snippetEl.setAttribute("name", newName);
280+
snippetEl.children[0].dataset["name"] = newName;
281+
}
282+
}
283+
277284
await this.orm.call("ir.ui.view", "rename_snippet", [], {
278285
name: newName,
279286
view_id: snippet.viewId,

addons/test_website/static/tests/tours/custom_snippets.js

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,22 @@ registerWebsitePreviewTour('test_custom_snippet', {
3535
},
3636
{
3737
content: "Save custom snippet",
38-
trigger: ".snippet-option-SnippetSave we-button",
38+
trigger: "button.oe_snippet_save",
3939
run: "click",
4040
},
4141
{
42-
content: "Confirm reload",
43-
trigger: ".modal-dialog button:contains('Save and Reload')",
42+
content: "Confirm Save",
43+
trigger: ".modal-dialog button:contains('Save')",
44+
run: "click",
45+
},
46+
{
47+
content: "Click on Blocks",
48+
trigger: ".o-snippets-tabs button[data-name='blocks']",
4449
run: "click",
4550
},
4651
{
4752
content: "Click on the Custom category block",
48-
trigger: "#oe_snippets .oe_snippet[name='Custom'].o_we_draggable .oe_snippet_thumbnail",
53+
trigger: ".o-snippets-menu .o_snippet[name='Custom'].o_draggable .o_snippet_thumbnail_area",
4954
run: "click",
5055
},
5156
{
@@ -54,22 +59,22 @@ registerWebsitePreviewTour('test_custom_snippet', {
5459
},
5560
{
5661
content: "Rename custom snippet",
57-
trigger: ":iframe .o_custom_snippet_wrap > .o_custom_snippet_edit > button",
62+
trigger: ":iframe .o_snippet_preview_wrap[data-snippet-id^='s_banner_'] + .o_custom_snippet_edit > button.fa-pencil",
5863
run: "click",
5964
},
6065
{
6166
content: "Set name",
62-
trigger: ".o_rename_custom_snippet_dialog input[id='customSnippetName']",
67+
trigger: ".modal-dialog input#inputConfirmation",
6368
run: "edit Bruce Banner",
6469
},
6570
{
6671
content: "Confirm rename",
67-
trigger: ".o_rename_custom_snippet_dialog footer .btn-primary",
72+
trigger: ".modal-dialog footer .btn-primary",
6873
run: "click",
6974
},
7075
{
7176
content: "Click on the 'Bruce Banner' snippet",
72-
trigger: ":iframe .o_snippet_preview_wrap[data-snippet-id^='s_banner_']:has(section[data-name='Bruce Banner'])",
77+
trigger: ":iframe .o_snippet_preview_wrap[data-snippet-id^='s_banner_'] section[data-name='Bruce Banner']",
7378
run: "click",
7479
},
7580
{
@@ -82,12 +87,12 @@ registerWebsitePreviewTour('test_custom_snippet', {
8287
},
8388
{
8489
content: "Click on the Custom category block",
85-
trigger: "#oe_snippets .oe_snippet[name='Custom'].o_we_draggable .oe_snippet_thumbnail",
90+
trigger: ".o-snippets-menu .o_snippet[name='Custom'].o_draggable .o_snippet_thumbnail_area",
8691
run: "click",
8792
},
8893
{
8994
content: "Delete custom snippet",
90-
trigger: ":iframe .o_custom_snippet_wrap > .o_custom_snippet_edit > button + button",
95+
trigger: ":iframe .o_snippet_preview_wrap + .o_custom_snippet_edit > button + button.fa-trash",
9196
run: "click",
9297
},
9398
{
@@ -97,6 +102,6 @@ registerWebsitePreviewTour('test_custom_snippet', {
97102
},
98103
{
99104
content: "Ensure custom snippet disappeared",
100-
trigger: ":iframe .o_add_snippets_preview:not(:has(section[data-name='Bruce Banner']))",
105+
trigger: ":iframe .o_add_snippets_preview:not(:has([data-name='Bruce Banner']))",
101106
},
102107
]);

addons/test_website/tests/test_custom_snippet.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33

44
import odoo.tests
55
from odoo.tools import mute_logger
6-
import unittest
76

8-
# TODO master-mysterious-egg fix error
9-
@unittest.skip("prepare mysterious-egg for merging")
107
@odoo.tests.common.tagged('post_install', '-at_install')
118
class TestCustomSnippet(odoo.tests.HttpCase):
129

0 commit comments

Comments
 (0)