From 54d31a2b34100993d208b41025570600b6a0efc0 Mon Sep 17 00:00:00 2001 From: Anthony Davis Date: Thu, 11 Sep 2014 12:39:36 -0500 Subject: [PATCH 01/12] VRFS-2001 - user-agent header was not set when switching Capybara sessions --- monitor/spec/production_spec.rb | 14 +++++++------- monitor/spec/support/utilities.rb | 6 ++++++ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/monitor/spec/production_spec.rb b/monitor/spec/production_spec.rb index 7094adc23..4a129836e 100755 --- a/monitor/spec/production_spec.rb +++ b/monitor/spec/production_spec.rb @@ -48,7 +48,7 @@ describe "Deployed site at #{www}", :js => true, :type => :feature, :capybara_fe end it "is possible for #{user1} to sign in and not get disconnected within 30 seconds" do - in_client(user1) do + as_monitor(user1) do puts "\n *** #{user1}'s client *** \n" sign_in_poltergeist user1 repeat_for(30.seconds) do @@ -60,7 +60,7 @@ describe "Deployed site at #{www}", :js => true, :type => :feature, :capybara_fe it "is possible for #{user1} and #{user2} to see each other online, and to send messages" do # this example heavily based on text_message_spec.rb in 'web' - in_client(user1) do + as_monitor(user1) do puts "\n *** #{user1}'s client *** \n" sign_in_poltergeist(user1) end @@ -69,7 +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 + as_monitor(user2) do puts "\n *** #{user2}'s client *** \n" sign_in_poltergeist(user2) expect(page).to have_xpath( @@ -83,7 +83,7 @@ describe "Deployed site at #{www}", :js => true, :type => :feature, :capybara_fe send_text_message(test_message) end - in_client(user1) do + as_monitor(user1) do puts "\n *** #{user1}'s client *** \n" expect(page).to have_xpath( "//div[@class='friend-name' and @user-id='#{user2.id}']/span[@class='friend-status']", @@ -94,14 +94,14 @@ describe "Deployed site at #{www}", :js => true, :type => :feature, :capybara_fe send_text_message(test_response, close_on_send: true) end - in_client(user2) do + as_monitor(user2) do puts "\n *** #{user2}'s client *** \n" find('.previous-message-text', text: test_response) send_text_message(test_goodbye, close_on_send: 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 } + as_monitor(user1) { puts "\n *** #{user1}'s client *** \n"; sign_out_poltergeist } + as_monitor(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..c350e80b0 100755 --- a/monitor/spec/support/utilities.rb +++ b/monitor/spec/support/utilities.rb @@ -49,6 +49,12 @@ 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' } + yield +end def cookie_jar Capybara.current_session.driver.browser.current_session.instance_variable_get(:@rack_mock_session).cookie_jar From 446108e9f40049602f3b88f565662672d0c0ef31 Mon Sep 17 00:00:00 2001 From: Anthony Davis Date: Thu, 11 Sep 2014 13:29:41 -0500 Subject: [PATCH 02/12] VRFS-2001 - making test less fail-prone --- monitor/spec/production_spec.rb | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/monitor/spec/production_spec.rb b/monitor/spec/production_spec.rb index 4a129836e..829533390 100755 --- a/monitor/spec/production_spec.rb +++ b/monitor/spec/production_spec.rb @@ -57,7 +57,7 @@ describe "Deployed site at #{www}", :js => true, :type => :feature, :capybara_fe 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' as_monitor(user1) do @@ -80,7 +80,7 @@ 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 as_monitor(user1) do @@ -91,17 +91,14 @@ describe "Deployed site at #{www}", :js => true, :type => :feature, :capybara_fe 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 end as_monitor(user2) do puts "\n *** #{user2}'s client *** \n" - find('.previous-message-text', text: test_response) - send_text_message(test_goodbye, close_on_send: true) + sign_out_poltergeist end - - as_monitor(user1) { puts "\n *** #{user1}'s client *** \n"; sign_out_poltergeist } - as_monitor(user2) { puts "\n *** #{user2}'s client *** \n"; sign_out_poltergeist } end let(:queue_limit) { 5 } From a2897d78c39b4103218ed439ca0a95edc7cbc12c Mon Sep 17 00:00:00 2001 From: Anthony Davis Date: Thu, 11 Sep 2014 14:49:54 -0500 Subject: [PATCH 03/12] VRFS-2001 - fixing test for www --- monitor/spec/production_spec.rb | 8 ++------ monitor/spec/support/utilities.rb | 3 +++ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/monitor/spec/production_spec.rb b/monitor/spec/production_spec.rb index 829533390..0ed3b497c 100755 --- a/monitor/spec/production_spec.rb +++ b/monitor/spec/production_spec.rb @@ -49,8 +49,8 @@ describe "Deployed site at #{www}", :js => true, :type => :feature, :capybara_fe it "is possible for #{user1} to sign in and not get disconnected within 30 seconds" do as_monitor(user1) do - puts "\n *** #{user1}'s client *** \n" - sign_in_poltergeist user1 + sign_in_poltergeist(user1) + sleep 5 # www really doesn't like going fast here repeat_for(30.seconds) do expect(page).to_not have_selector('.no-websocket-connection') #looks for reconnect dialog every 1 second end @@ -61,7 +61,6 @@ describe "Deployed site at #{www}", :js => true, :type => :feature, :capybara_fe # this example heavily based on text_message_spec.rb in 'web' as_monitor(user1) do - puts "\n *** #{user1}'s client *** \n" sign_in_poltergeist(user1) end @@ -70,7 +69,6 @@ describe "Deployed site at #{www}", :js => true, :type => :feature, :capybara_fe test_goodbye = "#{SecureRandom.uuid} - OK bye!" as_monitor(user2) do - puts "\n *** #{user2}'s client *** \n" sign_in_poltergeist(user2) expect(page).to have_xpath( "//div[@class='friend-name' and @user-id='#{user1.id}']/span[@class='friend-status']", @@ -84,7 +82,6 @@ describe "Deployed site at #{www}", :js => true, :type => :feature, :capybara_fe end as_monitor(user1) do - puts "\n *** #{user1}'s client *** \n" expect(page).to have_xpath( "//div[@class='friend-name' and @user-id='#{user2.id}']/span[@class='friend-status']", :text => "Available" ) @@ -96,7 +93,6 @@ describe "Deployed site at #{www}", :js => true, :type => :feature, :capybara_fe end as_monitor(user2) do - puts "\n *** #{user2}'s client *** \n" sign_out_poltergeist end end diff --git a/monitor/spec/support/utilities.rb b/monitor/spec/support/utilities.rb index c350e80b0..e99fea69f 100755 --- a/monitor/spec/support/utilities.rb +++ b/monitor/spec/support/utilities.rb @@ -53,6 +53,7 @@ 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 *** #{name}'s client *** \n" yield end @@ -175,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)} " yield sleep 1 # by default this will execute the block every 1 second break if (Time.now > finish_time) From 8e621517b2efe98e6423b79c8a5c6640c539cf0d Mon Sep 17 00:00:00 2001 From: Anthony Davis Date: Thu, 11 Sep 2014 14:55:46 -0500 Subject: [PATCH 04/12] VRFS-2001 - oops --- monitor/spec/production_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/monitor/spec/production_spec.rb b/monitor/spec/production_spec.rb index 0ed3b497c..0a6eca740 100755 --- a/monitor/spec/production_spec.rb +++ b/monitor/spec/production_spec.rb @@ -50,7 +50,7 @@ describe "Deployed site at #{www}", :js => true, :type => :feature, :capybara_fe it "is possible for #{user1} to sign in and not get disconnected within 30 seconds" do as_monitor(user1) do sign_in_poltergeist(user1) - sleep 5 # www really doesn't like going fast here + sleep 10 # www really doesn't like going fast here repeat_for(30.seconds) do expect(page).to_not have_selector('.no-websocket-connection') #looks for reconnect dialog every 1 second end From acdb0b6f9b7ebb0a77de418ac6158aded8d985df Mon Sep 17 00:00:00 2001 From: Anthony Davis Date: Thu, 11 Sep 2014 15:20:54 -0500 Subject: [PATCH 05/12] VRFS-2001 - sigh --- monitor/spec/production_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/monitor/spec/production_spec.rb b/monitor/spec/production_spec.rb index 0a6eca740..2ce3b5989 100755 --- a/monitor/spec/production_spec.rb +++ b/monitor/spec/production_spec.rb @@ -49,8 +49,8 @@ describe "Deployed site at #{www}", :js => true, :type => :feature, :capybara_fe it "is possible for #{user1} to sign in and not get disconnected within 30 seconds" do as_monitor(user1) do - sign_in_poltergeist(user1) - sleep 10 # www really doesn't like going fast here + sign_in_poltergeist(user1, validate: false) + sleep 10 # www and the fakeJamClient really don't like going fast here repeat_for(30.seconds) do expect(page).to_not have_selector('.no-websocket-connection') #looks for reconnect dialog every 1 second end From 926add8d65a68b3d9ade31996cb20bc8bb6bd281 Mon Sep 17 00:00:00 2001 From: Anthony Davis Date: Thu, 11 Sep 2014 15:45:07 -0500 Subject: [PATCH 06/12] VRFS-2001 debugging websocket issue --- monitor/spec/production_spec.rb | 4 ++-- monitor/spec/support/utilities.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/monitor/spec/production_spec.rb b/monitor/spec/production_spec.rb index 2ce3b5989..37e7e0796 100755 --- a/monitor/spec/production_spec.rb +++ b/monitor/spec/production_spec.rb @@ -49,8 +49,8 @@ describe "Deployed site at #{www}", :js => true, :type => :feature, :capybara_fe it "is possible for #{user1} to sign in and not get disconnected within 30 seconds" do as_monitor(user1) do - sign_in_poltergeist(user1, validate: false) - sleep 10 # www and the fakeJamClient really don't like going fast here + sign_in_poltergeist(user1) + puts "Waiting for 15 whole seconds before checking websocket connection"; sleep 15 # www and the fakeJamClient really don't like going fast here repeat_for(30.seconds) do expect(page).to_not have_selector('.no-websocket-connection') #looks for reconnect dialog every 1 second end diff --git a/monitor/spec/support/utilities.rb b/monitor/spec/support/utilities.rb index e99fea69f..41c1ef613 100755 --- a/monitor/spec/support/utilities.rb +++ b/monitor/spec/support/utilities.rb @@ -179,7 +179,7 @@ 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)} " + 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) From 1651f5e2cb0c227133961c6875065eef78dd5ffd Mon Sep 17 00:00:00 2001 From: Anthony Davis Date: Thu, 11 Sep 2014 16:09:36 -0500 Subject: [PATCH 07/12] VRFS-2001 debug --- monitor/spec/production_spec.rb | 7 ++++--- monitor/spec/support/utilities.rb | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/monitor/spec/production_spec.rb b/monitor/spec/production_spec.rb index 37e7e0796..d3b97bc94 100755 --- a/monitor/spec/production_spec.rb +++ b/monitor/spec/production_spec.rb @@ -48,9 +48,10 @@ describe "Deployed site at #{www}", :js => true, :type => :feature, :capybara_fe end it "is possible for #{user1} to sign in and not get disconnected within 30 seconds" do + as_monitor(user1) do + puts "[monitor] Waiting a bit for other connections to close..."; sleep 10 # www and the fakeJamClient really don't like going fast here sign_in_poltergeist(user1) - puts "Waiting for 15 whole seconds before checking websocket connection"; sleep 15 # www and the fakeJamClient really don't like going fast here repeat_for(30.seconds) do expect(page).to_not have_selector('.no-websocket-connection') #looks for reconnect dialog every 1 second end @@ -89,11 +90,11 @@ describe "Deployed site at #{www}", :js => true, :type => :feature, :capybara_fe find('h1', text: 'conversation with ' + user2.name) find('.previous-message-text', text: test_message) find('#text-message-dialog .btn-close-dialog', text: 'CLOSE').trigger(:click) - sign_out_poltergeist + sign_out_poltergeist(validate: true) end as_monitor(user2) do - sign_out_poltergeist + sign_out_poltergeist(validate: true) end end diff --git a/monitor/spec/support/utilities.rb b/monitor/spec/support/utilities.rb index 41c1ef613..be0e32722 100755 --- a/monitor/spec/support/utilities.rb +++ b/monitor/spec/support/utilities.rb @@ -53,7 +53,7 @@ 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 *** #{name}'s client *** \n" + puts "\n[monitor] #{name}'s client *** \n" yield end From 7baa18b054c4b72d462e2ef054021c2f2bea69cf Mon Sep 17 00:00:00 2001 From: Anthony Davis Date: Thu, 11 Sep 2014 16:20:22 -0500 Subject: [PATCH 08/12] VRFS-2001 - debug --- monitor/spec/production_spec.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/monitor/spec/production_spec.rb b/monitor/spec/production_spec.rb index d3b97bc94..f55397b90 100755 --- a/monitor/spec/production_spec.rb +++ b/monitor/spec/production_spec.rb @@ -50,8 +50,10 @@ describe "Deployed site at #{www}", :js => true, :type => :feature, :capybara_fe it "is possible for #{user1} to sign in and not get disconnected within 30 seconds" do as_monitor(user1) do - puts "[monitor] Waiting a bit for other connections to close..."; sleep 10 # www and the fakeJamClient really don't like going fast here + puts "[monitor] Waiting a bit for other any other connections to close..."; sleep 9 sign_in_poltergeist(user1) + puts "[monitor] Waiting a bit after sign-in..." + sleep 6 # www and the fakeJamClient really don't like going too fast here repeat_for(30.seconds) do expect(page).to_not have_selector('.no-websocket-connection') #looks for reconnect dialog every 1 second end From 606c2031fbdcdc2c84ed9b94dd6df96ab5dc3763 Mon Sep 17 00:00:00 2001 From: Anthony Davis Date: Thu, 11 Sep 2014 16:35:13 -0500 Subject: [PATCH 09/12] VRFS-2001 - order-dependent :=3 --- monitor/spec/production_spec.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/monitor/spec/production_spec.rb b/monitor/spec/production_spec.rb index f55397b90..8c4dc5807 100755 --- a/monitor/spec/production_spec.rb +++ b/monitor/spec/production_spec.rb @@ -50,10 +50,9 @@ describe "Deployed site at #{www}", :js => true, :type => :feature, :capybara_fe it "is possible for #{user1} to sign in and not get disconnected within 30 seconds" do as_monitor(user1) do - puts "[monitor] Waiting a bit for other any other connections to close..."; sleep 9 sign_in_poltergeist(user1) puts "[monitor] Waiting a bit after sign-in..." - sleep 6 # www and the fakeJamClient really don't like going too fast here + sleep 10 # www and the fakeJamClient really don't like going too fast here repeat_for(30.seconds) do expect(page).to_not have_selector('.no-websocket-connection') #looks for reconnect dialog every 1 second end @@ -98,6 +97,9 @@ describe "Deployed site at #{www}", :js => true, :type => :feature, :capybara_fe as_monitor(user2) do sign_out_poltergeist(validate: true) end + + puts "[monitor] Waiting a bit to clean up connections..." + sleep 11 #to clean up user sessions on server end let(:queue_limit) { 5 } From eabd58add7401f77890b50af6a64902f734a467a Mon Sep 17 00:00:00 2001 From: Anthony Davis Date: Thu, 11 Sep 2014 17:02:43 -0500 Subject: [PATCH 10/12] VRFS-2001 use separate user for websocket test --- monitor/spec/production_spec.rb | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/monitor/spec/production_spec.rb b/monitor/spec/production_spec.rb index 8c4dc5807..4610f3dd7 100755 --- a/monitor/spec/production_spec.rb +++ b/monitor/spec/production_spec.rb @@ -41,18 +41,17 @@ 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 - - as_monitor(user1) do - sign_in_poltergeist(user1) - puts "[monitor] Waiting a bit after sign-in..." - sleep 10 # www and the fakeJamClient really don't like going too fast here + 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 @@ -97,9 +96,6 @@ describe "Deployed site at #{www}", :js => true, :type => :feature, :capybara_fe as_monitor(user2) do sign_out_poltergeist(validate: true) end - - puts "[monitor] Waiting a bit to clean up connections..." - sleep 11 #to clean up user sessions on server end let(:queue_limit) { 5 } From b603d7d253db86c7d25f92550857f7aa4c422b2b Mon Sep 17 00:00:00 2001 From: Seth Call Date: Fri, 12 Sep 2014 06:27:20 -0500 Subject: [PATCH 11/12] * VRFS-1505 - fix typo in punk --- db/up/new_genres.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 770d0acd4235ee88f407420b56cbc085f524a8ae Mon Sep 17 00:00:00 2001 From: Seth Call Date: Fri, 12 Sep 2014 06:29:10 -0500 Subject: [PATCH 12/12] * VRFS-1505 - adding sorting to genres in controller --- web/app/controllers/api_genres_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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