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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
|
odoo.define('survey.tour_test_survey_prefill', function (require) {
'use strict';
var tour = require('web_tour.tour');
tour.register('test_survey_prefill', {
test: true,
url: '/survey/start/b137640d-14d4-4748-9ef6-344caaaaaae'
},
[{ // Page-1
trigger: 'button.btn.btn-primary.btn-lg:contains("Start Survey")',
}, { // Question: Where do you live ?
trigger: 'div.js_question-wrapper:contains("Where do you live ?") input',
run: 'text Grand-Rosiere',
}, { // Question: When is your date of birth ?
trigger: 'div.js_question-wrapper:contains("When is your date of birth ?") input',
run: 'text 05/05/1980',
}, { // Question: How frequently do you buy products online ?
trigger: 'div.js_question-wrapper:contains("How frequently do you buy products online ?") label:contains("Once a week")',
}, { // Question: How many times did you order products on our website ?
trigger: 'div.js_question-wrapper:contains("How many times did you order products on our website ?") input',
run: 'text 42',
}, {
content: 'Click on Next Page',
trigger: 'button[value="next"]',
},
// Page-2
{ // Question: Which of the following words would you use to describe our products ?
content: 'Answer Which of the following words would you use to describe our products (High Quality)',
trigger: 'div.js_question-wrapper:contains("Which of the following words would you use to describe our products") label:contains("High quality")',
}, {
content: 'Answer Which of the following words would you use to describe our products (Good value for money)',
trigger: 'div.js_question-wrapper:contains("Which of the following words would you use to describe our products") label:contains("Good value for money")',
}, {
content: 'Answer What do your think about our new eCommerce (The new layout and design is fresh and up-to-date)',
trigger: 'div.js_question-wrapper:contains("What do your think about our new eCommerce") tr:contains("The new layout and design is fresh and up-to-date") td:first',
}, {
content: 'Answer What do your think about our new eCommerce (It is easy to find the product that I want)',
trigger: 'div.js_question-wrapper:contains("What do your think about our new eCommerce") tr:contains("It is easy to find the product that I want") td:eq(2)',
}, {
content: 'Answer What do your think about our new eCommerce (The tool to compare the products is useful to make a choice)',
trigger: 'div.js_question-wrapper:contains("What do your think about our new eCommerce") tr:contains("The tool to compare the products is useful to make a choice") td:eq(3)',
}, {
content: 'Answer What do your think about our new eCommerce (The checkout process is clear and secure)',
trigger: 'div.js_question-wrapper:contains("What do your think about our new eCommerce") tr:contains("The checkout process is clear and secure") td:eq(2)',
}, {
content: 'Answer What do your think about our new eCommerce (I have added products to my wishlist)',
trigger: 'div.js_question-wrapper:contains("What do your think about our new eCommerce") tr:contains("I have added products to my wishlist") td:last',
}, {
content: 'Answer Do you have any other comments, questions, or concerns',
trigger: 'div.js_question-wrapper:contains("Do you have any other comments, questions, or concerns") textarea',
run: 'text Is the prefill working?',
}, {
// Go back to previous page
content: 'Click on the previous page name in the breadcrumb',
trigger: 'ol.breadcrumb a:first',
}, {
trigger: 'div.js_question-wrapper:contains("How many times did you order products on our website ?") input',
run: function () {
var $inputQ3 = $('div.js_question-wrapper:contains("How many times did you order products on our website ?") input');
if ($inputQ3.val() === '42.0') {
$('.o_survey_title').addClass('prefilled');
}
}
}, {
trigger: '.o_survey_title.prefilled',
run: function () {
// check that all the answers are prefilled in Page 1
var $inputQ1 = $('div.js_question-wrapper:contains("Where do you live ?") input');
if ($inputQ1.val() !== 'Grand-Rosiere') {
return;
}
var $inputQ2 = $('div.js_question-wrapper:contains("When is your date of birth ?") input');
if ($inputQ2.val() !== '05/05/1980') {
return;
}
var $inputQ3 = $('div.js_question-wrapper:contains("How frequently do you buy products online ?") label:contains("Once a week") input');
if (!$inputQ3.is(':checked')) {
return;
}
var $inputQ4 = $('div.js_question-wrapper:contains("How many times did you order products on our website ?") input');
if ($inputQ4.val() !== '42.0') {
return;
}
$('.o_survey_title').addClass('tour_success');
}
}, {
trigger: '.o_survey_title.tour_success'
}, {
content: 'Click on Next Page',
trigger: 'button[value="next"]',
}, {
trigger: 'div.js_question-wrapper:contains("Do you have any other comments, questions, or concerns") textarea',
run: function () {
var $inputQ3 = $('div.js_question-wrapper:contains("Do you have any other comments, questions, or concerns") textarea');
if ($inputQ3.val() === "Is the prefill working?") {
$('.o_survey_title').addClass('prefilled2');
}
}
}, {
trigger: '.o_survey_title.prefilled2',
run: function () {
// check that all the answers are prefilled in Page 2
var $input1Q1 = $('div.js_question-wrapper:contains("Which of the following words would you use to describe our products") label:contains("High quality") input');
if (!$input1Q1.is(':checked')) {
return;
}
var $input2Q1 = $('div.js_question-wrapper:contains("Which of the following words would you use to describe our products") label:contains("Good value for money") input');
if (!$input2Q1.is(':checked')) {
return;
}
var $input1Q2 = $('div.js_question-wrapper:contains("What do your think about our new eCommerce") tr:contains("The new layout and design is fresh and up-to-date") input:first');
if (!$input1Q2.is(':checked')) {
return;
}
var $input2Q2 = $('div.js_question-wrapper:contains("What do your think about our new eCommerce") tr:contains("It is easy to find the product that I want") input:eq(2)');
if (!$input2Q2.is(':checked')) {
return;
}
var $input3Q2 = $('div.js_question-wrapper:contains("What do your think about our new eCommerce") tr:contains("The tool to compare the products is useful to make a choice") input:eq(3)');
if (!$input3Q2.is(':checked')) {
return;
}
var $input4Q2 = $('div.js_question-wrapper:contains("What do your think about our new eCommerce") tr:contains("The checkout process is clear and secure") input:eq(2)');
if (!$input4Q2.is(':checked')) {
return;
}
var $input5Q2 = $('div.js_question-wrapper:contains("What do your think about our new eCommerce") tr:contains("I have added products to my wishlist") input:last');
if (!$input5Q2.is(':checked')) {
return;
}
var $inputQ3 = $('div.js_question-wrapper:contains("Do you have any other comments, questions, or concerns") textarea');
if ($inputQ3.val() !== "Is the prefill working?") {
return;
}
$('.o_survey_title').addClass('tour_success_2');
}
}, {
trigger: '.o_survey_title.tour_success_2'
}
]);
});
|