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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
|
odoo.define('test_website_slides_full.tour.slide.certification.member', function (require) {
"use strict";
var tour = require('web_tour.tour');
/**
* The purpose of this tour is to check the whole certification flow:
*
* -> student (= demo user) checks 'on payment' course content
* -> clicks on "buy course"
* -> is redirected to webshop on the product page
* -> buys the course
* -> fails 3 times, exhausting his attempts
* -> is removed to the members of the course
* -> buys the course again
* -> succeeds the certification
* -> has the course marked as completed
* -> has the certification in his user profile
*
*/
var initTourSteps = [{
content: 'eLearning: go to certification course',
trigger: 'a:contains("DIY Furniture - TEST")'
}, {
content: 'eLearning: does not have access to certification',
trigger: '.o_wslides_course_main',
run: function () {
// check that user doesn't have access to course content
if ($('.o_wslides_slides_list_slide .o_wslides_js_slides_list_slide_link').length === 0) {
$('.o_wslides_course_main').addClass('empty-content-success');
}
}
}, {
content: 'eLearning: previous step check',
trigger: '.o_wslides_course_main.empty-content-success',
run: function () {} // check that previous step succeeded
}];
var buyCertificationSteps = [{
content: 'eLearning: try to buy course',
trigger: 'a:contains("Add to Cart")'
}, {
content: 'eCommerce: Process Checkout',
trigger: 'a:contains("Process Checkout")'
}, {
content: 'eCommerce: select Test payment acquirer',
trigger: '.o_payment_acquirer_select:contains("Test")'
}, {
content: 'eCommerce: add card number',
trigger: 'input[name="cc_number"]',
run: 'text 4242424242424242'
}, {
content: 'eCommerce: add card holder name',
trigger: 'input[name="cc_holder_name"]',
run: 'text Marc Demo'
}, {
content: 'eCommerce: add card expiry date',
trigger: 'input[name="cc_expiry"]',
run: 'text 11 / 50'
}, {
content: 'eCommerce: add card cvc',
trigger: 'input[name="cvc"]',
run: 'text 999'
}, {
content: 'eCommerce: pay',
trigger: '#o_payment_form_pay'
}, {
content: 'eCommerce: check that the payment is successful',
trigger: '.oe_website_sale_tx_status:contains("Your payment has been successfully processed")',
run: function () {}
}, {
content: 'eCommerce: go back to e-learning home page',
trigger: '.nav-link:contains("Courses")'
}, {
content: 'eLearning: go into bought course',
trigger: 'a:contains("DIY Furniture")'
}, {
content: 'eLearning: user should be enrolled',
trigger: '.o_wslides_js_course_join:contains("You\'re enrolled")',
run: function () {}
}, {
content: 'eLearning: start course',
trigger: '.o_wslides_js_slides_list_slide_link'
}];
var failCertificationSteps = [{
content: 'eLearning: start certification',
trigger: 'button:contains("Start Certification")'
}, { // Question: What type of wood is the best for furniture?
content: 'Survey: selecting answer "Fir"',
trigger: 'div.js_question-wrapper:contains("What type of wood is the best for furniture") label:contains("Fir")'
}, { // Question: Select all the furniture shown in the video
content: 'Survey: ticking answer "Table"',
trigger: 'div.js_question-wrapper:contains("Select all the furniture shown in the video") label:contains("Table")'
}, {
content: 'Survey: ticking answer "Bed"',
trigger: 'div.js_question-wrapper:contains("Select all the furniture shown in the video") label:contains("Bed")'
}, {
content: 'Survey: submitting the certification with wrong answers',
trigger: 'button:contains("Submit")'
}];
var retrySteps = [{
content: 'Survey: retry certification',
trigger: 'a:contains("Retry")'
}];
var succeedCertificationSteps = [{
content: 'eLearning: start certification',
trigger: 'button:contains("Start Certification")'
}, { // Question: What type of wood is the best for furniture?
content: 'Survey: selecting answer "Oak"',
trigger: 'div.js_question-wrapper:contains("What type of wood is the best for furniture") label:contains("Oak")',
}, { // Question: Select all the furniture shown in the video
content: 'Survey: ticking answer "Chair"',
trigger: 'div.js_question-wrapper:contains("Select all the furniture shown in the video") label:contains("Chair")'
}, {
content: 'Survey: ticking answer "Shelve"',
trigger: 'div.js_question-wrapper:contains("Select all the furniture shown in the video") label:contains("Shelve")'
}, {
content: 'Survey: ticking answer "Desk"',
trigger: 'div.js_question-wrapper:contains("Select all the furniture shown in the video") label:contains("Desk")'
}, {
content: 'Survey: submitting the certification with correct answers',
trigger: 'button:contains("Submit")'
}];
var certificationCompletionSteps = [{
content: 'Survey: check certification successful',
trigger: 'div:contains("Congratulations, you have passed the test")',
run: function () {}
}, {
content: 'Survey: back to course home page',
trigger: 'a:contains("Go back to course")'
}, {
content: 'eLearning: back to e-learning home page',
trigger: '.nav-link:contains("Courses")'
}, {
content: 'eLearning: course should be completed',
trigger: '.o_wslides_course_card:contains("DIY Furniture") .badge-pill:contains("Completed")',
run: function () {}
}];
var profileSteps = [{
content: 'eLearning: access user profile',
trigger: '.o_wslides_home_aside_loggedin a:contains("View")'
}, {
content: 'eLearning: check that the user profile certifications include the new certification',
trigger: '.o_wprofile_slides_course_card_body:contains("Furniture Creation Certification")',
run: function () {}
}];
tour.register('certification_member', {
url: '/slides',
test: true
}, [].concat(
initTourSteps,
buyCertificationSteps,
failCertificationSteps,
retrySteps,
failCertificationSteps,
retrySteps,
failCertificationSteps,
[{trigger: 'a:contains("Go back to course")'}],
buyCertificationSteps,
succeedCertificationSteps,
certificationCompletionSteps,
profileSteps
)
);
});
|