Skip to content

Fix test_01_run_tour #4556

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master-mysterious-egg-all
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions addons/html_builder/static/src/snippets/snippet_service.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,9 @@ export class SnippetModel extends Reactive {
this.orm.silent
.call("ir.ui.view", "render_public_asset", [this.snippetsName, {}], { context })
.then((html) => {
const snippetsDocument = new DOMParser().parseFromString(html, "text/html");
this.computeSnippetTemplates(snippetsDocument);
this.setSnippetName(snippetsDocument);
this.snippetsDocument = new DOMParser().parseFromString(html, "text/html");
this.computeSnippetTemplates(this.snippetsDocument);
this.setSnippetName(this.snippetsDocument);
resolve();
});
});
Expand Down Expand Up @@ -274,6 +274,13 @@ export class SnippetModel extends Reactive {
return;
}
snippet.title = newName;
for (const snippetEl of this.snippetsDocument.body.querySelectorAll("snippets#snippet_custom > *")) {
if (snippetEl.getAttribute("data-oe-snippet-key") === snippet.key) {
snippetEl.setAttribute("name", newName);
snippetEl.children[0].dataset["name"] = newName;
}
}

await this.orm.call("ir.ui.view", "rename_snippet", [], {
name: newName,
view_id: snippet.viewId,
Expand Down
27 changes: 16 additions & 11 deletions addons/test_website/static/tests/tours/custom_snippets.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,22 @@ registerWebsitePreviewTour('test_custom_snippet', {
},
{
content: "Save custom snippet",
trigger: ".snippet-option-SnippetSave we-button",
trigger: "button.oe_snippet_save",
run: "click",
},
{
content: "Confirm reload",
trigger: ".modal-dialog button:contains('Save and Reload')",
content: "Confirm Save",
trigger: ".modal-dialog button:contains('Save')",
run: "click",
},
{
content: "Click on Blocks",
trigger: ".o-snippets-tabs button[data-name='blocks']",
run: "click",
},
{
content: "Click on the Custom category block",
trigger: "#oe_snippets .oe_snippet[name='Custom'].o_we_draggable .oe_snippet_thumbnail",
trigger: ".o-snippets-menu .o_snippet[name='Custom'].o_draggable .o_snippet_thumbnail_area",
run: "click",
},
{
Expand All @@ -54,22 +59,22 @@ registerWebsitePreviewTour('test_custom_snippet', {
},
{
content: "Rename custom snippet",
trigger: ":iframe .o_custom_snippet_wrap > .o_custom_snippet_edit > button",
trigger: ":iframe .o_snippet_preview_wrap[data-snippet-id^='s_banner_'] + .o_custom_snippet_edit > button.fa-pencil",
run: "click",
},
{
content: "Set name",
trigger: ".o_rename_custom_snippet_dialog input[id='customSnippetName']",
trigger: ".modal-dialog input#inputConfirmation",
run: "edit Bruce Banner",
},
{
content: "Confirm rename",
trigger: ".o_rename_custom_snippet_dialog footer .btn-primary",
trigger: ".modal-dialog footer .btn-primary",
run: "click",
},
{
content: "Click on the 'Bruce Banner' snippet",
trigger: ":iframe .o_snippet_preview_wrap[data-snippet-id^='s_banner_']:has(section[data-name='Bruce Banner'])",
trigger: ":iframe .o_snippet_preview_wrap[data-snippet-id^='s_banner_'] section[data-name='Bruce Banner']",
run: "click",
},
{
Expand All @@ -82,12 +87,12 @@ registerWebsitePreviewTour('test_custom_snippet', {
},
{
content: "Click on the Custom category block",
trigger: "#oe_snippets .oe_snippet[name='Custom'].o_we_draggable .oe_snippet_thumbnail",
trigger: ".o-snippets-menu .o_snippet[name='Custom'].o_draggable .o_snippet_thumbnail_area",
run: "click",
},
{
content: "Delete custom snippet",
trigger: ":iframe .o_custom_snippet_wrap > .o_custom_snippet_edit > button + button",
trigger: ":iframe .o_snippet_preview_wrap + .o_custom_snippet_edit > button + button.fa-trash",
run: "click",
},
{
Expand All @@ -97,6 +102,6 @@ registerWebsitePreviewTour('test_custom_snippet', {
},
{
content: "Ensure custom snippet disappeared",
trigger: ":iframe .o_add_snippets_preview:not(:has(section[data-name='Bruce Banner']))",
trigger: ":iframe .o_add_snippets_preview:not(:has([data-name='Bruce Banner']))",
},
]);
3 changes: 0 additions & 3 deletions addons/test_website/tests/test_custom_snippet.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@

import odoo.tests
from odoo.tools import mute_logger
import unittest

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

Expand Down