diff --git a/db/up/new_genres.sql b/db/up/new_genres.sql index 56b2badd7..3f877c481 100644 --- a/db/up/new_genres.sql +++ b/db/up/new_genres.sql @@ -7,7 +7,7 @@ insert into genres(id, description) values ('downtempo', 'Downtempo'); insert into genres(id, description) values ('drum & bass', 'Drum & Bass'); insert into genres(id, description) values ('house', 'House'); insert into genres(id, description) values ('industrial', 'Industrial'); -insert into genres(id, description) values ('punk', 'punk'); +insert into genres(id, description) values ('punk', 'Punk'); insert into genres(id, description) values ('psychedelic', 'Psychedelic'); insert into genres(id, description) values ('techno', 'Techno'); insert into genres(id, description) values ('trance', 'Trance'); \ No newline at end of file diff --git a/monitor/spec/production_spec.rb b/monitor/spec/production_spec.rb index 7094adc23..4610f3dd7 100755 --- a/monitor/spec/production_spec.rb +++ b/monitor/spec/production_spec.rb @@ -41,27 +41,27 @@ describe "Deployed site at #{www}", :js => true, :type => :feature, :capybara_fe # use staging accounts user1 = TestUser.new({ email: 'anthony+jim@jamkazam.com', password: 'j4m!t3st3r', first_name: 'Jim', last_name: 'Smith', id: '43fb60a7-7b6a-4aa6-af3c-59b1e58a842b' }) user2 = TestUser.new({ email: 'anthony+john@jamkazam.com', password: 'j4m!t3st3r', first_name: 'John', last_name: 'Jones', id: '54c5d5c1-aa44-4db8-9bac-922ead64162e' }) + user3 = TestUser.new({ email: 'anthony+jesse@jamkazam.com', password: 'j4m!t3st3r', first_name: 'Jesse', last_name: 'Smith', id: '8208b467-ef59-4601-a4e1-1198180ffe82' }) else # use production accounts user1 = TestUser.new({ email: 'anthony+jim@jamkazam.com', password: 'j4m!t3st3r', first_name: 'Jim', last_name: 'Smith', id: '68e8eea2-140d-44c1-b711-10d07ce70f96' }) user2 = TestUser.new({ email: 'anthony+john@jamkazam.com', password: 'j4m!t3st3r', first_name: 'John', last_name: 'Jones', id: '5bbcf689-2f73-452d-815a-c4f44e9e7f3e' }) + user3 = TestUser.new({ email: 'anthony+jesse@jamkazam.com', password: 'j4m!t3st3r', first_name: 'Jesse', last_name: 'Smith', id: 'e8342f87-04ac-432f-8af4-abf485fddb9e' }) end - it "is possible for #{user1} to sign in and not get disconnected within 30 seconds" do - in_client(user1) do - puts "\n *** #{user1}'s client *** \n" - sign_in_poltergeist user1 + it "is possible for #{user3} to sign in and not get disconnected within 30 seconds" do + as_monitor(user3) do + sign_in_poltergeist(user3) repeat_for(30.seconds) do expect(page).to_not have_selector('.no-websocket-connection') #looks for reconnect dialog every 1 second end end end - it "is possible for #{user1} and #{user2} to see each other online, and to send messages" do + it "is possible for #{user1} to see and to send a message to #{user2}" do # this example heavily based on text_message_spec.rb in 'web' - in_client(user1) do - puts "\n *** #{user1}'s client *** \n" + as_monitor(user1) do sign_in_poltergeist(user1) end @@ -69,8 +69,7 @@ describe "Deployed site at #{www}", :js => true, :type => :feature, :capybara_fe test_response = "#{SecureRandom.uuid} - Hey yourself, #{user2}!" test_goodbye = "#{SecureRandom.uuid} - OK bye!" - in_client(user2) do - puts "\n *** #{user2}'s client *** \n" + as_monitor(user2) do sign_in_poltergeist(user2) expect(page).to have_xpath( "//div[@class='friend-name' and @user-id='#{user1.id}']/span[@class='friend-status']", @@ -80,28 +79,23 @@ describe "Deployed site at #{www}", :js => true, :type => :feature, :capybara_fe find("#search-results a[user-id=\"#{user1.id}\"][hoveraction=\"musician\"]", text: user1.name).hover_intent find('#musician-hover #btnMessage').trigger(:click) find('h1', text: 'conversation with ' + user1.name) - send_text_message(test_message) + send_text_message(test_message, close_on_send: true) end - in_client(user1) do - puts "\n *** #{user1}'s client *** \n" + as_monitor(user1) do expect(page).to have_xpath( "//div[@class='friend-name' and @user-id='#{user2.id}']/span[@class='friend-status']", :text => "Available" ) find('#notification #btn-reply').trigger(:click) find('h1', text: 'conversation with ' + user2.name) find('.previous-message-text', text: test_message) - send_text_message(test_response, close_on_send: true) + find('#text-message-dialog .btn-close-dialog', text: 'CLOSE').trigger(:click) + sign_out_poltergeist(validate: true) end - in_client(user2) do - puts "\n *** #{user2}'s client *** \n" - find('.previous-message-text', text: test_response) - send_text_message(test_goodbye, close_on_send: true) + as_monitor(user2) do + sign_out_poltergeist(validate: true) end - - in_client(user1) { puts "\n *** #{user1}'s client *** \n"; sign_out_poltergeist } - in_client(user2) { puts "\n *** #{user2}'s client *** \n"; sign_out_poltergeist } end let(:queue_limit) { 5 } diff --git a/monitor/spec/support/utilities.rb b/monitor/spec/support/utilities.rb index 9003be855..be0e32722 100755 --- a/monitor/spec/support/utilities.rb +++ b/monitor/spec/support/utilities.rb @@ -49,6 +49,13 @@ def in_client(name) yield end +def as_monitor(name) + session_name = name.class == JamRuby::User ? name.id : name + Capybara.session_name = mapped_session_name(session_name) + page.driver.headers = { 'User-Agent' => 'monitor' } + puts "\n[monitor] #{name}'s client *** \n" + yield +end def cookie_jar Capybara.current_session.driver.browser.current_session.instance_variable_get(:@rack_mock_session).cookie_jar @@ -169,8 +176,10 @@ def wait_to_see_my_track end def repeat_for(duration=Capybara.default_wait_time) + puts "Running for #{duration} seconds..." finish_time = Time.now + duration.seconds loop do + print "#{(Time.now - finish_time + duration.seconds).round(3)}s, " yield sleep 1 # by default this will execute the block every 1 second break if (Time.now > finish_time) diff --git a/web/app/controllers/api_genres_controller.rb b/web/app/controllers/api_genres_controller.rb index 43dac8740..c413bf1f2 100644 --- a/web/app/controllers/api_genres_controller.rb +++ b/web/app/controllers/api_genres_controller.rb @@ -6,7 +6,7 @@ class ApiGenresController < ApiController respond_to :json def index - @genres = Genre.find(:all) + @genres = Genre.order(:description) end def show