[IMP] website_slides: add a standard publisher tour
Purpose of this commit is to add a publisher tour in standard that is not only run using external tags. Indeed external tours are not monitored and previous commits show that they can be broken since a long time. In this commit we somehow copy the publisher tour with an article-based slide instead of a video slide. That way it can be launched with other standard tours. Task-2780920 (eLearning: fix publisher tour) Part-of: odoo/odoo#74171
This commit is contained in:
@@ -0,0 +1,104 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import tour from 'web_tour.tour';
|
||||
import slidesTourTools from '@website_slides/tests/tours/slides_tour_tools';
|
||||
|
||||
/**
|
||||
* Global use case:
|
||||
* a user (website publisher) creates a course;
|
||||
* he updates it;
|
||||
* he creates some lessons in it;
|
||||
* he publishes it;
|
||||
*/
|
||||
tour.register('course_publisher_standard', {
|
||||
url: '/slides',
|
||||
test: true
|
||||
}, [{
|
||||
content: 'eLearning: click on New (top-menu)',
|
||||
trigger: 'div.o_new_content_menu a'
|
||||
}, {
|
||||
content: 'eLearning: click on New Course',
|
||||
trigger: 'a:contains("Course")'
|
||||
}, {
|
||||
content: 'eLearning: set name',
|
||||
trigger: 'input[name="name"]',
|
||||
run: 'text How to Déboulonnate',
|
||||
}, {
|
||||
content: 'eLearning: click on tags',
|
||||
trigger: 'ul.select2-choices:first',
|
||||
}, {
|
||||
content: 'eLearning: select gardener tag',
|
||||
trigger: 'div.select2-result-label:contains("Gardener")',
|
||||
in_modal: false,
|
||||
}, {
|
||||
content: 'eLearning: set description',
|
||||
trigger: 'textarea[name="description"]',
|
||||
run: 'text Déboulonnate is very common at Fleurus',
|
||||
}, {
|
||||
content: 'eLearning: we want reviews',
|
||||
trigger: 'input[name="allow_comment"]',
|
||||
}, {
|
||||
content: 'eLearning: seems cool, create it',
|
||||
trigger: 'button:contains("Create")',
|
||||
}, {
|
||||
content: 'eLearning: launch course edition',
|
||||
trigger: 'div[id="edit-page-menu"] a',
|
||||
}, {
|
||||
content: 'eLearning: double click image to edit it',
|
||||
trigger: 'img.o_wslides_course_pict',
|
||||
run: 'dblclick',
|
||||
}, {
|
||||
content: 'eLearning: click "Add URL" to trigger URL box',
|
||||
trigger: '.o_upload_media_url_button',
|
||||
}, {
|
||||
content: 'eLearning: add a bioutifoul URL',
|
||||
trigger: 'input.o_we_url_input',
|
||||
run: 'text https://upload.wikimedia.org/wikipedia/commons/thumb/1/12/ThreeTimeAKCGoldWinnerPembrookeWelshCorgi.jpg/800px-ThreeTimeAKCGoldWinnerPembrookeWelshCorgi.jpg'
|
||||
}, {
|
||||
content: 'eLearning: click "Add URL" really adding image',
|
||||
trigger: '.o_upload_media_url_button',
|
||||
}, {
|
||||
content: 'eLearning: is the Corgi set ?',
|
||||
trigger: 'img.o_wslides_course_pict',
|
||||
run: function () {
|
||||
if ($('img.o_wslides_course_pict').attr('src').endsWith('GoldWinnerPembrookeWelshCorgi.jpg')) {
|
||||
$('img.o_wslides_course_pict').addClass('o_wslides_tour_success');
|
||||
}
|
||||
},
|
||||
}, {
|
||||
content: 'eLearning: the Corgi is set !',
|
||||
trigger: 'img.o_wslides_course_pict.o_wslides_tour_success',
|
||||
}, {
|
||||
content: 'eLearning: save course edition',
|
||||
trigger: 'button[data-action="save"]',
|
||||
}, {
|
||||
content: 'eLearning: course create with current member',
|
||||
extra_trigger: 'body:not(.editor_enable)', // wait for editor to close
|
||||
trigger: '.o_wslides_js_course_join:contains("You\'re enrolled")',
|
||||
run: function () {} // check membership
|
||||
}
|
||||
].concat(
|
||||
slidesTourTools.addExistingCourseTag(),
|
||||
slidesTourTools.addNewCourseTag('The Most Awesome Course'),
|
||||
slidesTourTools.addSection('Introduction'),
|
||||
slidesTourTools.addArticleToSection('Introduction', 'MyArticle'),
|
||||
[{
|
||||
content: "eLearning: check editor is loaded for article",
|
||||
trigger: 'body.editor_enable',
|
||||
timeout: 30000,
|
||||
run: () => null, // it's a check
|
||||
}, {
|
||||
content: "eLearning: save article",
|
||||
trigger: '.o_we_website_top_actions button.btn-primary:contains("Save")',
|
||||
}, {
|
||||
content: "eLearning: use breadcrumb to go back to channel",
|
||||
trigger: '.o_wslides_course_nav a:contains("Déboulonnate")',
|
||||
}]
|
||||
// [
|
||||
// {
|
||||
// content: 'eLearning: move new course inside introduction',
|
||||
// trigger: 'div.o_wslides_slides_list_drag',
|
||||
// // run: 'drag_and_drop div.o_wslides_slides_list_drag ul.ui-sortable:first',
|
||||
// run: 'drag_and_drop div.o_wslides_slides_list_drag a.o_wslides_js_slide_section_add',
|
||||
// }]
|
||||
));
|
||||
@@ -79,6 +79,9 @@ var addArticleToSection = function (sectionName, pageName) {
|
||||
content: 'eLearning: fill article completion time',
|
||||
trigger: 'input[name=duration]',
|
||||
run: 'text 4',
|
||||
}, {
|
||||
content: 'eLearning: create and publish slide',
|
||||
trigger: 'footer.modal-footer button:contains("Publish")',
|
||||
}];
|
||||
};
|
||||
|
||||
|
||||
@@ -152,8 +152,29 @@ class TestUi(TestUICommon):
|
||||
login=user_demo.login)
|
||||
|
||||
|
||||
@tests.common.tagged('post_install', '-at_install')
|
||||
class TestUiPublisher(HttpCaseWithUserDemo):
|
||||
|
||||
def test_course_publisher_elearning_manager(self):
|
||||
user_demo = self.user_demo
|
||||
user_demo.flush()
|
||||
user_demo.write({
|
||||
'groups_id': [
|
||||
(5, 0),
|
||||
(4, self.env.ref('base.group_user').id),
|
||||
(4, self.env.ref('website_slides.group_website_slides_manager').id)
|
||||
],
|
||||
})
|
||||
|
||||
self.browser_js(
|
||||
'/slides',
|
||||
'odoo.__DEBUG__.services["web_tour.tour"].run("course_publisher_standard")',
|
||||
'odoo.__DEBUG__.services["web_tour.tour"].tours.course_publisher_standard.ready',
|
||||
login=user_demo.login)
|
||||
|
||||
|
||||
@tests.common.tagged('external', 'post_install', '-standard', '-at_install')
|
||||
class TestUiYoutube(HttpCaseWithUserDemo):
|
||||
class TestUiPublisherYoutube(HttpCaseWithUserDemo):
|
||||
|
||||
def test_course_member_yt_employee(self):
|
||||
# remove membership because we need to be able to join the course during the tour
|
||||
|
||||
Reference in New Issue
Block a user