wip - find sessions latency badge
This commit is contained in:
parent
fc624115b5
commit
4b1fb8b1ed
|
|
@ -0,0 +1,67 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe "Find session latency badge", js: true, type: :feature, capybara_feature: true do
|
||||
let(:creator_user){ FactoryGirl.create(:user) }
|
||||
let(:joiner_user){ FactoryGirl.create(:user) }
|
||||
let(:finder_user){ FactoryGirl.create(:user) }
|
||||
let(:latency_data_uri) { /\S+\/user_latencies/ }
|
||||
|
||||
|
||||
def create_and_join_session(creator_user, joiner_user)
|
||||
in_client(creator_user) do
|
||||
fast_signin(creator_user, "/client#/createSession")
|
||||
wait_until_curtain_gone
|
||||
find("h1", text: "session")
|
||||
find(".quick-start-open").click
|
||||
end
|
||||
|
||||
in_client(joiner_user) do
|
||||
fast_signin(joiner_user, "/client#/findSession")
|
||||
wait_until_curtain_gone
|
||||
find("h1", text: "find a session")
|
||||
find("a", text: "Open Jams").click
|
||||
expect(page).to have_selector("#sessions-active .found-session", count: 1)
|
||||
find("#sessions-active .found-session .join-link").click
|
||||
find("#session-terms-conditions")
|
||||
within("#session-terms-conditions") do
|
||||
find("#btn-accept-terms").click
|
||||
end
|
||||
find("h1", text: "session")
|
||||
end
|
||||
end
|
||||
|
||||
before(:all) do
|
||||
Capybara.default_max_wait_time = 10
|
||||
end
|
||||
|
||||
describe "public session" do
|
||||
|
||||
before(:each) do
|
||||
emulate_client
|
||||
ActiveMusicSession.delete_all
|
||||
create_and_join_session(creator_user, joiner_user)
|
||||
end
|
||||
|
||||
|
||||
it "finds session" do
|
||||
in_client(finder_user) do
|
||||
response_body = mock_latency_response([{ user: user2, ars_total_latency: 1.0, ars_internet_latency: 0.5, audio_latency: 0.5 }]) #sessionUtils.LATENCY.GOOD : {description: "GOOD", style: "latency-good", min: 0.0, max: 40.0},
|
||||
|
||||
stub_request(:post, latency_data_uri)
|
||||
.with(:headers => {'Accept'=>'*/*', 'Content-Type'=>'application/json', 'User-Agent'=>'Ruby'})
|
||||
.to_return( body: response_body, status: 200)
|
||||
|
||||
fast_signin(finder_user, "/client#/findSession")
|
||||
wait_until_curtain_gone
|
||||
find("h1", text: "find a session")
|
||||
find("a", text: "Open Jams").click
|
||||
expect(page).to have_selector("#sessions-active .found-session table.musicians-category tr", count: 2)
|
||||
|
||||
find("#sessions-active a[data-user-id=\"#{creator_user.id}\"][data-hoveraction=\"musician\"]", text: creator_user.name).hover_intent
|
||||
find('h3', text: creator_user.name)
|
||||
find("#musician-latency-badge .latency", text: 'GOOD')
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
@ -523,10 +523,9 @@ end
|
|||
|
||||
def emulate_client
|
||||
#page.driver.headers = { 'User-Agent' => ' JamKazam ' }
|
||||
#page.driver.header 'User-Agent', 'JamKazam'
|
||||
#page.driver.options[:headers].merge!({ 'User-Agent' => ' JamKazam ' })
|
||||
#Capybara.current_session.driver.header('User-Agent', 'JamKazam')
|
||||
# page.driver.browser.header('User-Agent', ' JamKazam ')
|
||||
#Rails.application.config.allow_force_native_client = true
|
||||
#create_cookie(:act_as_native_client, "true")
|
||||
allow_any_instance_of(ClientHelper).to receive(:is_native_client?).and_return(true)
|
||||
end
|
||||
|
||||
def create_join_session(creator, joiners=[], options={})
|
||||
|
|
|
|||
Loading…
Reference in New Issue