Skip to content

Commit af0cc5d

Browse files
committed
fix tour
1 parent 6e36b56 commit af0cc5d

File tree

2 files changed

+45
-14
lines changed

2 files changed

+45
-14
lines changed

addons/website/static/tests/tours/link_to_document.js

Lines changed: 45 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,17 @@ const unpatchStep = {
2222
run: () => unpatch(),
2323
};
2424

25+
function showLinkPopover(linkEl) {
26+
const doc = linkEl.ownerDocument;
27+
const selection = doc.getSelection();
28+
const range = doc.createRange();
29+
selection.removeAllRanges();
30+
range.setStart(linkEl.childNodes[0], 0);
31+
range.setEnd(linkEl.childNodes[0], 0);
32+
doc.dispatchEvent(new Event("focus"));
33+
selection.addRange(range);
34+
}
35+
2536
/**
2637
* The purpose of this tour is to check the Linktools to create a link to an
2738
* uploaded document.
@@ -41,31 +52,52 @@ registerWebsitePreviewTour(
4152
{
4253
content: "Click on button Start Now",
4354
trigger: ":iframe #wrap .s_banner a:nth-child(1)",
44-
run: "click",
55+
run: ({ anchor }) => {
56+
showLinkPopover(anchor);
57+
},
4558
},
46-
patchStep,
4759
{
48-
content: "Click on link to an uploaded document",
49-
trigger: ".o_url_input .o_we_user_value_widget.fa.fa-upload",
60+
content: "Click on edit link",
61+
trigger: ".o-we-linkpopover .o_we_edit_link",
5062
run: "click",
5163
},
5264
{
53-
content: "Check if a document link is created",
54-
trigger: ":iframe #wrap .s_banner .oe_edited_link[href^='/web/content']",
65+
content: "Make upload button appear by emptying the link input",
66+
trigger: ".o_we_href_input_link",
67+
run: ({ anchor }) => {
68+
anchor.value = "";
69+
anchor.dispatchEvent(new Event("input"));
70+
},
5571
},
56-
unpatchStep,
72+
patchStep,
5773
{
58-
content: "Check if by default the option auto-download is enabled",
59-
trigger: ":iframe #wrap .s_banner .oe_edited_link[href$='download=true']",
74+
content: "Click on upload button",
75+
trigger: ".o_we_href_input_link + span button",
76+
run: "click",
6077
},
6178
{
62-
content: "Deactivate direct download",
63-
trigger: ".o_switch > we-checkbox[name='direct_download']",
79+
content: "Click on apply",
80+
trigger: ".o_we_apply_link",
6481
run: "click",
6582
},
6683
{
67-
content: "Check if auto-download is disabled",
68-
trigger: ":iframe #wrap .s_banner .oe_edited_link:not([href$='download=true'])",
84+
content: "Check if a document link is created",
85+
trigger: ":iframe #wrap .s_banner a[href^='/web/content']",
6986
},
87+
unpatchStep,
88+
// TODO: find where this option is, if it is still present
89+
// {
90+
// content: "Check if by default the option auto-download is enabled",
91+
// trigger: ":iframe #wrap .s_banner .oe_edited_link[href$='download=true']",
92+
// },
93+
// {
94+
// content: "Deactivate direct download",
95+
// trigger: ".o_switch > we-checkbox[name='direct_download']",
96+
// run: "click",
97+
// },
98+
// {
99+
// content: "Check if auto-download is disabled",
100+
// trigger: ":iframe #wrap .s_banner .oe_edited_link:not([href$='download=true'])",
101+
// },
70102
]
71103
);

addons/website/tests/test_attachment.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ def test_01_type_url_301_image(self):
4141
def test_02_image_quality(self):
4242
self.start_tour(self.env['website'].get_client_action_url('/'), 'website_image_quality', login="admin")
4343

44-
@unittest.skip
4544
def test_03_link_to_document(self):
4645
text = b'Lorem Ipsum'
4746
self.env['ir.attachment'].create({

0 commit comments

Comments
 (0)