Initial commit
This commit is contained in:
83
spec/features/user_managing_broadcasts_spec.rb
Normal file
83
spec/features/user_managing_broadcasts_spec.rb
Normal file
@@ -0,0 +1,83 @@
|
||||
require "rails_helper"
|
||||
|
||||
feature "User managing broadcasts" do
|
||||
let(:current_user) { create(:user, :manager) }
|
||||
let(:project) { create(:project, members: current_user, account: current_user.primary_account) }
|
||||
|
||||
context "managing broadcasts" do
|
||||
before do
|
||||
sign_in current_user
|
||||
allow(MuxLiveStream).to receive(:new).and_return(double(id: "id", key: "key", playback_id: "playback_id"))
|
||||
end
|
||||
|
||||
scenario "creating and deleting a broadcast", js: true do
|
||||
visit new_project_broadcast_path(project)
|
||||
|
||||
by "filling out the form" do
|
||||
fill_in broadcast_name_field, with: "My Broadcast"
|
||||
end
|
||||
|
||||
click_button "Create Live Stream"
|
||||
expect(page).to have_content("A live stream has been created")
|
||||
click_on "Manage"
|
||||
expect(page).to have_link("Copy Stream URL", exact: true)
|
||||
expect(page).to have_link("Copy Stream Key", exact: true)
|
||||
expect(page).to have_link("View", exact: true)
|
||||
expect(page).to have_link("Delete", exact: true)
|
||||
|
||||
it_also "Deletes the broadcast" do
|
||||
allow_any_instance_of(Broadcast).to receive(:destroy_mux_live_stream).and_return(true)
|
||||
|
||||
accept_alert do
|
||||
click_link "Delete"
|
||||
end
|
||||
|
||||
expect(page).to have_content("A live stream has been deleted")
|
||||
expect(page).not_to have_content("My Broadcast")
|
||||
end
|
||||
end
|
||||
|
||||
scenario "visit show page of broadcast", 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("Live stream is waiting to begin.")
|
||||
expect(page).to have_content("Copy URL")
|
||||
|
||||
click_on "Files"
|
||||
expect(page).to have_content("contract.pdf")
|
||||
|
||||
click_on "Previous Sessions"
|
||||
expect(page).to have_content(recording.download_file_name)
|
||||
end
|
||||
|
||||
scenario "visit multi-view broadcast page", js: true do
|
||||
broadcasts = create_list(:broadcast, 4, :with_stream, project: project)
|
||||
|
||||
visit project_broadcasts_path(project)
|
||||
click_checkboxes
|
||||
|
||||
new_window = window_opened_by { click_link "Multi-View" }
|
||||
within_window new_window do
|
||||
expect(page).to have_content("Switch View")
|
||||
|
||||
click_on "Switch View"
|
||||
expect(page).to have_link(broadcasts.first.name)
|
||||
expect(page).to have_link(broadcasts.second.name)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def broadcast_name_field
|
||||
"broadcast[name]"
|
||||
end
|
||||
|
||||
def click_checkboxes
|
||||
all('input[type="checkbox"]')[1].click
|
||||
all('input[type="checkbox"]')[2].click
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user