[FIX] website: address test tour issue with links href updating

This commit resolves an issue in the `link_tools` test, specifically
addressing a failure that arises when verifying the synchronization
between the link's href and the content of the `<a>` tag. The failure
was attributed to the oversight of not clicking outside the popup to
close it before interacting with the link.

Note: the race condition that occurs in this test was very rare and was
reduced a lot by [1], its parent commits and their related forward-port.
The last version of this commit here actually does not seem to change
much but the code speaks for itself: this is how it should be written.
Further race conditions need to be fixed in this test again anyway.

This also modifies some steps to make them clearer.
In this forward-ported version, it actually patches what was done at [2]
by adding back the "input" trigger that the original commit added with
commit [3]. It also removes the outdated wait for popup opening that was
fixed the right way with [1] and its parent commits.

Final note: in this forward-ported version, the test systematically
fails on the same step, with or without this commit. Further PR will be
made; but for now, this unify what we have in all versions, hopefully.

[1]: https://github.com/odoo/odoo/commit/9b26aafbc1576b08c409344d22ec179bd32a3bd7
[2]: https://github.com/odoo/odoo/commit/7d26c7b666033a16acfb430b6bf06235dd7d88ea
[3]: https://github.com/odoo/odoo/commit/b2a79ed9960d88d1bdf6465389f4ef720f6bc235

runbot-24929

closes odoo/odoo#149871

X-original-commit: b38b40fde5cc2396b0b8b20332a5b80935eb1814
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: qsm-odoo <qsm@odoo.com>
This commit is contained in:
Serge Bayet (seba)
2024-01-18 12:01:06 +00:00
committed by qsm-odoo
co-authored by qsm-odoo
parent 3467aa5927
commit 2b7303ca46
+11 -11
View File
@@ -78,10 +78,9 @@ wTourUtils.registerWebsitePreviewTour('link_tools', {
{
content: "Link tools, should be open, change the url",
trigger: '#o_link_dialog_url_input',
run: 'text odoo.be'
run: 'text_blur odoo.be'
},
clickOnImgStep,
...wTourUtils.clickOnSave(),
// 3. Edit a link after saving the page.
...wTourUtils.clickOnEditAndWaitEditMode(),
@@ -226,7 +225,7 @@ wTourUtils.registerWebsitePreviewTour('link_tools', {
{
content: "Change URL back into a http one",
trigger: "#o_link_dialog_url_input",
run: "text callmemaybe.com",
run: "text_blur callmemaybe.com",
},
{
content: "Check that link was updated and link content is synced with URL",
@@ -251,15 +250,16 @@ wTourUtils.registerWebsitePreviewTour('link_tools', {
{
content: "Edit link label",
trigger: "iframe .s_text_image p a",
async run(actions) {
// Wait for the popover to finish its opening animation and turn the
// observer back on.
await new Promise(resolve => setTimeout(resolve, 1000));
// This does not trigger a historyStep...
run(actions) {
actions.text("callmemaybe.com/shops");
// ... but this does.
this.$anchor[0].dispatchEvent(new KeyboardEvent('keydown', { key: 'Backspace', bubbles: true }));
}
// Make sure to trigger an history step.
// Trick the editor into keyboardType === 'PHYSICAL' and delete the
// last character "s" and end with "callmemaybe.com/shop"
const link = this.$anchor[0];
link.dispatchEvent(new KeyboardEvent("keydown", { key: "Backspace", bubbles: true }));
// Trigger editor's '_onInput' handler.
link.dispatchEvent(new InputEvent('input', {inputType: 'insertText', bubbles: true}));
},
},
{
content: "Check that links's href was updated",