Skip to content

Commit

Permalink
[FIX] website: adapt test tour to avoid undeterministic error
Browse files Browse the repository at this point in the history
Since [1], image options like "Filter" are kept when a user changes the
position of an image in an "Image Gallery" snippet. [1] also adapted the
`snippet_image_gallery` tour (moved in `snippet_image_gallery_reorder`
from version 16) to test this behavior. To do so, the test adds a filter
on an image in an "Image Gallery" snippet, checks that the filter is
displayed on the editor panel, moves the image, clicks on it and finally
checks that the filter is still displayed on the editor panel. The
problem is that the steps that check if the filter is displayed on the
editor panel are the same before and after the move of the image which
means that the second check is true also before the move of the image.
This situation is a typical case where an undeterministic error could
happen. Indeed, we do not know if the second check tests an old value or
an updated one.

To solve the problem, the test has been adapted; after the move of the
image, the test clicks somewhere else (on the footer in this case), and
then back on the moved image to finally check that the filter is still
displayed on the editor panel. The goal of the click on the footer is to
be sure to have a loaded version of the editor panel. By doing so, we
remove the risk of an undeterministic error situation where a condition
is already true before an action is done.

Note: this problem has been discovered because the test
`snippet_image_gallery_reorder` succeeds on version 16.3 without the fix
of [1]. Now, the adapted test fails on version 16.3 without the fix of
[1].

[1]: odoo@0fd2477

task-3717041

closes odoo#153014

Signed-off-by: Quentin Smetz (qsm) <[email protected]>
  • Loading branch information
loco-odoo committed Mar 5, 2024
1 parent 78fe165 commit 23fc59c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion addons/website/static/tests/tours/snippet_image_gallery.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,20 @@ tour.register("snippet_image_gallery", {
}, {
content: "Click on move to next",
trigger: ".snippet-option-gallery_img we-button[data-position='next']",
}, {
content: "Check that the image has been moved",
trigger: ".s_image_gallery .carousel-item.active img[data-index='1']",
run: () => null, // This is a check.
}, {
content: "Click on the footer to reload the editor panel",
trigger: "#footer",
}, {
content: "Check that the footer options have been loaded",
trigger: ".snippet-option-HideFooter we-button:contains('Page Visibility')",
run: () => null, // This is a check.
}, {
content: "Click on the moved image",
trigger: "#wrap .s_image_gallery .carousel-item.active img[data-index='1']",
trigger: "#wrap .s_image_gallery .carousel-item.active img[data-index='1'][data-gl-filter='blur']",
}, {
content: "Check that the image still has the correct filter",
trigger: ".snippet-option-ImageOptimize we-select:contains('Filter') we-toggler:contains('Blur')",
Expand Down

0 comments on commit 23fc59c

Please sign in to comment.