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,7 +20,7 @@ gem 'exception_notification', '~> 4.0.1' | ||
20 | gem 'gettext', '~> 2.2.1', :require => false | 20 | gem 'gettext', '~> 2.2.1', :require => false |
21 | gem 'locale', '~> 2.0.5' | 21 | gem 'locale', '~> 2.0.5' |
22 | gem 'whenever', :require => false | 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 | # asset pipeline | 25 | # asset pipeline |
26 | gem 'uglifier', '>= 1.0.3' | 26 | gem 'uglifier', '>= 1.0.3' |
config/environments/cucumber.rb
@@ -7,6 +7,8 @@ Noosfero::Application.configure do | @@ -7,6 +7,8 @@ Noosfero::Application.configure do | ||
7 | # For more information see https://rspec.lighthouseapp.com/projects/16211/tickets/165 | 7 | # For more information see https://rspec.lighthouseapp.com/projects/16211/tickets/165 |
8 | config.cache_classes = true | 8 | config.cache_classes = true |
9 | 9 | ||
10 | + config.assets.debug = false | ||
11 | + | ||
10 | config.eager_load = false | 12 | config.eager_load = false |
11 | 13 | ||
12 | config.active_support.deprecation = :log | 14 | config.active_support.deprecation = :log |
@@ -22,7 +24,4 @@ Noosfero::Application.configure do | @@ -22,7 +24,4 @@ Noosfero::Application.configure do | ||
22 | # ActionMailer::Base.deliveries array. | 24 | # ActionMailer::Base.deliveries array. |
23 | config.action_mailer.delivery_method = :test | 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 | end | 27 | end |
features/delete_profile.feature
@@ -13,6 +13,7 @@ Feature: delete profile | @@ -13,6 +13,7 @@ Feature: delete profile | ||
13 | | sample-community | Sample Community | | 13 | | sample-community | Sample Community | |
14 | And "Maria Silva" is a member of "Sample Community" | 14 | And "Maria Silva" is a member of "Sample Community" |
15 | 15 | ||
16 | + @selenium | ||
16 | Scenario: deleting profile | 17 | Scenario: deleting profile |
17 | Given I am logged in as "joaosilva" | 18 | Given I am logged in as "joaosilva" |
18 | And I am on joaosilva's control panel | 19 | And I am on joaosilva's control panel |
@@ -45,6 +46,7 @@ Feature: delete profile | @@ -45,6 +46,7 @@ Feature: delete profile | ||
45 | When I follow "Community Info and settings" | 46 | When I follow "Community Info and settings" |
46 | Then I should see "Delete profile" | 47 | Then I should see "Delete profile" |
47 | 48 | ||
49 | + @selenium | ||
48 | Scenario: community admin deletes the community | 50 | Scenario: community admin deletes the community |
49 | Given "Joao Silva" is admin of "Sample Community" | 51 | Given "Joao Silva" is admin of "Sample Community" |
50 | And I am logged in as "joaosilva" | 52 | And I am logged in as "joaosilva" |
@@ -73,6 +75,7 @@ Feature: delete profile | @@ -73,6 +75,7 @@ Feature: delete profile | ||
73 | When I follow "Enterprise Info and settings" | 75 | When I follow "Enterprise Info and settings" |
74 | Then I should see "Delete profile" | 76 | Then I should see "Delete profile" |
75 | 77 | ||
78 | + @selenium | ||
76 | Scenario: enterprise admin deletes the enterprise | 79 | Scenario: enterprise admin deletes the enterprise |
77 | Given the following enterprise | 80 | Given the following enterprise |
78 | | identifier | name | | 81 | | identifier | name | |
@@ -98,6 +101,7 @@ Feature: delete profile | @@ -98,6 +101,7 @@ Feature: delete profile | ||
98 | And I go to /myprofile/sample-enterprise/profile_editor/destroy_profile | 101 | And I go to /myprofile/sample-enterprise/profile_editor/destroy_profile |
99 | Then I should see "Access denied" | 102 | Then I should see "Access denied" |
100 | 103 | ||
104 | + @selenium | ||
101 | Scenario: environment admin deletes profile | 105 | Scenario: environment admin deletes profile |
102 | Given I am logged in as admin | 106 | Given I am logged in as admin |
103 | And I am on joaosilva's control panel | 107 | And I am on joaosilva's control panel |
features/edit_article.feature
@@ -20,6 +20,7 @@ Feature: edit article | @@ -20,6 +20,7 @@ Feature: edit article | ||
20 | And I fill in "Title" with "My Folder" | 20 | And I fill in "Title" with "My Folder" |
21 | And I press "Save" | 21 | And I press "Save" |
22 | And I go to joaosilva's control panel | 22 | And I go to joaosilva's control panel |
23 | + And I follow "Manage Content" | ||
23 | Then I should see "My Folder" | 24 | Then I should see "My Folder" |
24 | 25 | ||
25 | @selenium | 26 | @selenium |
features/members_block.feature
@@ -29,6 +29,7 @@ Feature: | @@ -29,6 +29,7 @@ Feature: | ||
29 | And I follow "Manage my groups" | 29 | And I follow "Manage my groups" |
30 | Then I should see "Sample Community" | 30 | Then I should see "Sample Community" |
31 | 31 | ||
32 | + @selenium | ||
32 | Scenario: a user can leave a community by members block's button | 33 | Scenario: a user can leave a community by members block's button |
33 | Given "Maria Silva" is a member of "Sample Community" | 34 | Given "Maria Silva" is a member of "Sample Community" |
34 | And I am logged in as "mariasilva" | 35 | And I am logged in as "mariasilva" |
features/register_enterprise.feature
@@ -77,6 +77,7 @@ Feature: register enterprise | @@ -77,6 +77,7 @@ Feature: register enterprise | ||
77 | Then I should see "Contact person can't be blank" | 77 | Then I should see "Contact person can't be blank" |
78 | Then I should see "Contact email can't be blank" | 78 | Then I should see "Contact email can't be blank" |
79 | 79 | ||
80 | + @selenium | ||
80 | Scenario: a user register an enterprise successfully through the admin | 81 | Scenario: a user register an enterprise successfully through the admin |
81 | validator method and the admin accepts | 82 | validator method and the admin accepts |
82 | Given organization_approval_method is "admin" on environment | 83 | Given organization_approval_method is "admin" on environment |
@@ -133,8 +134,9 @@ Feature: register enterprise | @@ -133,8 +134,9 @@ Feature: register enterprise | ||
133 | When I follow "Manage my groups" | 134 | When I follow "Manage my groups" |
134 | Then I should not see "My Enterprise" | 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 | Given organization_approval_method is "region" on environment | 140 | Given organization_approval_method is "region" on environment |
139 | And I follow "Manage my groups" | 141 | And I follow "Manage my groups" |
140 | And the following enterprise | 142 | And the following enterprise |
features/step_definitions/noosfero_steps.rb
@@ -435,20 +435,13 @@ Given /^the mailbox is empty$/ do | @@ -435,20 +435,13 @@ Given /^the mailbox is empty$/ do | ||
435 | end | 435 | end |
436 | 436 | ||
437 | Given /^the (.+) mail (?:is|has) (.+) (.+)$/ do |position, field, value| | 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 | end | 440 | end |
444 | 441 | ||
445 | Given /^the (.+) mail (.+) is like (.+)$/ do |position, field, regexp| | 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 | end | 445 | end |
453 | 446 | ||
454 | Given /^the following environment configuration$/ do |table| | 447 | Given /^the following environment configuration$/ do |table| |
@@ -0,0 +1,16 @@ | @@ -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,7 +40,7 @@ module NavigationHelpers | ||
40 | "/myprofile/#{$2}/profile_design/edit/#{block.id}" | 40 | "/myprofile/#{$2}/profile_design/edit/#{block.id}" |
41 | 41 | ||
42 | when /^(.*)'s homepage$/ | 42 | when /^(.*)'s homepage$/ |
43 | - '/' + profile_identifier($1) + '/' | 43 | + '/' + profile_identifier($1) |
44 | 44 | ||
45 | when /^(.*)'s blog$/ | 45 | when /^(.*)'s blog$/ |
46 | '/%s/blog' % profile_identifier($1) | 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 | Capybara.default_driver = :selenium | 2 | Capybara.default_driver = :selenium |
7 | Capybara.register_driver :selenium do |app| | 3 | Capybara.register_driver :selenium do |app| |
8 | Capybara::Selenium::Driver.new(app, :browser => :firefox) | 4 | Capybara::Selenium::Driver.new(app, :browser => :firefox) |
9 | end | 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 | Before('@ignore-hidden-elements') do | 7 | Before('@ignore-hidden-elements') do |
20 | Capybara.ignore_hidden_elements = true | 8 | Capybara.ignore_hidden_elements = true |
21 | end | 9 | end |
@@ -23,8 +11,4 @@ end | @@ -23,8 +11,4 @@ end | ||
23 | Capybara.default_wait_time = 30 | 11 | Capybara.default_wait_time = 30 |
24 | Capybara.server_host = "localhost" | 12 | Capybara.server_host = "localhost" |
25 | 13 | ||
26 | -After do | ||
27 | - DatabaseCleaner.clean | ||
28 | -end | ||
29 | - | ||
30 | World(Capybara) | 14 | World(Capybara) |