From e6d1980495a3d7c8528040eba32cf5bc284dbcee Mon Sep 17 00:00:00 2001 From: Steven Miers Date: Tue, 16 Jun 2015 17:55:55 -0500 Subject: [PATCH] VRFS-3190 : Fix band tests, add new tests for new tabs / cleanup --- web/app/assets/javascripts/band_setup.js | 138 ++++++++++---------- web/app/views/clients/_band_setup.html.slim | 16 +-- web/spec/features/bands_spec.rb | 45 +++++-- 3 files changed, 104 insertions(+), 95 deletions(-) diff --git a/web/app/assets/javascripts/band_setup.js b/web/app/assets/javascripts/band_setup.js index 9d4b59487..18ccc1a8f 100644 --- a/web/app/assets/javascripts/band_setup.js +++ b/web/app/assets/javascripts/band_setup.js @@ -31,15 +31,15 @@ var friendInput=null var bandType=null var bandStatus=null - var concertCount=null - - + var concertCount=null + + var $screen=$("#band-setup") var $samples = $screen.find(".account-profile-samples") var $selectedInstruments=[] - - var accountProfileSamples = new JK.AccountProfileSamples(app, $screen, loadBandCallback, rest.updateBand) - accountProfileSamples.initialize() + + var accountProfileSamples = new JK.AccountProfileSamples(app, $screen, loadBandCallback, rest.updateBand) + accountProfileSamples.initialize() function navBack() { if (currentStep>0) { @@ -49,13 +49,13 @@ }) } } - + function navCancel() { - resetForm() + resetForm() window.history.go(-1) return false } - + function navNext() { if (currentStep "24x24", :align => "absmiddle") .right.mt5.ml5 | Google+ - / br clear="all" - / .right - / a#btn-band-setup-back.button-grey - / | BACK - / |    - / a#btn-band-setup-save.button-orange - / | CREATE BAND - / .clearall br clear="all" .right diff --git a/web/spec/features/bands_spec.rb b/web/spec/features/bands_spec.rb index 3c74a4fda..5c0d7c942 100644 --- a/web/spec/features/bands_spec.rb +++ b/web/spec/features/bands_spec.rb @@ -25,27 +25,45 @@ describe "Bands", :js => true, :type => :feature, :capybara_feature => true do expect(page).to have_selector('#band-setup-title') end - def fill_out_band_setup_form(band, biography, params={}) + def fill_out_band_setup_form(band, biography, country="United States", region="Texas", city="Austin", params={}) navigate_band_setup unless URI.parse(current_url).fragment == '/band/setup/new' params['band-name'] ||= band || "Default band name" params['band-biography'] ||= biography || "Default band biography" within('#band-setup-form') do params.each do |field, value| - fill_in field, with: "#{value}" + fill_in field, with: value end # Move to experience pane: #first('#band-genres input[type="checkbox"]').trigger(:click) end + jk_select(country, '#band-country') + jk_select(region, '#band-region') + jk_select(city, '#band-city') + sleep 1 # work around race condition + find('#btn-band-setup-next').trigger(:click) - find('h2', text: 'Step 2: Add Band Members') + find('h2', text: 'set up band: musical experience') end - def complete_band_setup_form(band, biography, params={}) - fill_out_band_setup_form(band, biography, params) - find('#btn-band-setup-save').trigger(:click) + def complete_band_setup_form(band, biography, country="United States", region="Texas", city="Austin", params={}) + fill_out_band_setup_form(band, biography, country, region, city, params) + + find(:css, "#african").set(true) + find('#btn-band-setup-next').trigger(:click) + find('h2', text: 'set up band: current interests') + + find('#btn-band-setup-next').trigger(:click) + find('h2', text: 'set up band: online presence & performance samples') + + find('#btn-band-setup-next').trigger(:click) + find('h2', text: 'set up band: invite members') + + # Save + find('#btn-band-setup-next').trigger(:click) + sleep(1) end context "band profile - new band setup" do @@ -71,16 +89,18 @@ describe "Bands", :js => true, :type => :feature, :capybara_feature => true do find('#btn-band-setup-next').trigger(:click) expect(page).to have_selector('#band-setup .band-name .error-text li', text: "can't be blank") expect(page).to have_selector('#band-setup .band-biography .error-text li', text: "can't be blank") - #expect(page).to have_selector('#band-setup .band-genres .error-text li', text: "At least 1 genre is required.") - complete_band_setup_form("Band name", "Band biography") + complete_band_setup_form("Test Band name", "Test Band biography") - expect(page).to have_selector('#band-profile-name', text: "Band name") - expect(page).to have_selector('#band-profile-biography', text: "Band biography") + + expect(page).to have_selector('#band-profile-name', text: "Test Band name") + expect(page).to have_selector('#band-profile-biography', text: "Test Band biography") end it "limits genres to 3" do pending "Move this to experience pane" + #expect(page).to have_selector('#band-setup .band-genres .error-text li', text: "At least 1 genre is required.") + genres = Genre.limit(4) navigate_band_setup within('#band-setup-form') do @@ -136,8 +156,7 @@ describe "Bands", :js => true, :type => :feature, :capybara_feature => true do band_attributes = { name: 'Radical D00dz', biography: 'Just a bunch of EXTREME dudes who ROCK professionally!!', - # website: 'www.radicald00dz.com', # not displayed - VRFS-1617 - # country: 'US', # not displayed + country: 'US', city: 'Lubbock', state: 'TX' } @@ -188,7 +207,7 @@ describe "Bands", :js => true, :type => :feature, :capybara_feature => true do find("tr[user-id='#{friend.id}']").trigger(:click) expect(page).to have_selector("tr.selected[user-id='#{friend.id}']") find('#btn-save-friends').trigger(:click) - find('#btn-band-setup-save').trigger(:click) + find('#btn-band-setup-next').trigger(:click) sleep 1 # ensure the transaction commits.. find('#band-profile-members-link').trigger(:click)