Skip to content

Commit 45061e7

Browse files
committed
[REF] *: use iframe hoot pseudo selector in tour triggers
In this commit, we change rest of triggers in tours where an iframe is selected (suite of #156653). To do this, we use the :iframe HOOT pseudo-selector. With this changes, we can now remove the getNodesFromSelector function in odoo/addons/web_tour/static/src/tour_service/tour_utils.js Note that in this previous function, a ([is-ready]="true") check was made for iframe elements but was only necessary for few of them (7). So, a stepUtils.waitIframeIsReady() has been added to check this state. closes #783 Related: odoo/odoo#157217 Related: odoo/enterprise#58474 Signed-off-by: Julien Mougenot (jum) <[email protected]>
1 parent 833a667 commit 45061e7

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

theme_test_custo/static/tests/tours/theme_menu_hierarchies.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,61 @@
11
/** @odoo-module */
22

33
import wTourUtils from '@website/js/tours/tour_utils';
4+
import { stepUtils } from "@web_tour/tour_service/tour_utils";
45

56
wTourUtils.registerWebsitePreviewTour('theme_menu_hierarchies', {
67
url: '/example',
78
test: true,
89
}, () => [
10+
stepUtils.waitIframeIsReady(),
911
{
1012
content: 'Check Mega Menu is correctly created',
11-
trigger: "iframe .top_menu a.o_mega_menu_toggle",
13+
trigger: ":iframe .top_menu a.o_mega_menu_toggle",
1214
}, {
1315
content: 'Check Mega Menu content',
14-
trigger: "iframe .top_menu div.o_mega_menu.show .fa-cube",
16+
trigger: ":iframe .top_menu div.o_mega_menu.show .fa-cube",
1517
run: () => null, // It's a check.
1618
}, {
1719
content: 'Check new top level menu is correctly created',
18-
trigger: 'iframe .top_menu .nav-item.dropdown .dropdown-toggle:contains("Example 1")',
20+
trigger: ':iframe .top_menu .nav-item.dropdown .dropdown-toggle:contains("Example 1")',
1921
}, {
2022
content: 'Check sub menu are correctly created',
21-
trigger: 'iframe .top_menu .dropdown-menu.show a.dropdown-item:contains("Item 1")',
23+
trigger: ':iframe .top_menu .dropdown-menu.show a.dropdown-item:contains("Item 1")',
2224
run: () => null, // It's a check.
2325
}, {
2426
content: 'The new menu hierarchy should not be included in the navbar',
25-
trigger: 'iframe body:not(:has(.top_menu a[href="/dogs"]))',
27+
trigger: ':iframe body:not(:has(.top_menu a[href="/dogs"]))',
2628
run: () => null, // It's a check.
2729
}, {
2830
content: 'The new menu hierarchy should be inside the footer',
29-
trigger: 'iframe footer ul li a[href="/dogs"]',
31+
trigger: ':iframe footer ul li a[href="/dogs"]',
3032
run: () => null, // It's a check.
3133
},
3234
...wTourUtils.clickOnEditAndWaitEditMode(),
3335
{
3436
content: 'Click on footer',
35-
trigger: 'iframe footer',
37+
trigger: ':iframe footer',
3638
}, {
3739
content: 'The theme custom footer template should be listed and selected',
3840
trigger: 'we-select[data-variable="footer-template"] we-toggler img[src*="/theme_test_custo"]',
3941
run: () => null, // It's a check.
4042
}, {
4143
content: 'Click on header',
42-
trigger: 'iframe header',
44+
trigger: ':iframe header',
4345
}, {
4446
content: 'The theme custom header template should be listed and selected',
4547
trigger: 'we-select[data-variable="header-template"] we-toggler img[src*="/theme_test_custo"]',
4648
run: () => null, // It's a check.
4749
}, {
4850
content: 'Click on image which has a shape',
49-
trigger: 'iframe #wrap .s_text_image img[data-shape]',
51+
trigger: ':iframe #wrap .s_text_image img[data-shape]',
5052
}, {
5153
content: 'The theme custom "Blob 01" shape should be listed and selected',
5254
trigger: 'we-select[data-name="shape_img_opt"] we-toggler:contains("Blob 01")',
5355
run: () => null, // It's a check.
5456
}, {
5557
content: 'Click on section which has a bg shape',
56-
trigger: 'iframe #wrap .s_text_block[data-oe-shape-data]',
58+
trigger: ':iframe #wrap .s_text_block[data-oe-shape-data]',
5759
}, {
5860
content: 'The theme custom "Curve 01" shape should be listed and selected',
5961
trigger: 'we-select[data-name="bg_shape_opt"] we-toggler:contains("Curve 01")',

0 commit comments

Comments
 (0)