Skip to content

Conversation

@mrmir
Copy link
Contributor

@mrmir mrmir commented Jan 8, 2026

Ticket

https://community.openproject.org/wp/70336

What approach did you choose and why?

I think the bug is related to rails/rails#6769, where the :includes is messing up the default ordering, and so using :preload instead fixes the issue

However, I don't understand it fully and this might just be a band aid fix

Merge checklist

  • Added/updated tests

Copy link
Member

@cbliard cbliard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took me some time to figure it out but works well 👏

I have some suggestions about the test to make it more expressive.

Comment on lines 536 to 539
sections = page.all(".op-meeting-section-container").select do |section|
section["data-test-selector"]&.start_with?("meeting-section-container-") &&
!section["data-test-selector"]&.include?("header")
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As it's used twice in the test, I would put this into show_page as an helper.

Also, I think it can select only the header element, so it's start_with?("meeting-section-header-container-")

And the condition can be expressed using css with [attr^='value'] which means "starts with".

it becomes:

sections = page.all(".op-meeting-section-container[data-test-selector^='meeting-section-header-container-']")

once you have extracted this into a #section_headers, you can then write the assertions like this:

expect(show_page.section_headers.map(&:text))
  .to eq(["Section A",
          "Section C",
          "Section B"])

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may also be better to have show_page.section_headers return text directly. Actually I think anything returning capybara object should be suffixed with element, so if it returns the capybara objects, it should be show_page.section_header_elements.

Yep, probably better to have show_page.section_headers return text directly. If someone needs the elements at some point, they can refactor.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, thanks for the feedback 👍🏽

@mrmir
Copy link
Contributor Author

mrmir commented Jan 9, 2026

Merging as the spec is flaky, but is passing locally

@mrmir mrmir merged commit 75c8e6d into release/17.0 Jan 9, 2026
16 of 17 checks passed
@mrmir mrmir deleted the bug/fix-incorrect-meeting-section-ordering branch January 9, 2026 07:36
@github-actions github-actions bot locked and limited conversation to collaborators Jan 9, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants