From 13efb309b4f7c08af5fee4e65a07b30220023383 Mon Sep 17 00:00:00 2001 From: Romain Derie Date: Fri, 1 Jul 2022 14:46:55 +0000 Subject: [PATCH] [FIX] website: correct the website editor tour Introduced with [1] the goal of this tour was to check some lazy loading stuff regarding the edit mode. It was then "wrongly" adapted with [2] where the tour actually still started in the frontend and then clicked on a the new UI button (top left floating icon of the frontend > backend task) to indirectly enter edit mode. While it was working, that's not what the test was aiming to test. The test should remain as it was, testing the edit mode. While the edit btn is now in the backend and not the frontend, the tour should just start there. Note that this commit is required as the behavior the tour was now relying on is removed by the previous commit: the Edit button is not entering edit mode anymore. Instead of adding a new step to click on the Edit btn, let's just start the tour as before on the step where you can click on Edit. It will make the test less dependent of other behavior. This is especially true since that frontend "Edit" button will most likely change again or be removed (and introduced back?). We don't want the tour to rely on this. If those new UI button need to be tested, it should be in another test. [1]: https://github.com/odoo/odoo/commit/6f4c60fe1bb6e460ec6da00c59a9825271893729 [2]: https://github.com/odoo/odoo/commit/99b50d18e220aedf14de806f4bf1b2d35c32de35 closes odoo/odoo#95002 Signed-off-by: Romain Derie (rde) --- .../website/static/tests/tours/specific_website_editor.js | 8 ++++---- addons/website/tests/test_ui.py | 8 +++++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/addons/website/static/tests/tours/specific_website_editor.js b/addons/website/static/tests/tours/specific_website_editor.js index fd8ebd4d303..fdf2271be12 100644 --- a/addons/website/static/tests/tours/specific_website_editor.js +++ b/addons/website/static/tests/tours/specific_website_editor.js @@ -6,8 +6,8 @@ const tour = require('web_tour.tour'); tour.register('generic_website_editor', { test: true, }, [{ - trigger: 'a.o_frontend_to_backend_edit_btn', - content: 'Go to backend', + content: 'Click edit button', + trigger: '.o_edit_website_container > a', }, { trigger: 'iframe body:not([data-hello="world"])', @@ -19,8 +19,8 @@ tour.register('generic_website_editor', { tour.register('specific_website_editor', { test: true, }, [{ - trigger: 'a.o_frontend_to_backend_edit_btn', - content: 'Go to backend', + content: 'Click edit button', + trigger: '.o_edit_website_container > a', }, { trigger: 'iframe body[data-hello="world"]', diff --git a/addons/website/tests/test_ui.py b/addons/website/tests/test_ui.py index 10ced6419db..715a98a58ab 100644 --- a/addons/website/tests/test_ui.py +++ b/addons/website/tests/test_ui.py @@ -3,6 +3,8 @@ import base64 +from werkzeug.urls import url_encode + import odoo import odoo.tests @@ -173,9 +175,9 @@ class TestUi(odoo.tests.HttpCase): 'path': custom_url, 'website_id': new_website.id, }) - - self.start_tour("/website/force/%s" % website_default.id, "generic_website_editor", login='admin') - self.start_tour("/website/force/%s" % new_website.id, "specific_website_editor", login='admin') + url_params = url_encode({'path': '/@/'}) + self.start_tour(f'/website/force/{website_default.id}?{url_params}', "generic_website_editor", login='admin') + self.start_tour(f'/website/force/{new_website.id}?{url_params}', "specific_website_editor", login='admin') def test_06_public_user_editor(self): website_default = self.env['website'].search([], limit=1)