Skip to content

Commit c3fd835

Browse files
committed
Assert on HTML in order to wait the action response
Assering only on DB record value would randomly fail.
1 parent 923146f commit c3fd835

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

app/views/staff/program_sessions/_session_row_active.html.haml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
%tr{ data: { 'emails' => speakers_emails(program_session) } }
1+
%tr{ id: dom_id(program_session.object), data: { 'emails' => speakers_emails(program_session) } }
22
%td= link_to(program_session.title,
33
event_staff_program_session_path(program_session.event, program_session))
44
%td= program_session.speakers.map { |speaker| link_to speaker.name, event_staff_program_speaker_path(program_session.event, speaker) }.join(", ").html_safe

spec/system/staff/organizer_manages_program_session_spec.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,18 @@
1818

1919
scenario "from program session index", js: true do
2020
visit event_staff_program_sessions_path(event)
21+
within("##{ActionView::RecordIdentifier.dom_id(waitlisted_session)}") do
22+
expect(page).to have_content ProgramSession::CONFIRMED_WAITLISTED.upcase
23+
end
24+
2125
page.accept_confirm do
2226
page.find('#waitlist').click
2327
find('tr', text: waitlisted_session.title).click_link("Promote")
2428
end
2529

30+
within("##{ActionView::RecordIdentifier.dom_id(waitlisted_session)}") do
31+
expect(page).to have_content ProgramSession::LIVE.upcase
32+
end
2633
expect(page).to_not have_css(".alert-danger")
2734
expect(waitlisted_session.reload.state).to eq(ProgramSession::LIVE)
2835
end
@@ -46,10 +53,17 @@
4653

4754
scenario "from program session index", js: true do
4855
visit event_staff_program_sessions_path(event)
56+
within("##{ActionView::RecordIdentifier.dom_id(draft_session)}") do
57+
expect(page).to have_content ProgramSession::DRAFT.upcase
58+
end
59+
4960
page.accept_confirm do
5061
find('tr', text: draft_session.title).click_link("Promote")
5162
end
5263

64+
within("##{ActionView::RecordIdentifier.dom_id(draft_session)}") do
65+
expect(page).to have_content ProgramSession::LIVE.upcase
66+
end
5367
expect(page).to_not have_css(".alert-danger")
5468
expect(draft_session.reload.state).to eq(ProgramSession::LIVE)
5569
end

0 commit comments

Comments
 (0)