2013-11-25 21:56:54 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
|
|
describe "Musician Search", :js => true, :type => :feature, :capybara_feature => true do
|
|
|
|
|
|
|
|
|
|
subject { page }
|
|
|
|
|
|
2014-08-20 01:58:24 +00:00
|
|
|
let(:austin) { austin_geoip }
|
|
|
|
|
let(:dallas) { dallas_geoip }
|
2013-11-25 21:56:54 +00:00
|
|
|
|
2014-09-22 19:20:58 +00:00
|
|
|
let(:austin_user) { FactoryGirl.create(:austin_user) }
|
|
|
|
|
let(:dallas_user) { FactoryGirl.create(:dallas_user) }
|
|
|
|
|
let(:miami_user) { FactoryGirl.create(:miami_user) }
|
|
|
|
|
let(:seattle_user) { FactoryGirl.create(:seattle_user) }
|
2014-05-30 16:34:06 +00:00
|
|
|
|
2014-08-20 01:58:24 +00:00
|
|
|
before(:each) do
|
|
|
|
|
MaxMindManager.create_phony_database
|
2014-09-22 19:20:58 +00:00
|
|
|
User.delete_all
|
|
|
|
|
austin_user.touch
|
|
|
|
|
dallas_user.touch
|
2014-09-30 15:51:23 +00:00
|
|
|
|
2014-05-30 16:34:06 +00:00
|
|
|
Score.delete_all
|
2014-09-30 15:51:23 +00:00
|
|
|
Score.connection.execute('delete from current_network_scores').check
|
|
|
|
|
|
2014-08-20 01:58:24 +00:00
|
|
|
Score.createx(austin_geoip[:locidispid], 'a', 1, dallas_geoip[:locidispid], 'a', 1, 10)
|
2014-05-30 16:34:06 +00:00
|
|
|
|
2014-09-22 19:20:58 +00:00
|
|
|
fast_signin(austin_user, "/client#/musicians")
|
2014-03-09 06:22:51 +00:00
|
|
|
end
|
|
|
|
|
|
2013-11-25 21:56:54 +00:00
|
|
|
it "shows the musician search page" do
|
|
|
|
|
expect(page).to have_selector('#find-musician-form')
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it "shows search results" do
|
|
|
|
|
expect(page).to have_selector('#musician-filter-results .musician-list-result')
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it "shows submits query" do
|
|
|
|
|
expect(page).to have_selector('#musician-filter-results .musician-list-result')
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it "shows blank result set" do
|
2014-02-19 22:56:13 +00:00
|
|
|
pending "fails intermittently on build server"
|
|
|
|
|
|
2014-02-10 22:43:09 +00:00
|
|
|
wait_for_easydropdown('#musician_instrument')
|
|
|
|
|
# get the 2nd option from the instruments list
|
|
|
|
|
text = find('#musician_instrument', :visible => false).find(:xpath, 'option[2]', :visible => false).text
|
|
|
|
|
# and select it
|
|
|
|
|
jk_select(text, '#musician_instrument')
|
2013-11-25 21:56:54 +00:00
|
|
|
expect(page).to_not have_selector('#musician-filter-results .musician-list-result')
|
|
|
|
|
end
|
|
|
|
|
|
2014-08-20 01:58:24 +00:00
|
|
|
it "shows latency information correctly" do
|
|
|
|
|
# this will try to show 5 latency badges. unknown, good, fair, poor, unacceptable. 'me' does not happen on this screen
|
2014-09-22 19:20:58 +00:00
|
|
|
austin_user.last_jam_locidispid = austin[:locidispid]
|
|
|
|
|
austin_user.save!
|
|
|
|
|
|
|
|
|
|
verify_find_musician_score(nil, austin_user, dallas_user)
|
|
|
|
|
verify_find_musician_score(3, austin_user, dallas_user)
|
|
|
|
|
verify_find_musician_score(40, austin_user, dallas_user)
|
|
|
|
|
verify_find_musician_score(80, austin_user, dallas_user)
|
|
|
|
|
verify_find_musician_score(110, austin_user, dallas_user)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it "shows search by distance" do
|
|
|
|
|
|
|
|
|
|
# this test does a distance search with the austin user, then opens up the 'change search location' dialog,
|
|
|
|
|
# and changes the search distance
|
|
|
|
|
|
|
|
|
|
miami_user.touch # no scores, but should still show
|
|
|
|
|
seattle_user.touch # no scores, but should still show
|
|
|
|
|
|
|
|
|
|
wait_for_easydropdown('#musician_order_by')
|
|
|
|
|
jk_select('Distance', '#musician_order_by')
|
|
|
|
|
|
|
|
|
|
find(".musician-list-result[data-musician-id='#{dallas_user.id}']:nth-child(1)") # only dallas is within range
|
|
|
|
|
|
|
|
|
|
find('#musician-change-filter-city').trigger(:click)
|
|
|
|
|
|
|
|
|
|
find('h1', text: 'change search location') # dialog should be showing
|
|
|
|
|
|
|
|
|
|
# wait for it to finish populating
|
|
|
|
|
wait_for_easydropdown('#change-search-location-dialog select[name="country"]')
|
|
|
|
|
wait_for_easydropdown('#change-search-location-dialog select[name="region"]')
|
|
|
|
|
wait_for_easydropdown('#change-search-location-dialog select[name="city"]')
|
|
|
|
|
|
|
|
|
|
jk_select('FL', '#change-search-location-dialog select[name="region"]') # this should be 'Florida', but our test data
|
|
|
|
|
# wait for the city to not be disabled as it reloads
|
|
|
|
|
expect(page).to_not have_selector('#change-search-location-dialog .field[purpose="city"] .easydropdown-wrapper.disabled')
|
|
|
|
|
jk_select('Miami', '#change-search-location-dialog select[name="city"]')
|
|
|
|
|
find('#change-search-location-dialog .btnSave').trigger(:click)
|
|
|
|
|
find('#musician-filter-city', text: "Miami, FL")
|
|
|
|
|
|
|
|
|
|
find(".musician-list-result[data-musician-id='#{miami_user.id}']:nth-child(1)") # only miami is within range
|
|
|
|
|
|
2014-08-20 01:58:24 +00:00
|
|
|
end
|
2014-09-22 19:20:58 +00:00
|
|
|
|
2013-11-25 21:56:54 +00:00
|
|
|
end
|