| 1 |
import { registry } from "@web/core/registry"; |
| 2 |
|
| 3 |
/** |
| 4 |
* This tour validates the complete certification flow for a student (= portal user). |
| 5 |
* |
| 6 |
* The tour consists of two main scenarios: |
| 7 |
* |
| 8 |
* 1. **Failure Attempts** |
| 9 |
* - The student is redirected to the "All Courses" page. |
| 10 |
* - Navigates to the certification course. |
| 11 |
* - Starts the certification process. |
| 12 |
* - Fails the test 3 times, exhausting all attempts. |
| 13 |
* - Is removed from the course members. |
| 14 |
* |
| 15 |
* 2. **Successful Attempt** |
| 16 |
* - The student is redirected to the "All Courses" page. |
| 17 |
* - Navigates to the certification course. |
| 18 |
* - Starts the certification process. |
| 19 |
* - Successfully completes the certification. |
| 20 |
* - The course is marked as completed. |
| 21 |
* - The certification is added to their user profile. |
| 22 |
*/ |
| 23 |
|
| 24 |
var startCertificationSurvey = [{ |
| 25 |
content: 'eLearning: go to certification course', |
| 26 |
trigger: 'a:contains("DIY Furniture - TEST")', |
| 27 |
run: "click", |
| 28 |
expectUnloadPage: true, |
| 29 |
}, { |
| 30 |
content: 'eLearning: user should be enrolled', |
| 31 |
trigger: '.o_wslides_js_course_join:contains("You\'re enrolled")', |
| 32 |
}, { |
| 33 |
content: 'eLearning: start course', |
| 34 |
trigger: '.o_wslides_js_slides_list_slide_link', |
| 35 |
run: "click", |
| 36 |
expectUnloadPage: true, |
| 37 |
}]; |
| 38 |
|
| 39 |
var failCertificationSteps = [{ |
| 40 |
content: 'eLearning: start certification', |
| 41 |
trigger: 'button:contains("Start Certification")', |
| 42 |
run: "click", |
| 43 |
}, { // Question: What type of wood is the best for furniture? |
| 44 |
content: 'Survey: selecting answer "Fir"', |
| 45 |
trigger: 'div.js_question-wrapper:contains("What type of wood is the best for furniture") label:contains("Fir")', |
| 46 |
run: "click", |
| 47 |
}, { // Question: Select all the furniture shown in the video |
| 48 |
content: 'Survey: ticking answer "Table"', |
| 49 |
trigger: 'div.js_question-wrapper:contains("Select all the furniture shown in the video") label:contains("Table")', |
| 50 |
run: "click", |
| 51 |
}, { |
| 52 |
content: 'Survey: ticking answer "Bed"', |
| 53 |
trigger: 'div.js_question-wrapper:contains("Select all the furniture shown in the video") label:contains("Bed")', |
| 54 |
run: "click", |
| 55 |
}, { |
| 56 |
content: 'Survey: submitting the certification with wrong answers', |
| 57 |
trigger: 'button:contains("Submit")', |
| 58 |
run: "click", |
| 59 |
}, { |
| 60 |
content: "Click on Submit", |
| 61 |
trigger: 'button.btn-primary:contains("Submit")', |
| 62 |
run: "click", |
| 63 |
}]; |
| 64 |
|
| 65 |
var retrySteps = [{ |
| 66 |
content: 'Survey: retry certification', |
| 67 |
trigger: 'a:contains("Retry")', |
| 68 |
run: "click", |
| 69 |
expectUnloadPage: true, |
| 70 |
}]; |
| 71 |
|
| 72 |
var succeedCertificationSteps = [{ |
| 73 |
content: 'eLearning: start certification', |
| 74 |
trigger: 'button:contains("Start Certification")', |
| 75 |
run: "click", |
| 76 |
}, { // Question: What type of wood is the best for furniture? |
| 77 |
content: 'Survey: selecting answer "Oak"', |
| 78 |
trigger: 'div.js_question-wrapper:contains("What type of wood is the best for furniture") label:contains("Oak")', |
| 79 |
run: "click", |
| 80 |
}, { // Question: Select all the furniture shown in the video |
| 81 |
content: 'Survey: ticking answer "Chair"', |
| 82 |
trigger: 'div.js_question-wrapper:contains("Select all the furniture shown in the video") label:contains("Chair")', |
| 83 |
run: "click", |
| 84 |
}, { |
| 85 |
content: 'Survey: ticking answer "Shelve"', |
| 86 |
trigger: 'div.js_question-wrapper:contains("Select all the furniture shown in the video") label:contains("Shelve")', |
| 87 |
run: "click", |
| 88 |
}, { |
| 89 |
content: 'Survey: ticking answer "Desk"', |
| 90 |
trigger: 'div.js_question-wrapper:contains("Select all the furniture shown in the video") label:contains("Desk")', |
| 91 |
run: "click", |
| 92 |
}, { |
| 93 |
content: 'Survey: submitting the certification with correct answers', |
| 94 |
trigger: 'button:contains("Submit")', |
| 95 |
run: "click", |
| 96 |
}, { |
| 97 |
content: "Click on Submit", |
| 98 |
trigger: 'button.btn-primary:contains("Submit")', |
| 99 |
run: "click", |
| 100 |
}]; |
| 101 |
|
| 102 |
var certificationCompletionSteps = [{ |
| 103 |
content: 'Survey: check certification successful', |
| 104 |
trigger: 'div:contains("Congratulations, you have passed the test")', |
| 105 |
}, { // Sharing the certification |
| 106 |
trigger: 'a:contains("Share your certification")', |
| 107 |
run: "click", |
| 108 |
}, { |
| 109 |
trigger: '.o_wslides_js_share_email input', |
| 110 |
run: "edit [email protected]", |
| 111 |
}, { |
| 112 |
trigger: '.o_wslides_js_share_email button', |
| 113 |
run: "click", |
| 114 |
}, { |
| 115 |
trigger: '.o_wslides_js_share_email .alert:not(.d-none):contains("Sharing is caring")', |
| 116 |
}, { |
| 117 |
trigger: 'button.btn-close', // close sharing modal, |
| 118 |
run: "click", |
| 119 |
}, { |
| 120 |
content: 'Survey: back to course home page', |
| 121 |
trigger: 'a:contains("Go back to course")', |
| 122 |
run: "click", |
| 123 |
expectUnloadPage: true, |
| 124 |
}, { |
| 125 |
content: 'eLearning: course should be completed', |
| 126 |
trigger: '.o_wslides_channel_completion_completed', |
| 127 |
}]; |
| 128 |
|
| 129 |
var profileSteps = [{ |
| 130 |
content: 'eLearning: back to e-learning home page', |
| 131 |
trigger: 'a:contains("Courses")', |
| 132 |
run: "click", |
| 133 |
expectUnloadPage: true, |
| 134 |
}, { |
| 135 |
content: 'eLearning: access user profile', |
| 136 |
trigger: '.o_wslides_home_aside_loggedin a:contains("View")', |
| 137 |
run: "click", |
| 138 |
expectUnloadPage: true, |
| 139 |
}, { |
| 140 |
content: 'eLearning: check that the user profile certifications include the new certification', |
| 141 |
trigger: '.o_wprofile_slides_course_card_body:contains("Furniture Creation Certification")', |
| 142 |
}]; |
| 143 |
|
| 144 |
registry.category("web_tour.tours").add('certification_member_failure', { |
| 145 |
url: '/slides', |
| 146 |
steps: () => [].concat( |
| 147 |
startCertificationSurvey, |
| 148 |
failCertificationSteps, |
| 149 |
retrySteps, |
| 150 |
failCertificationSteps, |
| 151 |
retrySteps, |
| 152 |
failCertificationSteps |
| 153 |
) |
| 154 |
}); |
| 155 |
|
| 156 |
registry.category("web_tour.tours").add('certification_member_success', { |
| 157 |
url: '/slides', |
| 158 |
steps: () => [].concat( |
| 159 |
startCertificationSurvey, |
| 160 |
succeedCertificationSteps, |
| 161 |
certificationCompletionSteps, |
| 162 |
profileSteps |
| 163 |
) |
| 164 |
}); |