diff --git a/addons/html_builder/static/tests/block_tab/snippet_groups.test.js b/addons/html_builder/static/tests/block_tab/snippet_groups.test.js index 4cb0a7ba50dc4..427a2c34c0fcf 100644 --- a/addons/html_builder/static/tests/block_tab/snippet_groups.test.js +++ b/addons/html_builder/static/tests/block_tab/snippet_groups.test.js @@ -14,6 +14,7 @@ import { defineWebsiteModels, getSnippetStructure, setupWebsiteBuilder, + setupWebsiteBuilderWithDummySnippet, } from "../helpers"; defineWebsiteModels(); @@ -370,27 +371,7 @@ test("drag&drop snippet structure", async () => { }); test("cancel snippet drag & drop over sidebar", async () => { - const snippetsDescription = (withName = false) => { - const name = "Test"; - return [ - { - name: name, - groupName: "a", - content: getBasicSection("Yop", { name: withName ? name : "" }), - }, - ]; - }; - - const { getEditableContent } = await setupWebsiteBuilder("", { - snippets: { - snippet_groups: [ - '
', - ], - snippet_structure: snippetsDescription().map((snippetDesc) => - getSnippetStructure(snippetDesc) - ), - }, - }); + const { getEditableContent } = await setupWebsiteBuilderWithDummySnippet(); const initialDropZone = `
`; const editableContent = getEditableContent(); expect(editableContent).toHaveInnerHTML(initialDropZone); @@ -401,7 +382,11 @@ test("cancel snippet drag & drop over sidebar", async () => { await moveTo(".o-website-builder_sidebar"); expect(editableContent).toHaveInnerHTML(unformat(initialDropZone)); - await drop(); + // Specifying an explicit target should not be needed, but the test + // sometimes fails, probably because the snippet is partially touching the + // iframe. We drop on the "Save" button to be as far as possible from the + // iframe. + await drop("button[data-action=save]"); expect(".o_add_snippet_dialog").toHaveCount(0); expect(editableContent).toHaveInnerHTML(unformat(initialDropZone)); });