Commit 5281ccda543f7dd0c616f4fd11d4df47551d9b2e
1 parent
bcf8f080
Exists in
master
and in
11 other branches
rails4: fix remaining cucumber tests
Some tests now need javascript to run and were tagged to selenium
Showing
11 changed files
with
35 additions
and
34 deletions
Show diff stats
Gemfile
| ... | ... | @@ -20,7 +20,7 @@ gem 'exception_notification', '~> 4.0.1' |
| 20 | 20 | gem 'gettext', '~> 2.2.1', :require => false |
| 21 | 21 | gem 'locale', '~> 2.0.5' |
| 22 | 22 | gem 'whenever', :require => false |
| 23 | -gem 'eita-jrails', '>= 0.10.0', require: 'jrails' | |
| 23 | +gem 'eita-jrails', '~> 0.10.0', require: 'jrails' | |
| 24 | 24 | |
| 25 | 25 | # asset pipeline |
| 26 | 26 | gem 'uglifier', '>= 1.0.3' | ... | ... |
config/environments/cucumber.rb
| ... | ... | @@ -7,6 +7,8 @@ Noosfero::Application.configure do |
| 7 | 7 | # For more information see https://rspec.lighthouseapp.com/projects/16211/tickets/165 |
| 8 | 8 | config.cache_classes = true |
| 9 | 9 | |
| 10 | + config.assets.debug = false | |
| 11 | + | |
| 10 | 12 | config.eager_load = false |
| 11 | 13 | |
| 12 | 14 | config.active_support.deprecation = :log |
| ... | ... | @@ -22,7 +24,4 @@ Noosfero::Application.configure do |
| 22 | 24 | # ActionMailer::Base.deliveries array. |
| 23 | 25 | config.action_mailer.delivery_method = :test |
| 24 | 26 | |
| 25 | - config.gem 'cucumber-rails', :lib => false, :version => '>=0.3.2' unless File.directory?(Rails.root.join('vendor/plugins/cucumber-rails')) | |
| 26 | - config.gem 'database_cleaner', :lib => false, :version => '>=0.5.0' unless File.directory?(Rails.root.join('vendor/plugins/database_cleaner')) | |
| 27 | - config.gem 'capybara', :lib => false, :version => '>=0.3.5' unless File.directory?(Rails.root.join('vendor/plugins/capybara')) | |
| 28 | 27 | end | ... | ... |
features/delete_profile.feature
| ... | ... | @@ -13,6 +13,7 @@ Feature: delete profile |
| 13 | 13 | | sample-community | Sample Community | |
| 14 | 14 | And "Maria Silva" is a member of "Sample Community" |
| 15 | 15 | |
| 16 | + @selenium | |
| 16 | 17 | Scenario: deleting profile |
| 17 | 18 | Given I am logged in as "joaosilva" |
| 18 | 19 | And I am on joaosilva's control panel |
| ... | ... | @@ -45,6 +46,7 @@ Feature: delete profile |
| 45 | 46 | When I follow "Community Info and settings" |
| 46 | 47 | Then I should see "Delete profile" |
| 47 | 48 | |
| 49 | + @selenium | |
| 48 | 50 | Scenario: community admin deletes the community |
| 49 | 51 | Given "Joao Silva" is admin of "Sample Community" |
| 50 | 52 | And I am logged in as "joaosilva" |
| ... | ... | @@ -73,6 +75,7 @@ Feature: delete profile |
| 73 | 75 | When I follow "Enterprise Info and settings" |
| 74 | 76 | Then I should see "Delete profile" |
| 75 | 77 | |
| 78 | + @selenium | |
| 76 | 79 | Scenario: enterprise admin deletes the enterprise |
| 77 | 80 | Given the following enterprise |
| 78 | 81 | | identifier | name | |
| ... | ... | @@ -98,6 +101,7 @@ Feature: delete profile |
| 98 | 101 | And I go to /myprofile/sample-enterprise/profile_editor/destroy_profile |
| 99 | 102 | Then I should see "Access denied" |
| 100 | 103 | |
| 104 | + @selenium | |
| 101 | 105 | Scenario: environment admin deletes profile |
| 102 | 106 | Given I am logged in as admin |
| 103 | 107 | And I am on joaosilva's control panel | ... | ... |
features/edit_article.feature
features/members_block.feature
| ... | ... | @@ -29,6 +29,7 @@ Feature: |
| 29 | 29 | And I follow "Manage my groups" |
| 30 | 30 | Then I should see "Sample Community" |
| 31 | 31 | |
| 32 | + @selenium | |
| 32 | 33 | Scenario: a user can leave a community by members block's button |
| 33 | 34 | Given "Maria Silva" is a member of "Sample Community" |
| 34 | 35 | And I am logged in as "mariasilva" | ... | ... |
features/register_enterprise.feature
| ... | ... | @@ -77,6 +77,7 @@ Feature: register enterprise |
| 77 | 77 | Then I should see "Contact person can't be blank" |
| 78 | 78 | Then I should see "Contact email can't be blank" |
| 79 | 79 | |
| 80 | + @selenium | |
| 80 | 81 | Scenario: a user register an enterprise successfully through the admin |
| 81 | 82 | validator method and the admin accepts |
| 82 | 83 | Given organization_approval_method is "admin" on environment |
| ... | ... | @@ -133,8 +134,9 @@ Feature: register enterprise |
| 133 | 134 | When I follow "Manage my groups" |
| 134 | 135 | Then I should not see "My Enterprise" |
| 135 | 136 | |
| 136 | - Scenario: a user register an enterprise successfully through the region | |
| 137 | - validator method and the validator accepts | |
| 137 | + @selenium | |
| 138 | + Scenario: a user register an enterprise successfully through the region | |
| 139 | + validator method and the validator accepts | |
| 138 | 140 | Given organization_approval_method is "region" on environment |
| 139 | 141 | And I follow "Manage my groups" |
| 140 | 142 | And the following enterprise | ... | ... |
features/step_definitions/noosfero_steps.rb
| ... | ... | @@ -435,20 +435,13 @@ Given /^the mailbox is empty$/ do |
| 435 | 435 | end |
| 436 | 436 | |
| 437 | 437 | Given /^the (.+) mail (?:is|has) (.+) (.+)$/ do |position, field, value| |
| 438 | - if(/^[0-9]+$/ =~ position) | |
| 439 | - ActionMailer::Base.deliveries[position.to_i][field].to_s == value | |
| 440 | - else | |
| 441 | - ActionMailer::Base.deliveries.send(position)[field].to_s == value | |
| 442 | - end | |
| 438 | + mail = if /^[0-9]+$/ =~ position then ActionMailer::Base.deliveries[position.to_i] else ActionMailer::Base.deliveries.send position end | |
| 439 | + mail and mail[field].to_s == value | |
| 443 | 440 | end |
| 444 | 441 | |
| 445 | 442 | Given /^the (.+) mail (.+) is like (.+)$/ do |position, field, regexp| |
| 446 | - re = Regexp.new(regexp) | |
| 447 | - if(/^[0-9]+$/ =~ position) | |
| 448 | - re =~ ActionMailer::Base.deliveries[position.to_i][field.to_sym] | |
| 449 | - else | |
| 450 | - re =~ ActionMailer::Base.deliveries.send(position)[field.to_sym] | |
| 451 | - end | |
| 443 | + mail = if /^[0-9]+$/ =~ position then ActionMailer::Base.deliveries[position.to_i] else ActionMailer::Base.deliveries.send position end | |
| 444 | + mail and Regexp.new(regexp) =~ mail[field.to_sym] | |
| 452 | 445 | end |
| 453 | 446 | |
| 454 | 447 | Given /^the following environment configuration$/ do |table| | ... | ... |
| ... | ... | @@ -0,0 +1,16 @@ |
| 1 | +require 'database_cleaner' | |
| 2 | +require 'database_cleaner/cucumber' | |
| 3 | + | |
| 4 | +Cucumber::Rails::World.use_transactional_fixtures = false | |
| 5 | +# FIXME: 'DELETE FROM ...' is being ran 3x - see cucumber.log | |
| 6 | +DatabaseCleaner.clean_with :truncation | |
| 7 | +DatabaseCleaner.strategy = :truncation, {:pre_count => true, :reset_ids => false} | |
| 8 | + | |
| 9 | +Before do | |
| 10 | + DatabaseCleaner.start | |
| 11 | +end | |
| 12 | + | |
| 13 | +After do | |
| 14 | + DatabaseCleaner.clean | |
| 15 | +end | |
| 16 | + | ... | ... |
features/support/paths.rb
| ... | ... | @@ -40,7 +40,7 @@ module NavigationHelpers |
| 40 | 40 | "/myprofile/#{$2}/profile_design/edit/#{block.id}" |
| 41 | 41 | |
| 42 | 42 | when /^(.*)'s homepage$/ |
| 43 | - '/' + profile_identifier($1) + '/' | |
| 43 | + '/' + profile_identifier($1) | |
| 44 | 44 | |
| 45 | 45 | when /^(.*)'s blog$/ |
| 46 | 46 | '/%s/blog' % profile_identifier($1) | ... | ... |
features/support/selenium.rb
| 1 | -require 'database_cleaner' | |
| 2 | -require 'database_cleaner/cucumber' | |
| 3 | - | |
| 4 | -Cucumber::Rails::World.use_transactional_fixtures = false | |
| 5 | 1 | |
| 6 | 2 | Capybara.default_driver = :selenium |
| 7 | 3 | Capybara.register_driver :selenium do |app| |
| 8 | 4 | Capybara::Selenium::Driver.new(app, :browser => :firefox) |
| 9 | 5 | end |
| 10 | 6 | |
| 11 | -# FIXME: 'DELETE FROM ...' is being ran 3x - see cucumber.log | |
| 12 | -DatabaseCleaner.clean_with :truncation | |
| 13 | -DatabaseCleaner.strategy = :truncation, {:pre_count => true, :reset_ids => false} | |
| 14 | - | |
| 15 | -Before do | |
| 16 | - DatabaseCleaner.start | |
| 17 | -end | |
| 18 | - | |
| 19 | 7 | Before('@ignore-hidden-elements') do |
| 20 | 8 | Capybara.ignore_hidden_elements = true |
| 21 | 9 | end |
| ... | ... | @@ -23,8 +11,4 @@ end |
| 23 | 11 | Capybara.default_wait_time = 30 |
| 24 | 12 | Capybara.server_host = "localhost" |
| 25 | 13 | |
| 26 | -After do | |
| 27 | - DatabaseCleaner.clean | |
| 28 | -end | |
| 29 | - | |
| 30 | 14 | World(Capybara) | ... | ... |