19.0 vanilla

This commit is contained in:
Ernad Husremovic 2026-03-09 09:30:27 +01:00
parent d1963a3c3a
commit 2d3ee4855a
7430 changed files with 2687981 additions and 2965473 deletions

View file

@ -1,109 +1,194 @@
odoo.define('survey.tour_test_certification_failure', function (require) {
'use strict';
import { patch } from "@web/core/utils/patch";
var SurveyFormWidget = require('survey.form');
/**
* Speed up fade-in fade-out to avoid useless delay in tests.
*/
SurveyFormWidget.include({
_submitForm: function () {
this.fadeInOutDelay = 0;
return this._super.apply(this, arguments);
}
});
function patchSurveyForm() {
const SurveyForm = odoo.loader.modules.get("@survey/interactions/survey_form").SurveyForm;
patch(SurveyForm.prototype, {
submitForm() {
this.fadeInOutDelay = 0;
return super.submitForm(...arguments);
},
});
}
/**
* This tour will test that, for the demo certification allowing 2 attempts, a user can
* try and fail twice and will no longer be able to take the certification.
*/
var tour = require('web_tour.tour');
import { registry } from "@web/core/registry";
var failSteps = [{ // Page-1
content: "Clicking on Start Certification",
trigger: 'button.btn.btn-primary.btn-lg:contains("Start Certification")',
}, { // Question: Do we sell Acoustic Bloc Screens?
content: "Selecting answer 'No'",
trigger: 'div.js_question-wrapper:contains("Do we sell Acoustic Bloc Screens") label:contains("No")',
}, { // Question: Select all the existing products
content: "Ticking answer 'Fanta'",
trigger: 'div.js_question-wrapper:contains("Select all the existing products") label:contains("Fanta")'
}, {
content: "Ticking answer 'Drawer'",
trigger: 'div.js_question-wrapper:contains("Select all the existing products") label:contains("Drawer")'
}, {
content: "Ticking answer 'Conference chair'",
trigger: 'div.js_question-wrapper:contains("Select all the existing products") label:contains("Conference chair")'
}, { // Question: Select all the available customizations for our Customizable Desk
content: "Ticking answer 'Color'",
trigger: 'div.js_question-wrapper:contains("Select all the available customizations for our Customizable Desk") label:contains("Color")'
}, {
content: "Ticking answer 'Height'",
trigger: 'div.js_question-wrapper:contains("Select all the available customizations for our Customizable Desk") label:contains("Height")'
}, { // Question: How many versions of the Corner Desk do we have?
content: "Selecting answer '2'",
trigger: 'div.js_question-wrapper:contains("How many versions of the Corner Desk do we have") label:contains("2")',
}, { // Question: Do you think we have missing products in our catalog? (not rated)
content: "Missing products",
trigger: 'div.js_question-wrapper:contains("Do you think we have missing products in our catalog") textarea',
run: "text I don't know products enough to be able to answer that",
}, { // Page-2 Question: How much do we sell our Cable Management Box?
content: "Selecting answer '$80'",
trigger: 'div.js_question-wrapper:contains("How much do we sell our Cable Management Box") label:contains("$80")',
}, { // Question: Select all the products that sell for $100 or more
content: "Ticking answer 'Corner Desk Right Sit'",
trigger: 'div.js_question-wrapper:contains("Select all the products that sell for $100 or more") label:contains("Corner Desk Right Sit")'
}, {
content: "Ticking answer 'Desk Combination'",
trigger: 'div.js_question-wrapper:contains("Select all the products that sell for $100 or more") label:contains("Desk Combination")'
}, {
content: "Ticking answer 'Office Chair Black'",
trigger: 'div.js_question-wrapper:contains("Select all the products that sell for $100 or more") label:contains("Office Chair Black")'
}, { // Question: What do you think about our prices (not rated)?
trigger: 'div.js_question-wrapper:contains("What do you think about our prices") label:contains("Correctly priced")',
}, { // Page-3 Question: How many days is our money-back guarantee?
content: "Inputting answer '60'",
trigger: 'div.js_question-wrapper:contains("How many days is our money-back guarantee") input',
run: 'text 60'
}, { // Question: If a customer purchases a product on 6 January 2020, what is the latest day we expect to ship it?
content: "Inputting answer '01/06/2020'",
trigger: 'div.js_question-wrapper:contains("If a customer purchases a product on 6 January 2020, what is the latest day we expect to ship it") input',
run: 'text 01/06/2020'
}, { // Question: If a customer purchases a 1 year warranty on 6 January 2020, when do we expect the warranty to expire?
content: "Inputting answer '01/06/2021 00:00:01'",
trigger: 'div.js_question-wrapper:contains("If a customer purchases a 1 year warranty on 6 January 2020, when do we expect the warranty to expire") input',
run: 'text 01/06/2021 00:00:01'
}, { // Question: What day to you think is best for us to start having an annual sale (not rated)?
trigger: 'div.js_question-wrapper:contains("What day to you think is best for us to start having an annual sale (not rated)") input',
}, { // Question: What day and time do you think most customers are most likely to call customer service (not rated)?
trigger: 'div.js_question-wrapper:contains("What day and time do you think most customers are most likely to call customer service (not rated)") input',
}, { // Question: How many chairs do you think we should aim to sell in a year (not rated)?
content: "Inputting answer '0'",
trigger: 'div.js_question-wrapper:contains("How many chairs do you think we should aim to sell in a year (not rated)") input',
run: 'text 0'
}, {
content: "Finish Survey",
trigger: 'button[type="submit"]',
}];
const patchSteps = [
{
content: "Patching Survey Form Interaction",
trigger: "body",
run: function () {
patchSurveyForm();
},
},
];
var retrySteps = [{
trigger: 'a:contains("Retry")'
}];
const failSteps = [
{
// Page-1
content: "Clicking on Start Certification",
trigger: 'button.btn.btn-primary.btn-lg:contains("Start Certification")',
run: "click",
},
{
// Question: Do we sell Acoustic Bloc Screens?
content: "Selecting answer 'No'",
trigger:
'div.js_question-wrapper:contains("Do we sell Acoustic Bloc Screens") label:contains("No")',
run: "click",
},
{
// Question: Select all the existing products
content: "Ticking answer 'Fanta'",
trigger:
'div.js_question-wrapper:contains("Select all the existing products") label:contains("Fanta")',
run: "click",
},
{
content: "Ticking answer 'Drawer'",
trigger:
'div.js_question-wrapper:contains("Select all the existing products") label:contains("Drawer")',
run: "click",
},
{
content: "Ticking answer 'Conference chair'",
trigger:
'div.js_question-wrapper:contains("Select all the existing products") label:contains("Conference chair")',
run: "click",
},
{
// Question: Select all the available customizations for our Customizable Desk
content: "Ticking answer 'Color'",
trigger:
'div.js_question-wrapper:contains("Select all the available customizations for our Customizable Desk") label:contains("Color")',
run: "click",
},
{
content: "Ticking answer 'Height'",
trigger:
'div.js_question-wrapper:contains("Select all the available customizations for our Customizable Desk") label:contains("Height")',
run: "click",
},
{
// Question: How many versions of the Corner Desk do we have?
content: "Selecting answer '2'",
trigger:
'div.js_question-wrapper:contains("How many versions of the Corner Desk do we have") label:contains("2")',
run: "click",
},
{
// Question: Do you think we have missing products in our catalog? (not rated)
content: "Missing products",
trigger:
'div.js_question-wrapper:contains("Do you think we have missing products in our catalog") textarea',
run: "edit I don't know products enough to be able to answer that",
},
{
// Page-2 Question: How much do we sell our Cable Management Box?
content: "Selecting answer '$80'",
trigger:
'div.js_question-wrapper:contains("How much do we sell our Cable Management Box") label:contains("$80")',
run: "click",
},
{
// Question: Select all the products that sell for $100 or more
content: "Ticking answer 'Corner Desk Right Sit'",
trigger:
'div.js_question-wrapper:contains("Select all the products that sell for $100 or more") label:contains("Corner Desk Right Sit")',
run: "click",
},
{
content: "Ticking answer 'Desk Combination'",
trigger:
'div.js_question-wrapper:contains("Select all the products that sell for $100 or more") label:contains("Desk Combination")',
run: "click",
},
{
content: "Ticking answer 'Office Chair Black'",
trigger:
'div.js_question-wrapper:contains("Select all the products that sell for $100 or more") label:contains("Office Chair Black")',
run: "click",
},
{
// Question: What do you think about our prices (not rated)?
trigger:
'div.js_question-wrapper:contains("What do you think about our prices") label:contains("Correctly priced")',
run: "click",
},
{
// Page-3 Question: How many days is our money-back guarantee?
content: "Inputting answer '60'",
trigger:
'div.js_question-wrapper:contains("How many days is our money-back guarantee") input',
run: "edit 60",
},
{
// Question: If a customer purchases a product on 6 January 2020, what is the latest day we expect to ship it?
content: "Inputting answer '01/06/2020'",
trigger:
'div.js_question-wrapper:contains("If a customer purchases a product on 6 January 2020, what is the latest day we expect to ship it") input',
run: "edit 01/06/2020",
},
{
// Question: If a customer purchases a 1 year warranty on 6 January 2020, when do we expect the warranty to expire?
content: "Inputting answer '01/06/2021 00:00:01'",
trigger:
'div.js_question-wrapper:contains("If a customer purchases a 1 year warranty on 6 January 2020, when do we expect the warranty to expire") input',
run: "edit 01/06/2021 00:00:01",
},
{
// Question: What day to you think is best for us to start having an annual sale (not rated)?
trigger:
'div.js_question-wrapper:contains("What day to you think is best for us to start having an annual sale (not rated)") input',
run: "edit Test",
},
{
// Question: What day and time do you think most customers are most likely to call customer service (not rated)?
trigger:
'div.js_question-wrapper:contains("What day and time do you think most customers are most likely to call customer service (not rated)") input',
run: "edit Test",
},
{
// Question: How many chairs do you think we should aim to sell in a year (not rated)?
content: "Inputting answer '0'",
trigger:
'div.js_question-wrapper:contains("How many chairs do you think we should aim to sell in a year (not rated)") input',
run: "edit 0",
},
{
content: "Finish Survey",
trigger: 'button[type="submit"]',
run: "click",
},
{
content: "Click on Submit",
trigger: 'button.btn-primary:contains("Submit")',
run: "click",
},
];
const retrySteps = [
{
trigger: 'a:contains("Retry")',
run: "click",
expectUnloadPage: true,
},
];
var lastSteps = [{
trigger: 'h1:contains("Thank you!")',
run: function () {
if ($('a:contains("Retry")').length === 0) {
$('h1:contains("Thank you!")').addClass('tour_success');
}
}
trigger: 'h1:contains("You scored")',
}, {
trigger: 'h1.tour_success',
trigger: 'body:not(:has(a:contains("Retry")))',
}];
tour.register('test_certification_failure', {
test: true,
url: '/survey/start/4ead4bc8-b8f2-4760-a682-1fde8daaaaac'
}, [].concat(failSteps, retrySteps, failSteps, lastSteps));
registry.category("web_tour.tours").add("test_certification_failure", {
url: "/survey/start/4ead4bc8-b8f2-4760-a682-1fde8daaaaac",
steps: () => [].concat(patchSteps, failSteps, retrySteps, failSteps, lastSteps),
});

View file

@ -1,100 +1,180 @@
odoo.define('survey.tour_test_certification_success', function (require) {
'use strict';
import { registry } from "@web/core/registry";
import { patch } from "@web/core/utils/patch";
var SurveyFormWidget = require('survey.form');
/**
* Speed up fade-in fade-out to avoid useless delay in tests.
*/
SurveyFormWidget.include({
_submitForm: function () {
this.fadeInOutDelay = 0;
return this._super.apply(this, arguments);
}
});
var tour = require('web_tour.tour');
tour.register('test_certification_success', {
test: true,
url: '/survey/start/4ead4bc8-b8f2-4760-a682-1fde8daaaaac'
},
[{ // Page-1
content: "Clicking on Start Certification",
trigger: 'button.btn.btn-primary.btn-lg:contains("Start Certification")',
}, { // Question: Do we sell Acoustic Bloc Screens?
content: "Selecting answer 'Yes'",
trigger: 'div.js_question-wrapper:contains("Do we sell Acoustic Bloc Screens") label:contains("Yes")',
}, { // Question: Select all the existing products
content: "Ticking answer 'Chair floor protection'",
trigger: 'div.js_question-wrapper:contains("Select all the existing products") label:contains("Chair floor protection")'
}, {
content: "Ticking answer 'Drawer'",
trigger: 'div.js_question-wrapper:contains("Select all the existing products") label:contains("Drawer")'
}, {
content: "Ticking answer 'Conference chair'",
trigger: 'div.js_question-wrapper:contains("Select all the existing products") label:contains("Conference chair")'
}, { // Question: Select all the available customizations for our Customizable Desk
content: "Ticking answer 'Color'",
trigger: 'div.js_question-wrapper:contains("Select all the available customizations for our Customizable Desk") label:contains("Color")'
}, {
content: "Ticking answer 'Legs'",
trigger: 'div.js_question-wrapper:contains("Select all the available customizations for our Customizable Desk") label:contains("Legs")'
}, { // Question: How many versions of the Corner Desk do we have?
content: "Selecting answer '2'",
trigger: 'div.js_question-wrapper:contains("How many versions of the Corner Desk do we have") label:contains("2")',
}, { // Question: Do you think we have missing products in our catalog? (not rated)
content: "Missing products",
trigger: 'div.js_question-wrapper:contains("Do you think we have missing products in our catalog") textarea',
run: "text I think we should make more versions of the customizable desk, it's such an amazing product!",
}, { // Page-2 Question: How much do we sell our Cable Management Box?
content: "Selecting answer '$80' (wrong one)",
trigger: 'div.js_question-wrapper:contains("How much do we sell our Cable Management Box") label:contains("$80")',
}, { // Question: Select all the products that sell for $100 or more
content: "Ticking answer 'Corner Desk Right Sit'",
trigger: 'div.js_question-wrapper:contains("Select all the products that sell for $100 or more") label:contains("Corner Desk Right Sit")'
}, {
content: "Ticking answer 'Desk Combination'",
trigger: 'div.js_question-wrapper:contains("Select all the products that sell for $100 or more") label:contains("Desk Combination")'
}, {
content: "Ticking answer 'Large Desk'",
trigger: 'div.js_question-wrapper:contains("Select all the products that sell for $100 or more") label:contains("Large Desk")'
}, { // Question: What do you think about our prices (not rated)?
content: "Selecting answer 'Underpriced'",
trigger: 'div.js_question-wrapper:contains("What do you think about our prices") label:contains("Underpriced")',
}, { // Page-3 Question: How many days is our money-back guarantee?
content: "Inputting answer '30'",
trigger: 'div.js_question-wrapper:contains("How many days is our money-back guarantee") input',
run: 'text 30'
}, { // Question: If a customer purchases a product on 6 January 2020, what is the latest day we expect to ship it?
content: "Inputting answer '01/08/2020'",
trigger: 'div.js_question-wrapper:contains("If a customer purchases a product on 6 January 2020, what is the latest day we expect to ship it") input',
run: 'text 01/08/2020'
}, { // Question: If a customer purchases a 1 year warranty on 6 January 2020, when do we expect the warranty to expire?
content: "Inputting answer '01/07/2021 00:00:01'",
trigger: 'div.js_question-wrapper:contains("If a customer purchases a 1 year warranty on 6 January 2020, when do we expect the warranty to expire") input',
run: 'text 01/07/2021 00:00:01'
}, { // Question: What day to you think is best for us to start having an annual sale (not rated)?
content: "Inputting answer '01/01/2021'",
trigger: 'div.js_question-wrapper:contains("What day to you think is best for us to start having an annual sale (not rated)") input',
run: 'text 01/01/2021'
}, { // Question: What day and time do you think most customers are most likely to call customer service (not rated)?
content: "Inputting answer '01/01/2021 13:00:01'",
trigger: 'div.js_question-wrapper:contains("What day and time do you think most customers are most likely to call customer service (not rated)") input',
run: 'text 01/01/2021 13:00:01'
}, { // Question: How many chairs do you think we should aim to sell in a year (not rated)?
content: "Inputting answer '1000'",
trigger: 'div.js_question-wrapper:contains("How many chairs do you think we should aim to sell in a year (not rated)") input',
run: 'text 1000'
}, {
content: "Finish Survey",
trigger: 'button[type="submit"]',
}, {
content: "Thank you",
trigger: 'h1:contains("Thank you!")',
}, {
content: "test passed",
trigger: 'div:contains("Congratulations, you have passed the test!")',
}
]);
function patchSurveyForm() {
const SurveyForm = odoo.loader.modules.get("@survey/interactions/survey_form").SurveyForm;
patch(SurveyForm.prototype, {
submitForm() {
this.fadeInOutDelay = 0;
return super.submitForm(...arguments);
},
});
}
registry.category("web_tour.tours").add("test_certification_success", {
url: "/survey/start/4ead4bc8-b8f2-4760-a682-1fde8daaaaac",
steps: () => [
{
content: "Patching Survey Form Interaction",
trigger: "body",
run: function () {
patchSurveyForm();
},
},
{
// Page-1
content: "Clicking on Start Certification",
trigger: 'button.btn.btn-primary.btn-lg:contains("Start Certification")',
run: "click",
},
{
// Question: Do we sell Acoustic Bloc Screens?
content: "Selecting answer 'Yes'",
trigger:
'div.js_question-wrapper:contains("Do we sell Acoustic Bloc Screens") label:contains("Yes")',
run: "click",
},
{
// Question: Select all the existing products
content: "Ticking answer 'Chair floor protection'",
trigger:
'div.js_question-wrapper:contains("Select all the existing products") label:contains("Chair floor protection")',
run: "click",
},
{
content: "Ticking answer 'Drawer'",
trigger:
'div.js_question-wrapper:contains("Select all the existing products") label:contains("Drawer")',
run: "click",
},
{
content: "Ticking answer 'Conference chair'",
trigger:
'div.js_question-wrapper:contains("Select all the existing products") label:contains("Conference chair")',
run: "click",
},
{
// Question: Select all the available customizations for our Customizable Desk
content: "Ticking answer 'Color'",
trigger:
'div.js_question-wrapper:contains("Select all the available customizations for our Customizable Desk") label:contains("Color")',
run: "click",
},
{
content: "Ticking answer 'Legs'",
trigger:
'div.js_question-wrapper:contains("Select all the available customizations for our Customizable Desk") label:contains("Legs")',
run: "click",
},
{
// Question: How many versions of the Corner Desk do we have?
content: "Selecting answer '2'",
trigger:
'div.js_question-wrapper:contains("How many versions of the Corner Desk do we have") label:contains("2")',
run: "click",
},
{
// Question: Do you think we have missing products in our catalog? (not rated)
content: "Missing products",
trigger:
'div.js_question-wrapper:contains("Do you think we have missing products in our catalog") textarea',
run: "edit I think we should make more versions of the customizable desk, it's such an amazing product!",
},
{
// Page-2 Question: How much do we sell our Cable Management Box?
content: "Selecting answer '$80' (wrong one)",
trigger:
'div.js_question-wrapper:contains("How much do we sell our Cable Management Box") label:contains("$80")',
run: "click",
},
{
// Question: Select all the products that sell for $100 or more
content: "Ticking answer 'Corner Desk Right Sit'",
trigger:
'div.js_question-wrapper:contains("Select all the products that sell for $100 or more") label:contains("Corner Desk Right Sit")',
run: "click",
},
{
content: "Ticking answer 'Desk Combination'",
trigger:
'div.js_question-wrapper:contains("Select all the products that sell for $100 or more") label:contains("Desk Combination")',
run: "click",
},
{
content: "Ticking answer 'Large Desk'",
trigger:
'div.js_question-wrapper:contains("Select all the products that sell for $100 or more") label:contains("Large Desk")',
run: "click",
},
{
// Question: What do you think about our prices (not rated)?
content: "Selecting answer 'Underpriced'",
trigger:
'div.js_question-wrapper:contains("What do you think about our prices") label:contains("Underpriced")',
run: "click",
},
{
// Page-3 Question: How many days is our money-back guarantee?
content: "Inputting answer '30'",
trigger:
'div.js_question-wrapper:contains("How many days is our money-back guarantee") input',
run: "edit 30",
},
{
// Question: If a customer purchases a product on 6 January 2020, what is the latest day we expect to ship it?
content: "Inputting answer '01/08/2020'",
trigger:
'div.js_question-wrapper:contains("If a customer purchases a product on 6 January 2020, what is the latest day we expect to ship it") input',
run: "edit 01/08/2020",
},
{
// Question: If a customer purchases a 1 year warranty on 6 January 2020, when do we expect the warranty to expire?
content: "Inputting answer '01/07/2021 00:00:01'",
trigger:
'div.js_question-wrapper:contains("If a customer purchases a 1 year warranty on 6 January 2020, when do we expect the warranty to expire") input',
run: "edit 01/07/2021 00:00:01",
},
{
// Question: What day to you think is best for us to start having an annual sale (not rated)?
content: "Inputting answer '01/01/2021'",
trigger:
'div.js_question-wrapper:contains("What day to you think is best for us to start having an annual sale (not rated)") input',
run: "edit 01/01/2021",
},
{
// Question: What day and time do you think most customers are most likely to call customer service (not rated)?
content: "Inputting answer '01/01/2021 13:00:01'",
trigger:
'div.js_question-wrapper:contains("What day and time do you think most customers are most likely to call customer service (not rated)") input',
run: "edit 01/01/2021 13:00:01",
},
{
// Question: How many chairs do you think we should aim to sell in a year (not rated)?
content: "Inputting answer '1000'",
trigger:
'div.js_question-wrapper:contains("How many chairs do you think we should aim to sell in a year (not rated)") input',
run: "edit 1000",
},
{
content: "Finish Survey",
trigger: 'button[type="submit"]',
run: "click",
},
{
content: "Click on Submit",
trigger: 'button.btn-primary:contains("Submit")',
run: "click",
},
{
content: "You scored",
trigger: 'h1:contains("You scored")',
},
{
content: "test passed",
trigger: 'div:contains("Congratulations, you have passed the test!")',
},
],
});

View file

@ -1,70 +1,138 @@
odoo.define('survey.tour_test_survey', function (require) {
'use strict';
import { registry } from "@web/core/registry";
var tour = require('web_tour.tour');
tour.register('test_survey', {
test: true,
url: '/survey/start/b137640d-14d4-4748-9ef6-344caaaaaae',
}, [
const survey_steps = (checkPageTranslation) => [
// Page-1
{
content: 'Click on Start',
trigger: 'button.btn:contains("Start")',
}, {
run: "click",
}, ...(checkPageTranslation ? checkPageTranslation : []), {
content: 'Answer Where do you live',
trigger: 'div.js_question-wrapper:contains("Where do you live") input',
run: 'text Mordor-les-bains',
run: "edit Mordor-les-bains",
}, {
content: 'Answer Where do you live',
trigger: 'div.js_question-wrapper:contains("When is your date of birth") input',
run: 'text 05/05/1980',
run: "edit 05/05/1980",
}, {
content: 'Answer How frequently do you buy products online',
trigger: 'div.js_question-wrapper:contains("How frequently do you buy products online") label:contains("Once a month")',
run: "click",
}, {
content: 'Answer How many times did you order products on our website',
trigger: 'div.js_question-wrapper:contains("How many times did you order products on our website") input',
run: 'text 12',
run: "edit 12",
}, {
content: 'Submit and go to Next Page',
trigger: 'button[value="next"]',
run: "click",
},
// Page-2
...(checkPageTranslation ? checkPageTranslation : []),
{
content: 'Answer Which of the following words would you use to describe our products (High Quality)',
trigger: 'div.js_question-wrapper:contains("Which of the following words would you use to describe our products") label:contains("High quality")',
run: "click",
}, {
content: 'Answer Which of the following words would you use to describe our products (Good value for money)',
trigger: 'div.js_question-wrapper:contains("Which of the following words would you use to describe our products") label:contains("Good value for money")',
run: "click",
}, {
content: 'Answer What do your think about our new eCommerce (The new layout and design is fresh and up-to-date)',
trigger: 'div.js_question-wrapper:contains("What do your think about our new eCommerce") tr:contains("The new layout and design is fresh and up-to-date") td:first',
run: "click",
}, {
content: 'Answer What do your think about our new eCommerce (It is easy to find the product that I want)',
trigger: 'div.js_question-wrapper:contains("What do your think about our new eCommerce") tr:contains("It is easy to find the product that I want") td:eq(2)',
run: "click",
}, {
content: 'Answer What do your think about our new eCommerce (The tool to compare the products is useful to make a choice)',
trigger: 'div.js_question-wrapper:contains("What do your think about our new eCommerce") tr:contains("The tool to compare the products is useful to make a choice") td:eq(3)',
run: "click",
}, {
content: 'Answer What do your think about our new eCommerce (The checkout process is clear and secure)',
trigger: 'div.js_question-wrapper:contains("What do your think about our new eCommerce") tr:contains("The checkout process is clear and secure") td:eq(2)',
run: "click",
}, {
content: 'Answer What do your think about our new eCommerce (I have added products to my wishlist)',
trigger: 'div.js_question-wrapper:contains("What do your think about our new eCommerce") tr:contains("I have added products to my wishlist") td:last',
run: "click",
}, {
content: 'Answer Do you have any other comments, questions, or concerns',
trigger: 'div.js_question-wrapper:contains("Do you have any other comments, questions, or concerns") textarea',
run: 'text This is great. Really.',
run: "edit This is great. Really.",
}, {
content: 'Answer How would you rate your experience on our website?',
trigger: 'div.js_question-wrapper:contains("How would you rate your experience on our website") label:contains("4")',
run: "click",
}, {
content: 'Click Submit and finish the survey',
trigger: 'button[value="finish"]',
run: "click",
}, {
content: "Click on Submit",
trigger: ".modal-footer button.btn-primary",
run: "click",
},
// Final page
{
content: 'Thank you',
trigger: 'h1:contains("Thank you!")',
}
]);
];
registry.category("web_tour.tours").add("test_survey", {
url: "/survey/start/b137640d-14d4-4748-9ef6-344caaaaaae",
steps: () => [
{
content: "Check that the language selector is hidden",
trigger: "select[name='lang_code'].d-none:not(:visible)",
},
...survey_steps(),
],
});
registry.category("web_tour.tours").add("test_survey_multilang", {
url: "/survey/start/b137640d-14d4-4748-9ef6-344caaaaaae",
steps: () => {
return [
{
content: "Select French",
trigger: "select[name='lang_code']",
run() {
const langSelect = document.querySelector("select[name='lang_code']");
if (Array.from(langSelect.classList).includes("d-none")) {
throw new Error("The language selector must not be hidden.");
}
langSelect.value = "fr_BE";
langSelect.dispatchEvent(new Event("change", { bubbles: true }));
},
expectUnloadPage: true,
},
{
content: "Check French translation",
trigger: "h1.o_survey_main_title:contains('Enquête de satisfaction')",
},
{
content: "Select French",
trigger: "select[name='lang_code']",
run() {
const langSelect = document.querySelector("select[name='lang_code']");
langSelect.value = "fr_BE";
langSelect.dispatchEvent(new Event("change", { bubbles: true }));
},
expectUnloadPage: true,
},
{
content: "Check French translation",
trigger: "h1.o_survey_main_title:contains('Enquête de satisfaction')",
},
...survey_steps([
{
content: "Check Page translation",
trigger: ".js_question-wrapper h3:contains('FR: ')",
},
]),
];
},
});

View file

@ -1,60 +1,90 @@
odoo.define('survey.tour_test_survey_chained_conditional_questions', function (require) {
'use strict';
import { registry } from "@web/core/registry";
const tour = require('web_tour.tour');
tour.register('test_survey_chained_conditional_questions', {
test: true,
registry.category("web_tour.tours").add('test_survey_chained_conditional_questions', {
url: '/survey/start/3cfadce3-3f7e-41da-920d-10fa0eb19527',
}, [
steps: () => [
{
content: 'Click on Start',
trigger: 'button.btn:contains("Start")',
}, {
content: 'Answer Q1 with Answer 2',
trigger: 'div.js_question-wrapper:contains("Q1") label:contains("Answer 2")',
}, {
content: 'Check that Q4 and Q5 are visible',
trigger: 'div.js_question-wrapper:contains(Q4)',
extra_trigger: 'div.js_question-wrapper:contains(Q5)',
run: () => {
const selector = 'div.js_question-wrapper.d-none';
if (document.querySelectorAll(selector).length !== 2) {
throw new Error('Q2 and Q3 should be hidden.');
}
},
run: "click",
}, {
content: 'Answer Q1 with Answer 1',
trigger: 'div.js_question-wrapper:contains("Q1") label:contains("Answer 1")',
}, {
run: "click",
},
{
trigger: 'div.js_question-wrapper:contains("Q4")',
},
{
content: 'Answer Q2 with Answer 1',
trigger: 'div.js_question-wrapper:contains("Q2") label:contains("Answer 1")',
run: function (actions) {
const selector = 'div.js_question-wrapper.d-none';
if (document.querySelectorAll(selector).length !== 3) {
throw new Error('Q3, Q4 and Q5 should be hidden.');
}
// Select Answer 1, in order to trigger the display of Q3.
actions.click(this.$anchor);
}
run: "click",
}, {
content: 'Answer Q3 with Answer 1',
trigger: 'div.js_question-wrapper:contains("Q3") label:contains("Answer 1")',
run: "click",
}, {
content: 'Answer Q1 with Answer 3', // This should hide all remaining questions.
content: 'Answer Q1 with Answer 3', // This should hide Q2 and Q4 but not Q3.
trigger: 'div.js_question-wrapper:contains("Q1") label:contains("Answer 3")',
run: "click",
}, {
content: 'Check that Q2 was hidden',
trigger: 'div.js_question-wrapper:contains("Q3")',
run : () => {
expectHiddenQuestion("Q2");
expectHiddenQuestion("Q4");
},
}, {
content: 'Answer Q3 with Answer 2',
trigger: 'div.js_question-wrapper:contains("Q3") label:contains("Answer 2")',
run: "click",
}, {
content: 'Answer Q1 with Answer 2', // This should hide all other questions.
trigger: 'div.js_question-wrapper:contains("Q1") label:contains("Answer 2")',
run: "click",
}, {
content: 'Check that only question 1 is now visible',
trigger: 'div.js_question-wrapper:contains("Q1")',
run: () => {
const selector = 'div.js_question-wrapper.d-none';
if (document.querySelectorAll(selector).length !== 4) {
throw new Error('Q2, Q3, Q4 and Q5 should have been hidden.');
}
}
run : () => {
expectHiddenQuestion("Q2", "Q2's trigger is gone.");
expectHiddenQuestion("Q3", "No reason to show it now.");
expectHiddenQuestion("Q4", "No reason to show it now.");
},
}, {
content: 'Answer Q1 with Answer 3', // This shows Q3.
trigger: 'div.js_question-wrapper:contains("Q1") label:contains("Answer 3")',
run: "click",
}, {
content: 'Check that questions Q2 and Q4 are hidden',
trigger: 'div.js_question-wrapper:contains("Q1")',
run : () => {
expectHiddenQuestion("Q2", "Q2 should stay hidden.");
expectHiddenQuestion("Q4", "Q4 should stay hidden.");
},
}, {
content: 'Answer Q3 with Answer 2',
trigger: 'div.js_question-wrapper:contains("Q3") label:contains("Answer 2")',
run: "click",
}, {
content: 'Answer Q1 with Answer 2',
trigger: 'div.js_question-wrapper:contains("Q1") label:contains("Answer 2")',
run: "click",
}, {
content: 'Check that only question 1 is now the only one visible again',
trigger: 'div.js_question-wrapper:contains("Q1")',
run : () => {
expectHiddenQuestion("Q2", "Q2's trigger is gone, again.");
expectHiddenQuestion("Q3", "As Q2's gone, so should this one.");
expectHiddenQuestion("Q4", "No reason to show it now.");
},
}, {
content: 'Click Submit and finish the survey',
trigger: 'button[value="finish"]',
run: "click",
}, {
content: "Click on Submit",
trigger: 'button.btn-primary:contains("Submit")',
run: "click",
},
// Final page
{
@ -62,6 +92,12 @@ tour.register('test_survey_chained_conditional_questions', {
trigger: 'h1:contains("Thank you!")',
}
]);
]});
});
export function expectHiddenQuestion(questionTitle, msg) {
const divs = document.querySelectorAll("div.js_question-wrapper.d-none");
const matchingDivs = Array.from(divs).filter((div) => div.textContent.includes(questionTitle));
if (matchingDivs.length !== 1) {
console.error(msg);
}
}

View file

@ -0,0 +1,54 @@
import { registry } from "@web/core/registry";
import { expectHiddenQuestion } from "@survey/../tests/tours/survey_chained_conditional_questions";
registry.category("web_tour.tours").add('test_survey_conditional_question_on_different_page', {
url: '/survey/start/1cb935bd-2399-4ed1-9e10-c649318fb4dc',
steps: () => [
{
content: 'Click on Start',
trigger: 'button.btn:contains("Start")',
run: "click",
}, {
content: 'Answer Q1 with Answer 1',
trigger: 'div.js_question-wrapper:contains("Q1") label:contains("Answer 1")',
run: "click",
}, {
content: 'Go to next page',
trigger: 'button[value="next"]',
run: "click",
}, {
content: 'Check that Q3 is visible',
trigger: 'div.js_question-wrapper:contains("Q3")',
}, {
content: 'Answer Q2 with Answer 2',
trigger: 'div.js_question-wrapper:contains("Q2") label:contains("Answer 2")',
run: "click",
}, {
content: 'Check that Q3 is still visible',
trigger: 'div.js_question-wrapper:contains("Q3")',
}, {
content: 'Go back',
trigger: 'button[value="previous"]',
run: "click",
}, {
content: 'Answer Q1 with Answer 2',
trigger: 'div.js_question-wrapper:contains("Q1") label:contains("Answer 2")',
run: "click",
}, {
content: 'Go to next page',
trigger: 'button[value="next"]',
run: "click",
}, {
content: 'Check that Q3 is hidden',
trigger: 'div.js_question-wrapper:contains("Q2")',
run : () => expectHiddenQuestion("Q3", "Q3 should be hidden as q1_a1 trigger is not selected anymore"),
}, {
content: 'Answer Q2 with Answer 1',
trigger: 'div.js_question-wrapper:contains("Q2") label:contains("Answer 1")',
run: "click",
}, {
content: 'Check that Q3 is now visible again',
trigger: 'div.js_question-wrapper:contains("Q3")',
}
],
});

View file

@ -0,0 +1,289 @@
import { registry } from "@web/core/registry";
import { stepUtils } from "@web_tour/tour_utils";
registry.category("web_tour.tours").add('survey_tour_test_survey_form_triggers', {
url: '/odoo',
steps: () => [
stepUtils.showAppsMenuItem(),
{
content: 'Go to Survey',
trigger: '.o_app[data-menu-xmlid="survey.menu_surveys"]',
run: "click",
}, {
content: "Create a new survey",
trigger: ".o-kanban-button-new",
run: "click",
}, {
content: "Set the Survey's title",
trigger: ".o_field_widget[name=title] textarea",
run: "edit Test survey",
}, {
content: "Add a first question",
trigger: "td.o_field_x2many_list_row_add a",
run: "click",
}, {
content: "Set the first question's title",
trigger: ".modal .modal-content .o_field_widget[name=title] input",
run: "edit Question 1",
},
...addTwoAnswers(),
...saveAndNew(),
{
content: "Set the second question's title",
trigger: ".modal .o_field_widget[name=title] input",
run: "edit Question 2",
},
...addTwoAnswers(),
...changeTab("options"),
{
content: "Set a trigger for the first question",
trigger: ".modal .o_field_widget[name=triggering_answer_ids] input",
run: "click",
}, {
content: "Set the first question's first answer as trigger",
trigger: ".modal ul.ui-autocomplete a:contains(Question 1 : Answer A)",
run: 'click',
},
...changeTab("answers"),
...saveAndNew(),
{
content: "Set the third question's title",
trigger: ".modal .o_field_widget[name=title] input",
run: "edit Question 3",
},
...addTwoAnswers(),
...changeTab("options"),
{
content: "Set a trigger for the second question",
trigger: ".modal .o_field_widget[name=triggering_answer_ids] input",
run: "click",
}, {
content: "Set the second question's second answer as trigger",
trigger: ".modal ul.ui-autocomplete a:contains(Question 2 : Answer B)",
run: 'click',
},
{
trigger: ".modal button:contains(save & close)",
run: "click",
},
{
trigger: "body:not(:has(.modal))",
},
{
content: "Check that Question 2 has 'normal' trigger icon",
trigger: "tr:contains('Question 2') button i.fa-code-fork",
}, {
content: "Check that Question 3 has 'normal' trigger icon",
trigger: "tr:contains('Question 3') button i.fa-code-fork",
}, {
content: "Move Question 3 above its trigger (Question 2)",
trigger: "div[name=question_and_page_ids] table tr:eq(3) div[name=sequence]",
run: "drag_and_drop(div[name=question_and_page_ids] table tr:eq(2))",
}, {
content: "Check that Question 3 has 'warning' trigger icon",
trigger: "tr:contains('Question 3') button i.fa-exclamation-triangle",
}, {
content: "Open that question to check the server's misplacement evaluation agrees",
trigger: "tr.o_data_row td:contains('Question 3')",
run: "click",
}, {
content: "Check that an alert is shown",
trigger: ".modal .o_form_sheet_bg div:first-child.alert-warning:contains('positioned before some or all of its triggers')",
},
...changeTab("options"),
{
content: "Remove invalid trigger",
trigger: ".modal .o_field_widget[name=triggering_answer_ids] span:contains('Question 2') a.o_delete",
run: "click",
}, {
content: "Check that the alert is gone",
trigger: `.modal .o_form_sheet_bg div:first-child:not(.alert-warning).o_form_sheet`,
}, {
content: "Choose a new valid trigger",
trigger: ".modal .o_field_widget[name=triggering_answer_ids] input",
run: "click",
}, {
content: "Set the first question's second answer as trigger, then",
trigger: 'ul.ui-autocomplete a:contains("Question 1 : Answer B")',
run: 'click',
},
{
content: "Save the question (1)",
trigger: ".modal button:contains(save)",
run: "click",
},
{
trigger: "body:not(:has(.modal))",
},
{
content: "Check that Question 3 has its 'normal' trigger icon back",
trigger: "tr:contains('Question 3') button i.fa-code-fork",
}, {
content: "Move Question 3 back below Question 2",
trigger: "div[name=question_and_page_ids] table tr:eq(2) div[name=sequence]",
run: "drag_and_drop(div[name=question_and_page_ids] table tr:eq(4))",
}, {
content: "Open that question again",
trigger: "tr.o_data_row td:contains('Question 3')",
run: "click",
},
...changeTab("options"),
{
trigger: ".modal .modal-content .o_field_widget[name=triggering_answer_ids] input",
run() {
this.anchor.scrollIntoView(true);
}
},
{
content: "Add a second trigger to confirm we can now use Question 2 again",
trigger: ".modal .modal-content .o_field_widget[name=triggering_answer_ids] input",
run: "click",
}, {
content: "Add the second question's second answer as trigger, then",
trigger: '.modal-content ul.ui-autocomplete a:contains("Question 2 : Answer B")',
run: "click",
},
{
content: "Save the question (2)",
trigger: ".modal button:contains(save)",
run: "click",
},
{
trigger: "body:not(:has(.modal))",
},
// Move question 1 below question 3,
{
content: "Move Question 1 back below Question 3",
trigger: "div[name=question_and_page_ids] table tr:eq(1) div[name=sequence]",
run: "drag_and_drop(div[name=question_and_page_ids] table tr:eq(4))",
}, {
content: "Check that Question 3 has 'warning' trigger icon",
trigger: "tr:contains('Question 3') button i.fa-exclamation-triangle",
}, {
content: "Open that question again",
trigger: "tr.o_data_row td:contains('Question 3')",
run: "click",
}, {
content: "Check that an alert is shown also when only one trigger is misplaced",
trigger: ".modal .o_form_sheet_bg div:first-child.alert-warning:contains('positioned before some or all of its triggers')",
},
...changeTab("options"),
{
content: "Remove temporarily used trigger",
trigger: ".modal .o_field_widget[name=triggering_answer_ids] span:contains('Question 1') a.o_delete",
run: "click",
}, {
content: "Check that the alert is gone in this case too",
trigger: `.modal .o_form_sheet_bg div:first-child:not(.alert-warning).o_form_sheet`,
},
{
content: "Save the question (3)",
trigger: ".modal button:contains(save)",
run: "click",
},
{
trigger: "body:not(:has(.modal))",
},
{
content: "Check that Question 3 has its 'normal' trigger icon back",
trigger: "tr:contains('Question 3') button i.fa-code-fork",
}, {
content: "Move Question 1 back above Question 2",
trigger: "div[name=question_and_page_ids] table tr:eq(3) div[name=sequence]",
run: "drag_and_drop(div[name=question_and_page_ids] table tr:eq(1))",
},
// Deleting trigger answers or whole question gracefully remove the trigger automatically
{
content: "Open Question 2 again",
trigger: "tr.o_data_row td:contains('Question 2')",
run: "click",
}, {
content: "Delete Answer B",
trigger: "div[name=suggested_answer_ids] tr:contains('Answer B') button[name=delete]",
run: "click",
},
{
content: "Save the question (4)",
trigger: ".modal button:contains(save)",
run: "click",
},
{
trigger: "body:not(:has(.modal))",
},
{
content: "Check that Question 3 no longer has a trigger icon",
trigger: "div[name=question_and_page_ids] tr:contains('Question 3') div.o_widget_survey_question_trigger:not(:has(button)):not(:visible)",
}, {
content: "Check that Question 2 however still has a trigger icon",
trigger: "tr:contains('Question 2') button i.fa-code-fork",
}, {
content: "Delete Question 1",
trigger: "tr:contains('Question 1') button[name=delete]",
run: "click",
}, {
content: "Check that now Question 2 too does no longer have a trigger icon",
trigger: "tr:contains('Question 2') div.o_widget_survey_question_trigger:not(:has(button)):not(:visible)",
}, {
content: 'Go back to Kanban View',
trigger: '[data-menu-xmlid="survey.menu_survey_form"]',
run: "click",
}, {
content: "Check that we arrived on the kanban view",
trigger: ".o-kanban-button-new",
}
]});
function addTwoAnswers() {
return [
{
content: "Add the first answer",
trigger:
".modal div[name=suggested_answer_ids] .o_field_x2many_list_row_add a",
run: "click",
},
{
trigger: ".modal tr.o_selected_row div[name=value] input",
run: "edit Answer A",
},
{
content: "Add the second answer",
trigger:
".modal div[name=suggested_answer_ids] .o_field_x2many_list_row_add a",
run: "click",
},
{
trigger:
".modal tr:nth-child(2).o_selected_row div[name=value] input",
run: "edit Answer B",
},
];
}
function saveAndNew() {
return [
{
content: "Click Save & New",
trigger: ".modal button.o_form_button_save_new",
run: "click",
},
{
content: "Wait for the dialog to render new question form",
trigger:
".modal div[name=suggested_answer_ids] .o_list_table tbody tr:first-child:not(.o_data_row)", // empty answers list
},
];
}
function changeTab(tabName) {
return [
{
content: `Go to ${tabName} tab`,
trigger: `.modal .modal-content a[name=${tabName}].nav-link`,
run: "click",
},
{
content: `Wait for tab ${tabName} tab`,
trigger: `.modal .modal-content a[name=${tabName}].nav-link.active`,
},
];
}

View file

@ -1,155 +1,128 @@
odoo.define('survey.tour_test_survey_prefill', function (require) {
'use strict';
import { registry } from "@web/core/registry";
var tour = require('web_tour.tour');
tour.register('test_survey_prefill', {
test: true,
url: '/survey/start/b137640d-14d4-4748-9ef6-344caaaaaae'
},
[{ // Page-1
registry.category("web_tour.tours").add('test_survey_prefill', {
url: '/survey/start/b137640d-14d4-4748-9ef6-344caaaaaae',
steps: () => [{ // Page-1
trigger: 'button.btn.btn-primary.btn-lg:contains("Start Survey")',
}, { // Question: Where do you live ?
trigger: 'div.js_question-wrapper:contains("Where do you live ?") input',
run: 'text Grand-Rosiere',
}, { // Question: When is your date of birth ?
trigger: 'div.js_question-wrapper:contains("When is your date of birth ?") input',
run: 'text 05/05/1980',
}, { // Question: How frequently do you buy products online ?
trigger: 'div.js_question-wrapper:contains("How frequently do you buy products online ?") label:contains("Once a week")',
}, { // Question: How many times did you order products on our website ?
trigger: 'div.js_question-wrapper:contains("How many times did you order products on our website ?") input',
run: 'text 42',
run: "click",
}, { // Question: Where do you live?
trigger: 'div.js_question-wrapper:contains("Where do you live?") input',
run: "edit Grand-Rosiere",
}, { // Question: When is your date of birth?
trigger: 'div.js_question-wrapper:contains("When is your date of birth?") input',
run: "edit 05/05/1980",
}, { // Question: How frequently do you buy products online?
trigger: 'div.js_question-wrapper:contains("How frequently do you buy products online?") label:contains("Once a week")',
run: "click",
}, { // Question: How many times did you order products on our website?
trigger: 'div.js_question-wrapper:contains("How many times did you order products on our website?") input',
run: "edit 42",
}, {
content: 'Click on Next Page',
trigger: 'button[value="next"]',
run: "click",
},
// Page-2
{ // Question: Which of the following words would you use to describe our products ?
{ // Question: Which of the following words would you use to describe our products?
content: 'Answer Which of the following words would you use to describe our products (High Quality)',
trigger: 'div.js_question-wrapper:contains("Which of the following words would you use to describe our products") label:contains("High quality")',
run: "click",
}, {
content: 'Answer Which of the following words would you use to describe our products (Good value for money)',
trigger: 'div.js_question-wrapper:contains("Which of the following words would you use to describe our products") label:contains("Good value for money")',
run: "click",
}, {
content: 'Answer What do your think about our new eCommerce (The new layout and design is fresh and up-to-date)',
trigger: 'div.js_question-wrapper:contains("What do your think about our new eCommerce") tr:contains("The new layout and design is fresh and up-to-date") td:first',
run: "click",
}, {
content: 'Answer What do your think about our new eCommerce (It is easy to find the product that I want)',
trigger: 'div.js_question-wrapper:contains("What do your think about our new eCommerce") tr:contains("It is easy to find the product that I want") td:eq(2)',
run: "click",
}, {
content: 'Answer What do your think about our new eCommerce (The tool to compare the products is useful to make a choice)',
trigger: 'div.js_question-wrapper:contains("What do your think about our new eCommerce") tr:contains("The tool to compare the products is useful to make a choice") td:eq(3)',
run: "click",
}, {
content: 'Answer What do your think about our new eCommerce (The checkout process is clear and secure)',
trigger: 'div.js_question-wrapper:contains("What do your think about our new eCommerce") tr:contains("The checkout process is clear and secure") td:eq(2)',
run: "click",
}, {
content: 'Answer What do your think about our new eCommerce (I have added products to my wishlist)',
trigger: 'div.js_question-wrapper:contains("What do your think about our new eCommerce") tr:contains("I have added products to my wishlist") td:last',
run: "click",
}, {
content: 'Answer Do you have any other comments, questions, or concerns',
trigger: 'div.js_question-wrapper:contains("Do you have any other comments, questions, or concerns") textarea',
run: 'text Is the prefill working?',
run: "edit Is the prefill working?",
}, {
content: 'Answer How would you rate your experience on our website?',
trigger: 'div.js_question-wrapper:contains("How would you rate your experience on our website") label:contains("4")',
run: "click",
}, {
// Go back to previous page
content: 'Click on the previous page name in the breadcrumb',
trigger: 'ol.breadcrumb a:first',
}, {
trigger: 'div.js_question-wrapper:contains("How many times did you order products on our website ?") input',
run: function () {
var $inputQ3 = $('div.js_question-wrapper:contains("How many times did you order products on our website ?") input');
if ($inputQ3.val() === '42.0') {
$('.o_survey_title').addClass('prefilled');
}
}
}, {
trigger: '.o_survey_title.prefilled',
run: function () {
// check that all the answers are prefilled in Page 1
var $inputQ1 = $('div.js_question-wrapper:contains("Where do you live ?") input');
if ($inputQ1.val() !== 'Grand-Rosiere') {
return;
}
var $inputQ2 = $('div.js_question-wrapper:contains("When is your date of birth ?") input');
if ($inputQ2.val() !== '05/05/1980') {
return;
}
var $inputQ3 = $('div.js_question-wrapper:contains("How frequently do you buy products online ?") label:contains("Once a week") input');
if (!$inputQ3.is(':checked')) {
return;
}
var $inputQ4 = $('div.js_question-wrapper:contains("How many times did you order products on our website ?") input');
if ($inputQ4.val() !== '42.0') {
return;
}
$('.o_survey_title').addClass('tour_success');
}
}, {
trigger: '.o_survey_title.tour_success'
}, {
content: 'Click on Next Page',
trigger: 'button[value="next"]',
}, {
trigger: 'div.js_question-wrapper:contains("Do you have any other comments, questions, or concerns") textarea',
run: function () {
var $inputQ3 = $('div.js_question-wrapper:contains("Do you have any other comments, questions, or concerns") textarea');
if ($inputQ3.val() === "Is the prefill working?") {
$('.o_survey_title').addClass('prefilled2');
}
}
}, {
trigger: '.o_survey_title.prefilled2',
run: function () {
// check that all the answers are prefilled in Page 2
var $input1Q1 = $('div.js_question-wrapper:contains("Which of the following words would you use to describe our products") label:contains("High quality") input');
if (!$input1Q1.is(':checked')) {
return;
}
var $input2Q1 = $('div.js_question-wrapper:contains("Which of the following words would you use to describe our products") label:contains("Good value for money") input');
if (!$input2Q1.is(':checked')) {
return;
}
var $input1Q2 = $('div.js_question-wrapper:contains("What do your think about our new eCommerce") tr:contains("The new layout and design is fresh and up-to-date") input:first');
if (!$input1Q2.is(':checked')) {
return;
}
var $input2Q2 = $('div.js_question-wrapper:contains("What do your think about our new eCommerce") tr:contains("It is easy to find the product that I want") input:eq(2)');
if (!$input2Q2.is(':checked')) {
return;
}
var $input3Q2 = $('div.js_question-wrapper:contains("What do your think about our new eCommerce") tr:contains("The tool to compare the products is useful to make a choice") input:eq(3)');
if (!$input3Q2.is(':checked')) {
return;
}
var $input4Q2 = $('div.js_question-wrapper:contains("What do your think about our new eCommerce") tr:contains("The checkout process is clear and secure") input:eq(2)');
if (!$input4Q2.is(':checked')) {
return;
}
var $input5Q2 = $('div.js_question-wrapper:contains("What do your think about our new eCommerce") tr:contains("I have added products to my wishlist") input:last');
if (!$input5Q2.is(':checked')) {
return;
}
var $inputQ3 = $('div.js_question-wrapper:contains("Do you have any other comments, questions, or concerns") textarea');
if ($inputQ3.val() !== "Is the prefill working?") {
return;
}
$('.o_survey_title').addClass('tour_success_2');
}
}, {
trigger: '.o_survey_title.tour_success_2'
}
]);
run: "click",
},
{
content: "check survey is prefilled",
trigger:
'div.js_question-wrapper:contains("How many times did you order products on our website?") input:value(42)',
},
{
trigger: `div.js_question-wrapper:contains("Where do you live?") input:value(Grand-Rosiere)`,
},
{
trigger: `div.js_question-wrapper:contains("When is your date of birth?") input:value(05/05/1980)`,
},
{
trigger: `div.js_question-wrapper:contains("How frequently do you buy products online?) label:contains("Once a week") input:hidden:checked`,
},
{
trigger: ".o_survey_title",
run: "click",
},
{
content: "Click on Next Page",
trigger: 'button[value="next"]',
run: "click",
},
{
trigger:
'div.js_question-wrapper:contains("Do you have any other comments, questions, or concerns") textarea:value(Is the prefill working?)',
},
{
trigger:
'div.js_question-wrapper:contains("Which of the following words would you use to describe our products") label:contains("High quality") input:hidden:checked',
},
{
trigger:
'div.js_question-wrapper:contains("Which of the following words would you use to describe our products") label:contains("Good value for money") input:hidden:checked',
},
{
trigger:
'div.js_question-wrapper:contains("What do your think about our new eCommerce") tr:contains("The new layout and design is fresh and up-to-date") input:first:hidden:checked',
},
{
trigger:
'div.js_question-wrapper:contains("What do your think about our new eCommerce") tr:contains("It is easy to find the product that I want") input:eq(2):hidden:checked',
},
{
trigger:
'div.js_question-wrapper:contains("What do your think about our new eCommerce") tr:contains("The tool to compare the products is useful to make a choice") input:eq(3):hidden:checked',
},
{
trigger:
'div.js_question-wrapper:contains("What do your think about our new eCommerce") tr:contains("The checkout process is clear and secure") input:eq(2):hidden:checked',
},
{
trigger:
'div.js_question-wrapper:contains("What do your think about our new eCommerce") tr:contains("I have added products to my wishlist") input:last:hidden:checked',
},
{
trigger:
'div.js_question-wrapper:contains("How would you rate your experience on our website") label:contains("4") input:hidden:checked',
},
],
});

View file

@ -0,0 +1,87 @@
import { registry } from '@web/core/registry';
registry.category('web_tour.tours').add('test_survey_roaming_mandatory_questions', {
url: '/survey/start/853ebb30-40f2-43bf-a95a-bbf0e367a365',
steps: () => [{
content: 'Click on Start',
trigger: 'button.btn:contains("Start")',
run: "click",
}, {
content: 'Skip question Q1',
trigger: 'button.btn:contains("Continue")',
run: "click",
},
{
trigger: 'div.js_question-wrapper:contains("Q2")',
},
{
content: 'Skip question Q2',
trigger: 'button.btn:contains("Continue")',
run: "click",
}, {
content: 'Check if Q3 button is Submit',
trigger: 'button.btn:contains("Submit")',
}, {
content: 'Go back to Q2',
trigger: 'button.btn[value="previous"]',
run: "click",
}, {
content: 'Check if the alert box is present',
trigger: 'div.o_survey_question_error span',
}, {
content: 'Skip question Q2 again',
trigger: 'button.btn:contains("Continue")',
run: "click",
}, {
content: 'Answer Q3',
trigger: 'div.js_question-wrapper:contains("Q3") label:contains("Answer 1")',
run: "click",
}, {
content: 'Click on Submit',
trigger: 'button.btn:contains("Submit")',
run: "click",
}, {
content: "Click on Submit",
trigger: 'button.btn-primary:contains("Submit")',
run: "click",
}, {
content: 'Check if question is Q1',
trigger: 'div.js_question-wrapper:contains("Q1")',
}, {
content: 'Click on "Next Skipped" button',
trigger: 'button.btn:contains("Next Skipped")',
run: "click",
}, {
content: 'Check if question is Q2',
trigger: 'div.js_question-wrapper:contains("Q2")',
}, {
content: 'Click on "Next Skipped" button',
trigger: 'button.btn:contains("Next Skipped")',
run: "click",
}, {
content: 'Check if question is Q1 again (should loop on skipped questions)',
trigger: 'div.js_question-wrapper:contains("Q1")',
}, {
content: 'Answer Q1',
trigger: 'div.js_question-wrapper:contains("Q1") label:contains("Answer 2")',
run: "click",
}, {
content: 'Check if the visible question is the skipped question Q2',
trigger: 'div.js_question-wrapper:contains("Q2")',
}, {
content: 'Answer Q2',
trigger: 'div.js_question-wrapper:contains("Q2") label:contains("Answer 3")',
run: "click",
}, {
content: 'Click on Submit',
trigger: 'button.btn:contains("Submit")',
run: "click",
}, {
content: "Click on Submit",
trigger: 'button.btn-primary:contains("Submit")',
run: "click",
}, {
content: 'Check if the survey is done',
trigger: 'div.o_survey_finished h1:contains("Thank you!")',
}],
});