1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
odoo.define('test_website.custom_snippets', function (require) {
'use strict';
var tour = require('web_tour.tour');
/**
* The purpose of this tour is to check the custom snippets flow:
*
* -> go to edit mode
* -> drag a banner into page content
* -> customize banner (set text)
* -> save banner as custom snippet
* -> confirm name (remove in master when implicit default name feature is implemented)
* -> confirm save & reload (remove in master because reload is not needed anymore)
* -> ensure custom snippet is available
* -> drag custom snippet
* -> ensure block appears as banner
* -> ensure block appears as custom banner
* -> delete custom snippet
* -> confirm delete
* -> ensure it was deleted
*/
tour.register('test_custom_snippet', {
url: '/',
test: true
}, [
{
content: "enter edit mode",
trigger: "a[data-action=edit]"
},
{
content: "drop a snippet",
trigger: "#oe_snippets .oe_snippet[name='Banner'] .oe_snippet_thumbnail:not(.o_we_already_dragging)",
extra_trigger: "body.editor_enable.editor_has_snippets",
moveTrigger: ".oe_drop_zone",
run: "drag_and_drop #wrap",
},
{
content: "customize snippet",
trigger: "#wrapwrap .s_banner h1",
run: "text",
consumeEvent: "input",
},
{
content: "save custom snippet",
trigger: ".snippet-option-SnippetSave we-button",
},
{
content: "confirm save name",
trigger: ".modal-dialog button span:contains('Save')",
},
{
content: "confirm save and reload",
trigger: ".modal-dialog button span:contains('Save and Reload')",
},
{
content: "ensure custom snippet appeared",
trigger: "#oe_snippets .oe_snippet[name='Custom Banner']",
run: function() {}, // check
},
{
content: "drop custom snippet",
trigger: ".oe_snippet[name='Custom Banner'] .oe_snippet_thumbnail:not(.o_we_already_dragging)",
extra_trigger: "body.editor_enable.editor_has_snippets",
moveTrigger: ".oe_drop_zone",
run: "drag_and_drop #wrap",
},
{
content: "ensure banner section exists",
trigger: "#wrap section[data-name='Banner']",
run: function() {}, // check
},
{
content: "ensure custom banner section exists",
trigger: "#wrap section[data-name='Custom Banner']",
run: function() {}, // check
},
{
content: "delete custom snippet",
trigger: ".oe_snippet[name='Custom Banner'] we-button.o_delete_btn",
extra_trigger: ".oe_snippet[name='Custom Banner'] .oe_snippet_thumbnail:not(.o_we_already_dragging)",
},
{
content: "confirm delete",
trigger: ".modal-dialog button:has(span:contains('Yes'))",
},
{
content: "ensure custom snippet disappeared",
trigger: "#oe_snippets",
extra_trigger: "#oe_snippets:not(:has(.oe_snippet[name='Custom Banner']))",
run: function() {}, // check
},
]);
});
|