Skip to content

Fix issues with sidebar related specs

Hannes Moser requested to merge fix-sidebar-specs into master

What does this MR do and why?

Two specs were failing CI for this draft MR !92925 (closed). This MR aims to fix the underlying issues.

Click position issue

The first issue (click position) is due to the click position of the mouse cursor being on top of the Unassigned button, when .js-sidebar-right receives a click event. It unintentionally clicks Unassigned due to the event bubbling up from the DOM tree. This did not fail previously, because the widget was positioned further up the y-axis. Being explicit about the intended click area (outside the dropdown) should prevent any future problems with this spec, even if there are widgets added/removed.

Screen_Shot_2022-08-09_at_13.23.10

within '.js-right-sidebar' do
  # make sure to click on the title of the "Assignee" widget,
  # because it is always outside the boundary box of the dropdown
  find('.block.assignee').click(x: 0, y: 0)
  find('.block.assignee .edit-link').click
end

Timing issue

This spec has a flow issue. It assumes there is a single .gl-label present in the context area. But this is not guaranteed, and the spec can fail in cases where the removal of the label does not happen before the new label gets added. In case two labels are present, the spec fails, because the .gl-albel selector is too generous, and collects both labels. The click is ambiguous and cannot be executed. The fix is to be explicit about the label that should be removed.

# might fail
within '.gl-label'
  click_button 'Remove label'
end

# succeeds
within '.gl-label', text: 'verisimilitude' do
  click_button 'Remove label'
end

How to set up and validate locally

You can check out the branch for this MR and revert the changes made to the specs to see them failing eventually.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Hannes Moser

Merge request reports