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
|
odoo.define('website_slides.tour.slide.course.member', function (require) {
'use strict';
var tour = require('web_tour.tour');
/**
* Global use case:
* an user (either employee, website publisher or portal) joins a public
course;
* he has access to the full course content when he's a member of the
course;
* he uses fullscreen player to complete the course;
* he rates the course;
*/
tour.register('course_member', {
url: '/slides',
test: true
}, [
// eLearning: go on free course and join it
{
trigger: 'a:contains("Basics of Gardening - Test")'
}, {
trigger: 'a:contains("Join Course")'
}, {
trigger: '.o_wslides_js_course_join:contains("You\'re enrolled")',
run: function () {} // check membership
}, {
trigger: 'a:contains("Gardening: The Know-How")',
},
// eLearning: follow course by cliking on first lesson and going to fullscreen player
{
trigger: '.o_wslides_fs_sidebar_list_item div:contains("Home Gardening")'
}, {
trigger: '.o_wslides_fs_sidebar_header',
run: function () {
// check navigation with arrow keys
var event = jQuery.Event("keydown");
event.key = "ArrowLeft";
// go back once
$(document).trigger(event);
// check that it selected the previous tab
if ($('.o_wslides_fs_sidebar_list_item.active:contains("Gardening: The Know-How")').length === 0) {
return;
}
// getting here means that navigation worked
$('.o_wslides_fs_sidebar_header').addClass('navigation-success-1');
}
}, {
trigger: '.o_wslides_fs_sidebar_header.navigation-success-1',
extra_trigger: '.o_wslides_progress_percentage:contains("40")',
run: function () {
// check navigation with arrow keys
var event = jQuery.Event("keydown");
event.key = "ArrowRight";
$(document).trigger(event);
// check that it selected the next/next tab
if ($('.o_wslides_fs_sidebar_list_item.active:contains("Home Gardening")').length === 0) {
return;
}
// getting here means that navigation worked
$('.o_wslides_fs_sidebar_header').addClass('navigation-success-2');
}
}, {
trigger: '.o_wslides_progress_percentage:contains("40")',
run: function () {} // check progression
}, {
trigger: '.o_wslides_fs_sidebar_header.navigation-success-2',
extra_trigger: '.o_wslides_progress_percentage:contains("40")',
run: function () {
// check navigation with arrow keys
var event = jQuery.Event("keydown");
event.key = "ArrowRight";
setTimeout(function () {
$(document).trigger(event);
// check that it selected the next/next tab
if ($('.o_wslides_fs_sidebar_list_item.active:contains("Mighty Carrots")').length === 0) {
return;
}
// getting here means that navigation worked
$('.o_wslides_fs_sidebar_header').addClass('navigation-success-3');
}, 300);
}
}, {
trigger: '.o_wslides_progress_percentage:contains("60")',
run: function () {} // check progression
}, {
trigger: '.o_wslides_fs_sidebar_header.navigation-success-3',
extra_trigger: '.o_wslides_progress_percentage:contains("60")',
run: function () {} // check that previous step succeeded
}, {
trigger: '.o_wslides_fs_sidebar_list_item div:contains("How to Grow and Harvest The Best Strawberries | Basics")'
}, {
trigger: '.o_wslides_fs_sidebar_section_slides li:contains("How to Grow and Harvest The Best Strawberries | Basics") .o_wslides_slide_completed',
run: function () {} // check that video slide is marked as 'done'
}, {
trigger: '.o_wslides_progress_percentage:contains("80")',
run: function () {} // check progression
},
// eLearning: last slide is a quiz, complete it
{
trigger: '.o_wslides_fs_sidebar_list_item div:contains("Test your knowledge")'
}, {
trigger: '.o_wslides_js_lesson_quiz_question:first .list-group a:first'
}, {
trigger: '.o_wslides_js_lesson_quiz_question:last .list-group a:first'
}, {
trigger: '.o_wslides_js_lesson_quiz_submit'
}, {
trigger: 'a:contains("End course")'
},
// eLearning: ending course redirect to /slides, course is completed now
{
trigger: 'div:contains("Basics of Gardening") span:contains("Completed")',
run: function () {} // check that the course is marked as completed
},
// eLearning: go back on course and rate it (new rate or update it, both should work)
{
trigger: 'a:contains("Basics of Gardening")'
}, {
trigger: 'button[data-target="#ratingpopupcomposer"]'
}, {
trigger: 'form.o_portal_chatter_composer_form i.fa:eq(4)',
extra_trigger: 'div.modal_shown',
run: 'click',
in_modal: false,
}, {
trigger: 'form.o_portal_chatter_composer_form textarea',
run: 'text This is a great course. Top !',
in_modal: false,
}, {
trigger: 'button.o_portal_chatter_composer_btn',
in_modal: false,
}, {
trigger: 'a[id="review-tab"]'
}, {
trigger: '.o_portal_chatter_message:contains("This is a great course. Top !")',
run: function () {}, // check review is correctly added
}
]);
});
|