Upstream sync

This commit is contained in:
Senad Uka
2020-08-31 18:19:00 +02:00
parent 896cec2259
commit 95a14ab2f6
37 changed files with 487 additions and 375 deletions

View File

@@ -56,14 +56,13 @@ feature 'User managing broadcasts' do
visit project_broadcast_path(project, broadcast)
expect(page).to have_content('Live stream is waiting to begin.')
expect(page).to have_content('Copy URL')
expect(page).to have_content('Share URL')
within '#files' do
expect(page).to have_content('contract.pdf')
end
click_on "Files"
expect(page).to have_content('contract.pdf')
click_on 'Previous Sessions'
expect(page).to have_content(recording.download_file_name)
click_on 'Takes'
expect(page).to have_content(recording.name)
end
scenario 'Clicking Reset URL regenerates broadcast token' do
@@ -73,93 +72,19 @@ feature 'User managing broadcasts' do
visit project_broadcast_path(project, broadcast)
expect(page).to have_content reset_url
expect(page).to have_xpath "//input[@readonly][@value='#{broadcast_url(old_token)}']"
click_link reset_url
expect(Broadcast.last.token).not_to eq old_token
expect(page).to have_xpath "//input[@readonly][@value='#{broadcast_url(Broadcast.last.token)}']"
expect(page).to have_content token_reset_notice
end
scenario 'Player will not reload if stream is reactivated while user is watching previous recording', js: true do
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
recording = create(:broadcast_recording, broadcast: broadcast)
visit project_broadcast_path(project, broadcast)
expect(page).to have_content stream_idle_message
broadcast.streamer_status = :recording
broadcast.status = :active
BroadcastsChannel.broadcast_stream_updates(broadcast)
expect(page).to have_content stream_begun_message
expect(page).to have_selector('div#broadcast_video', count: 2)
broadcast.streamer_status = :idle
broadcast.status = :idle
BroadcastsChannel.broadcast_stream_updates(broadcast)
click_on switch_view_dropdown
click_on recording.download_file_name
expect(page).to have_content stream_idle_message
expect(page).to have_selector('div#broadcast_video', count: 1)
broadcast.streamer_status = :recording
broadcast.status = :active
BroadcastsChannel.broadcast_stream_updates(broadcast)
expect(page).to have_content stream_begun_message
expect(page).to have_selector('div#broadcast_video', count: 1)
end
scenario 'user can go back and forth between live session and previous sessions', js: true do
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
recording = create(:broadcast_recording, broadcast: broadcast)
visit project_broadcast_path(project, broadcast)
expect(page).to have_content broadcast.name.titleize, count: 1
expect(page).to have_content recording.download_file_name, count: 0
click_on switch_view_dropdown
expect(page).to have_content broadcast.name.titleize, count: 2
expect(page).to have_content recording.download_file_name, count: 1
live_stream_nav_item = page.find('.dropdown-item', text: broadcast.name.titleize)
recording_nav_item = page.find('.dropdown-item', text: recording.download_file_name)
expect(live_stream_nav_item[:class].include?('active')).to eq true
expect(recording_nav_item[:class].include?('active')).to eq false
click_on recording.download_file_name
expect(page).to have_content broadcast.name.titleize, count: 1
expect(page).to have_content recording.download_file_name, count: 0
expect(live_stream_nav_item[:class].include?('active')).to eq false
expect(recording_nav_item[:class].include?('active')).to eq true
click_on switch_view_dropdown
click_on broadcast.name.titleize
expect(page).to have_content broadcast.name.titleize, count: 1
expect(page).to have_content recording.download_file_name, count: 0
# Page is reloaded, we need to get dropdown items again
live_stream_nav_item = page.find('.dropdown-item', text: broadcast.name.titleize, visible: :all)
recording_nav_item = page.find('.dropdown-item', text: recording.download_file_name, visible: :all)
expect(live_stream_nav_item[:class].include?('active')).to eq true
expect(recording_nav_item[:class].include?('active')).to eq false
end
scenario 'form will not submit if user clicks Add files without selected files', js: true do
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
visit project_broadcast_path(project, broadcast)
expect(page).to have_content('Live stream is waiting to begin.')
click_on "Files"
expect(page).to have_content add_file_button
click_on add_file_button
@@ -169,7 +94,7 @@ feature 'User managing broadcasts' do
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
visit project_broadcast_path(project, broadcast)
click_on "Files"
expect(page).to have_content delete_file_button, count: 3
accept_alert do
@@ -189,9 +114,11 @@ feature 'User managing broadcasts' do
new_window = window_opened_by { click_link 'Multi-View' }
within_window new_window do
expect(page).to have_content switch_view_dropdown
click_on switch_view_dropdown
click_on "Files"
expect(page).to have_content broadcast_one.name
expect(page).to have_content broadcast_two.name
click_on broadcast_one.name
expect(page).to have_link('Broadcast 1')
expect(page).to have_link('Broadcast 2')
@@ -205,24 +132,6 @@ feature 'User managing broadcasts' do
end
end
scenario 'project manager can hide broadcast recordings', js: true do
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
recording = create(:broadcast_recording, broadcast: broadcast, asset_uid: "another_asset_uid")
visit project_broadcast_path(project, broadcast)
click_on 'Previous Sessions'
expect(page).to have_content(recording.download_file_name)
expect(page).to have_content('Hide')
accept_alert do
click_link "Hide"
end
expect(page).not_to have_content(recording.download_file_name)
expect(page).to have_content("Recording of the live stream will appear here")
end
context 'When the user is associate' do
let(:current_user) { create(:user, :associate) }
@@ -240,17 +149,6 @@ feature 'User managing broadcasts' do
expect(page).to have_content delete_file_button, count: 0
end
scenario 'associate does not see hide button in front of recording' do
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
recording = create(:broadcast_recording, broadcast: broadcast, asset_uid: "another_asset_uid")
visit project_broadcast_path(project, broadcast)
click_on 'Previous Sessions'
expect(page).to have_content(recording.download_file_name)
expect(page).not_to have_content('Hide')
end
end
context 'When the user is account manager' do
@@ -267,7 +165,7 @@ feature 'User managing broadcasts' do
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
visit project_broadcast_path(project, broadcast)
click_on "Files"
expect(page).to have_content delete_file_button, count: 3
accept_alert do
@@ -277,26 +175,7 @@ feature 'User managing broadcasts' do
expect(page).to have_content delete_file_button, count: 2
expect(Broadcast.find(broadcast.id).files.count).to eq 2
end
scenario 'account manager can hide broadcast recordings', js: true do
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
recording = create(:broadcast_recording, broadcast: broadcast, asset_uid: "another_asset_uid")
visit project_broadcast_path(project, broadcast)
click_on 'Previous Sessions'
expect(page).to have_content(recording.download_file_name)
expect(page).to have_content('Hide')
accept_alert do
click_link "Hide"
end
expect(page).not_to have_content(recording.download_file_name)
expect(page).to have_content("Recording of the live stream will appear here")
end
end
end
private
@@ -320,10 +199,6 @@ feature 'User managing broadcasts' do
all('input[type="checkbox"]')[1].click
end
def switch_view_dropdown
'Switch View'
end
def schedule_demo
t 'broadcasts.splash.actions.book_demo'
end