summaryrefslogtreecommitdiff
path: root/addons/website_slides/tests
diff options
context:
space:
mode:
authorThibault Delavallée <tde@odoo.com>2019-09-11 12:36:14 +0000
committerThibault Delavallée <tde@odoo.com>2019-09-11 12:39:26 +0000
commitc3b5f313072bec06809de89e18c13ee482f50a3c (patch)
tree4cf1412d183deeb9cec70f63b91362e2a579a61c /addons/website_slides/tests
parenteebb8e1484f29f4ae54617b1043d38f0cc1dd32f (diff)
[FIX][IMP] website_slides: move youtube dependent tour in its own tour and test
Contacting youtube API sometimes fails making falsy red runbot. In this commit we remove video from member tour so that it tests the interface. Some demo slides with youtube video are added in another course and new test is added that crawls that channel. Task 2066565 closes odoo/odoo#36697 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Diffstat (limited to 'addons/website_slides/tests')
-rw-r--r--addons/website_slides/tests/test_ui_wslides.py19
-rw-r--r--addons/website_slides/tests/tours/slides_course_member.js24
-rw-r--r--addons/website_slides/tests/tours/slides_course_member_yt.js67
-rw-r--r--addons/website_slides/tests/tours/slides_tour_tools.js4
4 files changed, 92 insertions, 22 deletions
diff --git a/addons/website_slides/tests/test_ui_wslides.py b/addons/website_slides/tests/test_ui_wslides.py
index be2293a1074..7d7b93bcb78 100644
--- a/addons/website_slides/tests/test_ui_wslides.py
+++ b/addons/website_slides/tests/test_ui_wslides.py
@@ -50,6 +50,25 @@ class TestUi(tests.HttpCase):
'odoo.__DEBUG__.services["web_tour.tour"].tours.course_member.ready',
login=user_portal.login)
+
+@tests.common.tagged('external', '-standard')
+class TestUiYoutube(tests.HttpCase):
+
+ def test_course_member_yt_employee(self):
+ # remove membership because we need to be able to join the course during the tour
+ user_demo = self.env.ref('base.user_demo')
+ user_demo.flush()
+ user_demo.write({
+ 'groups_id': [(5, 0), (4, self.env.ref('base.group_user').id)]
+ })
+ self.env.ref('website_slides.slide_channel_demo_0_gard_0')._remove_membership(self.env.ref('base.partner_demo'))
+
+ self.phantom_js(
+ '/slides',
+ 'odoo.__DEBUG__.services["web_tour.tour"].run("course_member_youtube")',
+ 'odoo.__DEBUG__.services["web_tour.tour"].tours.course_member_youtube.ready',
+ login=user_demo.login)
+
def test_course_publisher_website_designer(self):
# remove membership because we need to be able to join the course during the tour
# group_website_designer
diff --git a/addons/website_slides/tests/tours/slides_course_member.js b/addons/website_slides/tests/tours/slides_course_member.js
index 778ace3dbff..3f2a6325681 100644
--- a/addons/website_slides/tests/tours/slides_course_member.js
+++ b/addons/website_slides/tests/tours/slides_course_member.js
@@ -2,23 +2,6 @@ odoo.define('website_slides.tour.slide.course.member', function (require) {
'use strict';
var tour = require('web_tour.tour');
-var FullScreen = require('website_slides.fullscreen');
-
-/**
- * Alter this method for test purposes.
- * This will make the video start at 10 minutes.
- * As it lasts 10min24s, it will mark it as completed immediately.
- */
-FullScreen.include({
- _renderSlide: function () {
-
- var slide = this.get('slide');
- slide.embedUrl += '&start=600';
- this.set('slide', slide);
-
- return this._super.call(this, arguments);
- }
-});
/**
* Global use case:
@@ -105,12 +88,9 @@ tour.register('course_member', {
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 | Gardening Tips and Tricks")'
-}, {
- trigger: '.player',
- run: function () {} // check player loading
+ 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 | Gardening Tips and Tricks") .o_wslides_slide_completed',
+ 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")',
diff --git a/addons/website_slides/tests/tours/slides_course_member_yt.js b/addons/website_slides/tests/tours/slides_course_member_yt.js
new file mode 100644
index 00000000000..b060384d10a
--- /dev/null
+++ b/addons/website_slides/tests/tours/slides_course_member_yt.js
@@ -0,0 +1,67 @@
+odoo.define('website_slides.tour.slide.course.member.youtube', function (require) {
+'use strict';
+
+var tour = require('web_tour.tour');
+var FullScreen = require('website_slides.fullscreen');
+
+/**
+ * Alter this method for test purposes.
+ * This will make the video start at 10 minutes.
+ * As it lasts 10min24s, it will mark it as completed immediately.
+ */
+FullScreen.include({
+ _renderSlide: function () {
+
+ var slide = this.get('slide');
+ slide.embedUrl += '&start=260';
+ this.set('slide', slide);
+
+ return this._super.call(this, arguments);
+ }
+});
+
+/**
+ * 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_youtube', {
+ url: '/slides',
+ test: true
+}, [
+// eLearning: go on /all, find free course and join it
+{
+ trigger: 'a.o_wslides_home_all_slides'
+}, {
+ trigger: 'a:contains("Choose your wood")'
+}, {
+ trigger: 'a:contains("Join Course")'
+}, {
+ trigger: '.o_wslides_js_course_join:contains("You\'re enrolled")',
+ run: function () {} // check membership
+}, {
+ trigger: 'a:contains("Comparing Hardness of Wood Species")',
+}, {
+ trigger: '.o_wslides_progress_percentage:contains("50")',
+ run: function () {} // check progression
+}, {
+ trigger: 'a:contains("Wood Bending With Steam Box")',
+}, {
+ trigger: '.player',
+ run: function () {} // check player loading
+}, {
+ trigger: '.o_wslides_fs_sidebar_section_slides li:contains("Wood Bending With Steam Box") .o_wslides_slide_completed',
+ run: function () {} // check that video slide is marked as 'done'
+}, {
+ trigger: '.o_wslides_progress_percentage:contains("100")',
+ run: function () {} // check progression
+}, {
+ trigger: 'a:contains("Back to course")'
+}
+]);
+
+});
diff --git a/addons/website_slides/tests/tours/slides_tour_tools.js b/addons/website_slides/tests/tours/slides_tour_tools.js
index 3485377fdfb..2290cd4e982 100644
--- a/addons/website_slides/tests/tours/slides_tour_tools.js
+++ b/addons/website_slides/tests/tours/slides_tour_tools.js
@@ -1,6 +1,10 @@
odoo.define('website_slides.tour.tools', function (require) {
'use strict';
+/*
+ * PUBLISHER / CONTENT CREATION
+ */
+
var addSection = function (sectionName) {
return [
{