Skip to content

Commit f7c342d

Browse files
committed
Refactor spec
1 parent 4b78f2b commit f7c342d

File tree

2 files changed

+9
-18
lines changed

2 files changed

+9
-18
lines changed

modules/meeting/spec/features/structured_meetings/structured_meeting_crud_spec.rb

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -524,32 +524,19 @@
524524
show_page.expect_section(title: "Section B")
525525
show_page.expect_section(title: "Section C")
526526

527-
initial_positions = [section1, section2, section3].map(&:position)
528-
expect(initial_positions).to eq([1, 2, 3])
529-
530527
show_page.select_section_action(section3, "Move up")
531528

532529
wait_for_network_idle
533530

534531
expect([section1, section2, section3].map { |s| s.reload.position }).to eq([1, 3, 2])
535532

536-
sections = page.all(".op-meeting-section-container").select do |section|
537-
section["data-test-selector"]&.start_with?("meeting-section-container-") &&
538-
!section["data-test-selector"]&.include?("header")
539-
end
540-
expect(sections[0]).to have_content("Section A")
541-
expect(sections[1]).to have_content("Section C")
542-
expect(sections[2]).to have_content("Section B")
533+
expect(show_page.section_headers)
534+
.to eq(["Section A", "Section C", "Section B"])
543535

544-
show_page.visit!
536+
show_page.reload!
545537

546-
sections_after_refresh = page.all(".op-meeting-section-container").select do |section|
547-
section["data-test-selector"]&.start_with?("meeting-section-container-") &&
548-
!section["data-test-selector"]&.include?("header")
549-
end
550-
expect(sections_after_refresh[0]).to have_content("Section A")
551-
expect(sections_after_refresh[1]).to have_content("Section C")
552-
expect(sections_after_refresh[2]).to have_content("Section B")
538+
expect(show_page.section_headers)
539+
.to eq(["Section A", "Section C", "Section B"])
553540
end
554541
end
555542
end

modules/meeting/spec/support/pages/meetings/show.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,5 +766,9 @@ def wait_for_reference_changed(old_reference_value)
766766
element["data-reference-value"] != old_reference_value
767767
end
768768
end
769+
770+
def section_headers
771+
page.all(".op-meeting-section-container[data-test-selector^='meeting-section-header-container-']").map(&:text)
772+
end
769773
end
770774
end

0 commit comments

Comments
 (0)