Skip to content

Commit

Permalink
Fixed acceptance tests with visible selector checks
Browse files Browse the repository at this point in the history
  • Loading branch information
ndbroadbent committed Oct 19, 2012
1 parent 8b4e56f commit 2cd280f
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion spec/acceptance/accounts_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
visit accounts_page
page.should have_content('Account 0')
page.should have_content('Account 1')
page.should have_content('Search accounts')
page.should have_content('Create Account')
end

scenario 'should create a new account', :js => true do
visit accounts_page
page.should have_content('Create Account')
click_link 'Create Account'
page.should have_selector('#account_name', visible: true)
fill_in 'account_name', :with => 'My new account'
click_link 'Contact Information'
fill_in 'account_phone', :with => '+1 2345 6789'
Expand Down
2 changes: 1 addition & 1 deletion spec/acceptance/admin/groups_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
visit admin_groups_path
page.should have_content("Couldn't find any Groups.")
click_link 'create a new group'
wait_until { find_field('group[name]') } # wait for AJAX to load
page.should have_selector('#group_name', visible: true)
fill_in 'group_name', :with => 'The Enterprise Bridge'
chosen_select('Mr Spock', :from => 'group_user_ids')
click_button 'Create Group'
Expand Down
6 changes: 3 additions & 3 deletions spec/acceptance/admin/users_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@
FactoryGirl.create(:group, :name => "Superheroes")
visit admin_users_path
click_link 'Create User'
wait_until { find_field('user[username]') } # wait for AJAX to load
page.should have_selector('#user_username', visible: true)
fill_in 'user_username', :with => 'captainthunder'
fill_in 'user_email', :with => 'lightning@example.com'
fill_in 'user_first_name', :with => 'Captain'
fill_in 'user_last_name', :with => 'Thunder'
fill_in 'user_title', :with => 'Chief'
fill_in 'user_company', :with => 'Weather Inc.'
chosen_select('Superheroes', :from => 'user_group_ids')

click_button 'Create User'
page.should have_content('Captain Thunder')
page.should have_content('Weather Inc.')
page.should have_content('Superheroes')
page.should have_content('lightning@example.com')

end

end
2 changes: 1 addition & 1 deletion spec/acceptance/campaigns_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
page.should have_content('Campaign 0')
page.should have_content('Campaign 1')
page.should have_content('Campaign 2')
page.should have_content('Search campaigns')
page.should have_content('Create Campaign')
end

scenario 'should create a campaign', :js => true do
visit campaigns_page
click_link 'Create Campaign'
page.should have_selector('#campaign_name', visible: true)
fill_in 'campaign_name', :with => 'Cool Campaign'
select 'On Hold', :from => 'campaign_status'
click_link 'Comment'
Expand Down
2 changes: 1 addition & 1 deletion spec/acceptance/contacts_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
page.should have_content('Test Subject #1')
page.should have_content('Test Subject #2')
page.should have_content('Test Subject #3')
page.should have_content('Search contacts')
page.should have_content('Create Contact')
end

scenario 'should create a contact', :js => true do
visit contacts_page
click_link 'Create Contact'
page.should have_selector('#contact_first_name', visible: true)
fill_in 'contact_first_name', :with => 'Testy'
fill_in 'contact_last_name', :with => 'McTest'
fill_in 'contact_email', :with => "testy.mctest@example.com"
Expand Down
2 changes: 1 addition & 1 deletion spec/acceptance/leads_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
page.should have_content('L Ead 1')
page.should have_content('L Ead 2')
page.should have_content('L Ead 3')
page.should have_content('Search leads')
page.should have_content('Create Lead')
end

scenario 'should create a new lead', :js => true do
visit leads_page
click_link 'Create Lead'
page.should have_selector('#lead_first_name', visible: true)
fill_in 'lead_first_name', :with => 'Mr'
fill_in 'lead_last_name', :with => 'Lead'
fill_in 'lead_email', :with => 'mr_lead@example.com'
Expand Down
2 changes: 1 addition & 1 deletion spec/acceptance/opportunities_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
page.should have_content('Opportunity 0')
page.should have_content('Opportunity 1')
page.should have_content('Opportunity 2')
page.should have_content('Search opportunities')
page.should have_content('Create Opportunity')
end

scenario 'should create a new opportunity', :js => true do
FactoryGirl.create(:account, :name => 'Example Account')
visit opportunities_page
click_link 'Create Opportunity'
page.should have_selector('#opportunity_name', visible: true)
fill_in 'opportunity_name', :with => 'My Awesome Opportunity'
chosen_select('Example Account', :from => 'account_id')
select 'Proposal', :from => 'opportunity_stage'
Expand Down
2 changes: 2 additions & 0 deletions spec/acceptance/tasks_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
visit tasks_page
page.should have_content('Create Task')
click_link 'Create Task'
page.should have_selector('#task_name', visible: true)
fill_in 'task_name', :with => 'Task I Need To Do'
chosen_select('Tomorrow', :from => 'task_bucket')
chosen_select('Myself', :from => 'task_assigned_to')
Expand All @@ -39,6 +40,7 @@
FactoryGirl.create(:user, :first_name => 'Another', :last_name => 'User')
visit tasks_page
click_link 'Create Task'
page.should have_selector('#task_name', visible: true)
fill_in 'task_name', :with => 'Task For Someone Else'
chosen_select('Tomorrow', :from => 'task_bucket')
chosen_select('Another User', :from => 'task_assigned_to')
Expand Down

0 comments on commit 2cd280f

Please sign in to comment.