| 1 |
import { insertSnippet, registerWebsitePreviewTour } from "@website/js/tours/tour_utils"; |
| 2 |
|
| 3 |
/** |
| 4 |
* The purpose of this tour is to check the custom snippets flow: |
| 5 |
* |
| 6 |
* -> go to edit mode |
| 7 |
* -> drag a banner into page content |
| 8 |
* -> customize banner (set text) |
| 9 |
* -> save banner as custom snippet |
| 10 |
* -> confirm save |
| 11 |
* -> ensure custom snippet is available in the "add snippet" dialog |
| 12 |
* -> add custom snippet into the page |
| 13 |
* -> ensure block appears as banner |
| 14 |
* -> ensure block appears as custom banner |
| 15 |
* -> rename custom banner |
| 16 |
* -> verify rename took effect |
| 17 |
* -> delete custom snippet |
| 18 |
* -> confirm delete |
| 19 |
* -> ensure it was deleted |
| 20 |
*/ |
| 21 |
|
| 22 |
registerWebsitePreviewTour('test_custom_snippet', { |
| 23 |
url: '/', |
| 24 |
edition: true, |
| 25 |
}, () => [ |
| 26 |
...insertSnippet({ |
| 27 |
id: 's_banner', |
| 28 |
name: 'Banner', |
| 29 |
groupName: "Intro", |
| 30 |
}), |
| 31 |
{ |
| 32 |
content: "Customize snippet", |
| 33 |
trigger: ":iframe #wrapwrap .s_banner h1", |
| 34 |
run: "editor Test", |
| 35 |
}, |
| 36 |
{ |
| 37 |
content: "Save custom snippet", |
| 38 |
trigger: "div[data-container-title='Banner'] .oe_snippet_save", |
| 39 |
run: "click", |
| 40 |
}, |
| 41 |
{ |
| 42 |
content: "Confirm reload", |
| 43 |
trigger: ".modal-dialog button:contains('Save')", |
| 44 |
run: "click", |
| 45 |
}, |
| 46 |
{ |
| 47 |
content: "Click on the block tab", |
| 48 |
trigger: ".o-snippets-tabs button[data-name='blocks']", |
| 49 |
run: "click", |
| 50 |
}, |
| 51 |
{ |
| 52 |
content: "Click on the Custom category block", |
| 53 |
trigger: ".o_block_tab:not(.o_we_ongoing_insertion) #snippet_groups .o_snippet[name='Custom'].o_draggable .o_snippet_thumbnail .o_snippet_thumbnail_area", |
| 54 |
run: "click", |
| 55 |
}, |
| 56 |
{ |
| 57 |
content: "Ensure custom snippet preview appeared in the dialog", |
| 58 |
trigger: ":iframe .o_snippet_preview_wrap[data-snippet-id^='s_banner_'] section[data-name='Custom Banner']", |
| 59 |
}, |
| 60 |
{ |
| 61 |
content: "Rename custom snippet", |
| 62 |
trigger: ":iframe .o_custom_snippet_edit > button", |
| 63 |
run: "click", |
| 64 |
}, |
| 65 |
{ |
| 66 |
content: "Set name", |
| 67 |
trigger: ".modal-dialog:not(.o_inactive_modal body) input[id='inputConfirmation']", |
| 68 |
run: "edit Bruce Banner", |
| 69 |
}, |
| 70 |
{ |
| 71 |
content: "Confirm rename", |
| 72 |
trigger: ".modal-dialog:not(.o_inactive_modal body) footer .btn-primary", |
| 73 |
run: "click", |
| 74 |
}, |
| 75 |
{ |
| 76 |
content: "Click on the 'Bruce Banner' snippet", |
| 77 |
trigger: ":iframe .o_snippet_preview_wrap[data-snippet-id^='s_banner_']:has(section[data-name='Bruce Banner'])", |
| 78 |
run: "click", |
| 79 |
}, |
| 80 |
{ |
| 81 |
content: "Ensure banner section exists", |
| 82 |
trigger: ":iframe #wrap section[data-name='Banner']", |
| 83 |
}, |
| 84 |
{ |
| 85 |
content: "Ensure custom banner section exists", |
| 86 |
trigger: ":iframe #wrap section[data-name='Bruce Banner']", |
| 87 |
}, |
| 88 |
{ |
| 89 |
content: "Click on the Custom category block", |
| 90 |
trigger: ".o_block_tab:not(.o_we_ongoing_insertion) #snippet_groups .o_snippet[name='Custom'].o_draggable .o_snippet_thumbnail .o_snippet_thumbnail_area", |
| 91 |
run: "click", |
| 92 |
}, |
| 93 |
{ |
| 94 |
content: "Delete custom snippet", |
| 95 |
trigger: ":iframe .o_custom_snippet_edit > button + button", |
| 96 |
run: "click", |
| 97 |
}, |
| 98 |
{ |
| 99 |
content: "Confirm delete", |
| 100 |
trigger: ".modal-dialog button:contains('Yes')", |
| 101 |
run: "click", |
| 102 |
}, |
| 103 |
{ |
| 104 |
content: "Ensure custom snippet disappeared", |
| 105 |
trigger: ":iframe .o_add_snippets_preview:not(:has(section[data-name='Bruce Banner']))", |
| 106 |
}, |
| 107 |
]); |