summaryrefslogtreecommitdiff
path: root/addons/test_website_slides_full/tests/tours
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
commit3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch)
treea44932296ef4a9b71d5f010906253d8c53727726 /addons/test_website_slides_full/tests/tours
parent0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff)
initial commit 2
Diffstat (limited to 'addons/test_website_slides_full/tests/tours')
-rw-r--r--addons/test_website_slides_full/tests/tours/slides_certification_member.js173
1 files changed, 173 insertions, 0 deletions
diff --git a/addons/test_website_slides_full/tests/tours/slides_certification_member.js b/addons/test_website_slides_full/tests/tours/slides_certification_member.js
new file mode 100644
index 00000000..eec5f0b7
--- /dev/null
+++ b/addons/test_website_slides_full/tests/tours/slides_certification_member.js
@@ -0,0 +1,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
+ )
+);
+
+});