mirror of
https://github.com/bringout/oca-ocb-test.git
synced 2026-04-26 08:22:00 +02:00
19.0 vanilla
This commit is contained in:
parent
38c6088dcc
commit
d9452d2060
243 changed files with 30797 additions and 10815 deletions
|
|
@ -1,6 +1,10 @@
|
|||
/** @odoo-module **/
|
||||
|
||||
import wTourUtils from 'website.tour_utils';
|
||||
import {
|
||||
clickOnEditAndWaitEditMode,
|
||||
clickOnSave,
|
||||
registerWebsitePreviewTour,
|
||||
} from '@website/js/tours/tour_utils';
|
||||
import { stepUtils } from "@web_tour/tour_utils";
|
||||
|
||||
/**
|
||||
* The purpose of these tours is to check the systray visibility:
|
||||
|
|
@ -12,189 +16,209 @@ import wTourUtils from 'website.tour_utils';
|
|||
* - as an unrelated user (neither "tester" nor restricted editor)
|
||||
*/
|
||||
|
||||
const canPublish = [{
|
||||
content: 'Publish',
|
||||
const canPublish = () => [{
|
||||
content: "Publish",
|
||||
trigger: '.o_menu_systray .o_menu_systray_item:contains("Unpublished")',
|
||||
run: "click",
|
||||
}, {
|
||||
content: 'Wait for Publish',
|
||||
content: "Wait for Publish",
|
||||
trigger: '.o_menu_systray .o_menu_systray_item:contains("Published"):not([data-processing])',
|
||||
run: () => {}, // This is a check.
|
||||
}, {
|
||||
content: 'Unpublish',
|
||||
content: "Unpublish",
|
||||
trigger: '.o_menu_systray .o_menu_systray_item:contains("Published")',
|
||||
run: "click",
|
||||
}, {
|
||||
content: 'Wait for Unpublish',
|
||||
content: "Wait for Unpublish",
|
||||
trigger: '.o_menu_systray .o_menu_systray_item:contains("Unpublished"):not([data-processing])',
|
||||
run: () => {}, // This is a check.
|
||||
}];
|
||||
|
||||
const cannotPublish = [{
|
||||
content: 'Check has no Publish/Unpublish',
|
||||
const cannotPublish = () => [{
|
||||
content: "Check has no Publish/Unpublish",
|
||||
trigger: '.o_menu_systray:not(:has(.o_menu_systray_item:contains("ublished")))',
|
||||
run: () => {}, // This is a check.
|
||||
}];
|
||||
|
||||
const canToggleMobilePreview = [{
|
||||
content: 'Enable mobile preview',
|
||||
trigger: '.o_menu_systray .o_menu_systray_item.o_mobile_preview:not(.o_mobile_preview_active)',
|
||||
const canToggleMobilePreview = () => [{
|
||||
content: "Enable mobile preview",
|
||||
trigger: '.o_menu_systray .o_menu_systray_item.o_mobile_preview:not(.o_mobile_preview_active) span',
|
||||
run: "click",
|
||||
}, {
|
||||
content: 'Disable mobile preview',
|
||||
trigger: '.o_menu_systray .o_menu_systray_item.o_mobile_preview.o_mobile_preview_active',
|
||||
content: "Disable mobile preview",
|
||||
trigger: '.o_menu_systray .o_menu_systray_item.o_mobile_preview.o_mobile_preview_active span',
|
||||
run: "click",
|
||||
}];
|
||||
|
||||
const cannotToggleMobilePreview = [{
|
||||
const cannotToggleMobilePreview = () => [{
|
||||
content: 'Enable mobile preview',
|
||||
trigger: '.o_menu_systray:not(:has(.o_menu_systray_item.o_mobile_preview))',
|
||||
run: () => {}, // This is a check.
|
||||
}];
|
||||
|
||||
// For non-website users, switching across website only works if the domains are
|
||||
// specified. Within the scope of test tours, this cannot be achieved.
|
||||
const canSwitchWebsiteNoCheck = [{
|
||||
const canSwitchWebsiteNoCheck = () => [{
|
||||
content: 'Open website switcher',
|
||||
trigger: '.o_menu_systray .o_menu_systray_item.o_website_switcher_container .dropdown-toggle:contains("My Website"):not(:contains("My Website 2"))',
|
||||
run: "click",
|
||||
}, {
|
||||
content: 'Switch to other website',
|
||||
trigger: '.o_menu_systray .o_menu_systray_item.o_website_switcher_container .dropdown-item:contains("Other")',
|
||||
run: () => {}, // This is a check.
|
||||
content: 'Can switch to other website',
|
||||
trigger: '.o-dropdown--menu .dropdown-item:contains("Other")',
|
||||
}];
|
||||
|
||||
|
||||
const canSwitchWebsite = [{
|
||||
content: 'Open website switcher',
|
||||
const canSwitchWebsite = () => [{
|
||||
content: "Open website switcher",
|
||||
trigger: '.o_menu_systray .o_menu_systray_item.o_website_switcher_container .dropdown-toggle:contains("My Website"):not(:contains("My Website 2"))',
|
||||
run: "click",
|
||||
}, {
|
||||
content: 'Switch to other website',
|
||||
trigger: '.o_menu_systray .o_menu_systray_item.o_website_switcher_container .dropdown-item:contains("Other")',
|
||||
content: "Switch to other website",
|
||||
trigger: '.o-dropdown--menu .dropdown-item:contains("Other")',
|
||||
run: "click",
|
||||
}, {
|
||||
content: 'Wait for other website',
|
||||
trigger: 'iframe body:contains("Test Model") div:contains("Other")',
|
||||
run: () => {}, // This is a check.
|
||||
content: "Wait for other website",
|
||||
trigger: ':iframe body:contains("Test Model") div:contains("Other")',
|
||||
}];
|
||||
|
||||
const canAddNewContent = [{
|
||||
content: 'Open +New content',
|
||||
trigger: '.o_menu_systray .o_menu_systray_item.o_new_content_container',
|
||||
const canAddNewContent = () => [{
|
||||
content: "Open +New content",
|
||||
trigger: '.o_menu_systray .o_menu_systray_item.o_new_content_container button',
|
||||
run: "click",
|
||||
}, {
|
||||
content: 'Close +New content',
|
||||
trigger: '#o_new_content_menu_choices',
|
||||
content: "Close +New content",
|
||||
trigger: '.o_new_content_menu_choices',
|
||||
run: "click",
|
||||
}];
|
||||
|
||||
const cannotAddNewContent = [{
|
||||
const cannotAddNewContent = () => [{
|
||||
content: 'No +New content',
|
||||
trigger: '.o_menu_systray:not(:has(.o_menu_systray_item.o_new_content_container))',
|
||||
run: () => {}, // This is a check.
|
||||
}];
|
||||
|
||||
const canEditInBackEnd = [{
|
||||
content: 'Edit in backend',
|
||||
const canEditInBackEnd = () => [{
|
||||
content: "Edit in backend",
|
||||
trigger: '.o_menu_systray .o_website_edit_in_backend a',
|
||||
run: "click",
|
||||
}, {
|
||||
content: 'Check that the form is editable',
|
||||
content: "Check that the form is editable",
|
||||
trigger: '.o_form_view_container .o_form_editable',
|
||||
run: () => {}, // This is a check.
|
||||
}, {
|
||||
content: 'Return to website',
|
||||
trigger: '.oe_button_box .fa-globe',
|
||||
content: "Return to website",
|
||||
trigger: '.o-form-buttonbox .fa-globe',
|
||||
run: "click",
|
||||
}];
|
||||
|
||||
const canViewInBackEnd = [{
|
||||
content: 'Go to backend',
|
||||
const canViewInBackEnd = () => [{
|
||||
content: "Go to backend",
|
||||
trigger: '.o_menu_systray .o_website_edit_in_backend a',
|
||||
run: "click",
|
||||
}, {
|
||||
content: 'Check that the form is read-only',
|
||||
content: "Check that the form is read-only",
|
||||
trigger: '.o_form_view_container .o_form_readonly',
|
||||
run: () => {}, // This is a check.
|
||||
}, {
|
||||
content: 'Return to website',
|
||||
trigger: '.oe_button_box .fa-globe',
|
||||
content: "Return to website",
|
||||
trigger: '.o-form-buttonbox .fa-globe',
|
||||
run: "click",
|
||||
}];
|
||||
|
||||
const canEdit = [
|
||||
...wTourUtils.clickOnEditAndWaitEditMode(),
|
||||
const canEdit = () => [
|
||||
...clickOnEditAndWaitEditMode(),
|
||||
{
|
||||
content: 'Click on name',
|
||||
trigger: 'iframe span[data-oe-expression="test_model.name"][contenteditable="true"]',
|
||||
content: "Click on name",
|
||||
trigger: ':iframe span[data-oe-expression="test_model.name"][contenteditable="true"]',
|
||||
run: "click",
|
||||
}, {
|
||||
content: 'Change name',
|
||||
trigger: 'iframe span[data-oe-expression="test_model.name"][contenteditable="true"]',
|
||||
run: 'text Better name',
|
||||
content: "Change name",
|
||||
trigger: ':iframe span[data-oe-expression="test_model.name"][contenteditable="true"]',
|
||||
run: "editor Better name",
|
||||
}, {
|
||||
content: 'Check that field becomes dirty',
|
||||
trigger: 'iframe span[data-oe-expression="test_model.name"].o_dirty',
|
||||
run: () => {}, // This is a check.
|
||||
content: "Check that field becomes dirty",
|
||||
trigger: ':iframe span[data-oe-expression="test_model.name"].o_dirty',
|
||||
},
|
||||
...wTourUtils.clickOnSave(),
|
||||
...clickOnSave(),
|
||||
{
|
||||
content: 'Check whether name is saved',
|
||||
trigger: 'iframe span[data-oe-expression="test_model.name"]:contains("Better name")',
|
||||
run: () => {}, // This is a check.
|
||||
content: "Check whether name is saved",
|
||||
trigger: ':iframe span[data-oe-expression="test_model.name"]:contains("Better name")',
|
||||
},
|
||||
];
|
||||
|
||||
const cannotEdit = [{
|
||||
content: 'Check Edit is not available',
|
||||
const cannotEdit = () => [stepUtils.waitIframeIsReady(), {
|
||||
content: "Check Edit is not available",
|
||||
trigger: '.o_menu_systray:not(:has(.o_edit_website_container))',
|
||||
run: () => {}, // This is a check.
|
||||
}];
|
||||
|
||||
const canEditButCannotChange = [
|
||||
...wTourUtils.clickOnEditAndWaitEditMode(),
|
||||
const canEditButCannotChange = () => [
|
||||
...clickOnEditAndWaitEditMode(),
|
||||
{
|
||||
content: 'Cannot change name',
|
||||
trigger: 'iframe main:not(:has([data-oe-expression])):contains("Test Model")',
|
||||
run: () => {}, // This is a check.
|
||||
trigger: ':iframe main:not(:has([data-oe-expression])):contains("Test Model")',
|
||||
},
|
||||
];
|
||||
|
||||
const ensureWebsiteSwitcherIsNotVisible = [
|
||||
{
|
||||
content: "Ensure website switcher is hidden when only one website exists",
|
||||
trigger: ".o_menu_systray:not(:has(.o_website_switcher_container))",
|
||||
},
|
||||
];
|
||||
|
||||
const ensureWebsiteSwitcherIsVisible = [
|
||||
{
|
||||
content: "Ensure website switcher is present when multiple website exists",
|
||||
trigger: ".o_menu_systray:has(.o_website_switcher_container)",
|
||||
},
|
||||
];
|
||||
|
||||
const register = (title, steps) => {
|
||||
wTourUtils.registerWebsitePreviewTour(title, {
|
||||
url: '/test_model/1',
|
||||
test: true,
|
||||
registerWebsitePreviewTour(title, {
|
||||
url: "/test_model/1",
|
||||
}, steps);
|
||||
};
|
||||
|
||||
register('test_systray_admin', [
|
||||
...canPublish,
|
||||
...canToggleMobilePreview,
|
||||
...canSwitchWebsite,
|
||||
...canAddNewContent,
|
||||
...canEditInBackEnd,
|
||||
...canEdit,
|
||||
register("test_systray_admin", () => [
|
||||
...canPublish(),
|
||||
...canToggleMobilePreview(),
|
||||
...canSwitchWebsite(),
|
||||
...canAddNewContent(),
|
||||
...canEditInBackEnd(),
|
||||
...canEdit(),
|
||||
]);
|
||||
|
||||
register('test_systray_reditor_tester', [
|
||||
...canPublish,
|
||||
...canToggleMobilePreview,
|
||||
...canSwitchWebsite,
|
||||
...canAddNewContent,
|
||||
...canEditInBackEnd,
|
||||
...canEdit,
|
||||
register("test_systray_reditor_tester", () => [
|
||||
...canPublish(),
|
||||
...canToggleMobilePreview(),
|
||||
...canSwitchWebsite(),
|
||||
...canAddNewContent(),
|
||||
...canEditInBackEnd(),
|
||||
...canEdit(),
|
||||
]);
|
||||
|
||||
register('test_systray_reditor_not_tester', [
|
||||
...cannotPublish,
|
||||
...canToggleMobilePreview,
|
||||
...canSwitchWebsite,
|
||||
...canAddNewContent,
|
||||
...canViewInBackEnd,
|
||||
...canEditButCannotChange,
|
||||
register("test_systray_reditor_not_tester", () => [
|
||||
...cannotPublish(),
|
||||
...canToggleMobilePreview(),
|
||||
...canSwitchWebsite(),
|
||||
...canAddNewContent(),
|
||||
...canViewInBackEnd(),
|
||||
...canEditButCannotChange(),
|
||||
]);
|
||||
|
||||
register('test_systray_not_reditor_tester', [
|
||||
...canPublish,
|
||||
...cannotToggleMobilePreview,
|
||||
...canSwitchWebsiteNoCheck,
|
||||
...cannotAddNewContent,
|
||||
...canEditInBackEnd,
|
||||
...cannotEdit,
|
||||
register("test_systray_not_reditor_tester", () => [
|
||||
...canPublish(),
|
||||
...cannotToggleMobilePreview(),
|
||||
...canSwitchWebsiteNoCheck(),
|
||||
...cannotAddNewContent(),
|
||||
...canEditInBackEnd(),
|
||||
...cannotEdit(),
|
||||
]);
|
||||
|
||||
register('test_systray_not_reditor_not_tester', [
|
||||
...cannotPublish,
|
||||
...cannotToggleMobilePreview,
|
||||
...canSwitchWebsiteNoCheck,
|
||||
...cannotAddNewContent,
|
||||
...canViewInBackEnd,
|
||||
...cannotEdit,
|
||||
register("test_systray_not_reditor_not_tester", () => [
|
||||
...cannotPublish(),
|
||||
...cannotToggleMobilePreview(),
|
||||
...canSwitchWebsiteNoCheck(),
|
||||
...cannotAddNewContent(),
|
||||
...canViewInBackEnd(),
|
||||
...cannotEdit(),
|
||||
{
|
||||
trigger: ":iframe main:contains(test model)",
|
||||
},
|
||||
]);
|
||||
|
||||
register("test_systray_single_website", () => ensureWebsiteSwitcherIsNotVisible);
|
||||
|
||||
register("test_systray_multi_website", () => ensureWebsiteSwitcherIsVisible);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue