From 2cd280fa60b7a93c0ccf6c0fda50ddf1c72f65a3 Mon Sep 17 00:00:00 2001 From: Nathan Broadbent Date: Mon, 17 Sep 2012 22:01:35 +1200 Subject: [PATCH] Fixed acceptance tests with visible selector checks --- spec/acceptance/accounts_spec.rb | 2 +- spec/acceptance/admin/groups_spec.rb | 2 +- spec/acceptance/admin/users_spec.rb | 6 +++--- spec/acceptance/campaigns_spec.rb | 2 +- spec/acceptance/contacts_spec.rb | 2 +- spec/acceptance/leads_spec.rb | 2 +- spec/acceptance/opportunities_spec.rb | 2 +- spec/acceptance/tasks_spec.rb | 2 ++ 8 files changed, 11 insertions(+), 9 deletions(-) diff --git a/spec/acceptance/accounts_spec.rb b/spec/acceptance/accounts_spec.rb index 01c0889745..d4cc4560b3 100644 --- a/spec/acceptance/accounts_spec.rb +++ b/spec/acceptance/accounts_spec.rb @@ -15,7 +15,6 @@ 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 @@ -23,6 +22,7 @@ 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' diff --git a/spec/acceptance/admin/groups_spec.rb b/spec/acceptance/admin/groups_spec.rb index 422ad7575a..40db9e3215 100644 --- a/spec/acceptance/admin/groups_spec.rb +++ b/spec/acceptance/admin/groups_spec.rb @@ -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' diff --git a/spec/acceptance/admin/users_spec.rb b/spec/acceptance/admin/users_spec.rb index f0e54275b0..6a4f5cd21d 100644 --- a/spec/acceptance/admin/users_spec.rb +++ b/spec/acceptance/admin/users_spec.rb @@ -14,7 +14,7 @@ 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' @@ -22,13 +22,13 @@ 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 diff --git a/spec/acceptance/campaigns_spec.rb b/spec/acceptance/campaigns_spec.rb index 881d3bced0..d07ed1386f 100644 --- a/spec/acceptance/campaigns_spec.rb +++ b/spec/acceptance/campaigns_spec.rb @@ -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' diff --git a/spec/acceptance/contacts_spec.rb b/spec/acceptance/contacts_spec.rb index e9c2bc5a08..1d3a78b432 100644 --- a/spec/acceptance/contacts_spec.rb +++ b/spec/acceptance/contacts_spec.rb @@ -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" diff --git a/spec/acceptance/leads_spec.rb b/spec/acceptance/leads_spec.rb index 982184dce7..bc36cdf5b3 100644 --- a/spec/acceptance/leads_spec.rb +++ b/spec/acceptance/leads_spec.rb @@ -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' diff --git a/spec/acceptance/opportunities_spec.rb b/spec/acceptance/opportunities_spec.rb index f1410715fb..695e96cec8 100644 --- a/spec/acceptance/opportunities_spec.rb +++ b/spec/acceptance/opportunities_spec.rb @@ -16,7 +16,6 @@ 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 @@ -24,6 +23,7 @@ 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' diff --git a/spec/acceptance/tasks_spec.rb b/spec/acceptance/tasks_spec.rb index 6baed2ee59..0c56441e54 100644 --- a/spec/acceptance/tasks_spec.rb +++ b/spec/acceptance/tasks_spec.rb @@ -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') @@ -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')