From 96a1a5e69a468b60e471e76d4273b0bbc84b4794 Mon Sep 17 00:00:00 2001 From: Romain Derie Date: Tue, 16 May 2023 13:23:42 +0000 Subject: [PATCH] [FIX] website: prevent race condition on snippet_editor_panel_options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this commit this tour was often failing. It seems to be because there were some requests still being executed / received after the test was marked as successful and browser getting killed. According to the logs, even when the tour is actually not failing, there is still some unexpected requests going on. With this commit, saving and waiting the edit mode to be exited will prevent all those requests issues, as it seems like the requests done after exiting edit mode are all awaited before marking the test as successfull. == Before the fix success case == - Tour snippet_editor_panel_options on step: 'The text toolbar should still be visible, and the text still selected. (trigger: #oe_snippets .o_we_customize_panel > #o_we_editor_toolbar_container)' - GET /website/static/src/img/snippets_options/header_template_default.svg HTTP/1.1" 200 - 0 0.000 0.003 - [Same GET for 10 other header templates] - test successful - Session expired - POST /website/theme_customize_data_get HTTP/1.1" 200 - 3 0.001 0.003 - [2 lines above x10] - Deleting cookies and clearing local storage - Navigating to: "about:blank" - Navigation result: {'frameId': 'A538603CC37A4E9EBA99B8624C1CD34E', 'loaderId': '9187051DD3D9477FA4EDEB1A544D584E'} - Waiting for frame 'A538603CC37A4E9EBA99B8624C1CD34E' to stop loading - waiting for threads: [] == Before the fix error case == - Tour snippet_editor_panel_options on step: 'The text toolbar should still be visible, and the text still selected. (trigger: #oe_snippets .o_we_customize_panel > #o_we_editor_toolbar_container)' - GET /website/static/src/img/snippets_options/header_template_sidebar.svg HTTP/1.1" 200 - 0 0.000 0.004 - [Same GET for 10 other header templates] - test successful - GET /web/static/img/smile.svg HTTP/1.1" 200 - 0 0.000 0.001 - GET /web/static/img/spin.svg HTTP/1.1" 200 - 0 0.000 0.001 - Failed to fetch - Asking for screenshot - Trying to set result to failed (TypeError: Failed to fetch) but found the future settled () - Deleting cookies and clearing local storage - Screenshot in: /data/build/tests/36222061-master-all_no_autotag/screenshots/sc_20230513_220042_739175_TestUi.png - Navigating to: "about:blank" - Navigation result: {'frameId': 'E1A779132E972A440E5FE892BBBC9FEC', 'loaderId': '822ACED443DB0C84F57DD4A1FF451D5B'} - Waiting for frame 'E1A779132E972A440E5FE892BBBC9FEC' to stop loading - waiting for threads: [] == After the fix case == - Tour snippet_editor_panel_options on step: 'iframe body:not(.editor_enable)' - GET /web/static/img/spin.svg HTTP/1.1" 200 - 0 0.000 0.003 - POST /website/theme_customize_data_get HTTP/1.1" 200 - 8 0.002 0.035 - [Many other POST/GET requests] - test successful - Deleting cookies and clearing local storage - Navigating to: "about:blank" - Navigation result: {'frameId': '4B87BC8A50A3FEBD7D508394DD5BDB19', 'loaderId': '7CCB3B6434B52B456A1AA470C3CFA1BF'} - Waiting for frame '4B87BC8A50A3FEBD7D508394DD5BDB19' to stop loading - waiting for threads: [] runbot-15312 closes odoo/odoo#121795 X-original-commit: 936cc061ab20dc1fe4587b24f59dc322d0e7ad9b Signed-off-by: Xavier Dollé (xdo) Signed-off-by: Romain Derie (rde) --- .../static/tests/tours/snippet_editor_panel_options.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/website/static/tests/tours/snippet_editor_panel_options.js b/addons/website/static/tests/tours/snippet_editor_panel_options.js index 216b41955c8..4e36a0d6d5c 100644 --- a/addons/website/static/tests/tours/snippet_editor_panel_options.js +++ b/addons/website/static/tests/tours/snippet_editor_panel_options.js @@ -147,4 +147,6 @@ wTourUtils.dragNDrop({ console.error("The paragraph text selection was lost."); } }, -}]); +}, +...wTourUtils.clickOnSave(), +]);