Commit 92def34ad25f9d494cf8c224cba758a99e012fbb
1 parent
525cc340
Exists in
master
and in
20 other branches
rails4: fix selenium tests
Showing
6 changed files
with
13 additions
and
7 deletions
Show diff stats
.travis.yml
| @@ -40,7 +40,7 @@ env: | @@ -40,7 +40,7 @@ env: | ||
| 40 | - TASK=test:units | 40 | - TASK=test:units |
| 41 | - TASK=test:functionals | 41 | - TASK=test:functionals |
| 42 | - TASK=test:integration | 42 | - TASK=test:integration |
| 43 | - - TASK=cucumber | 43 | + - TASK=cucumber LANG=en |
| 44 | - TASK=selenium | 44 | - TASK=selenium |
| 45 | - TASK=test:noosfero_plugins | 45 | - TASK=test:noosfero_plugins |
| 46 | 46 |
app/controllers/public/enterprise_registration_controller.rb
| @@ -4,7 +4,7 @@ class EnterpriseRegistrationController < ApplicationController | @@ -4,7 +4,7 @@ class EnterpriseRegistrationController < ApplicationController | ||
| 4 | before_filter :login_required | 4 | before_filter :login_required |
| 5 | 5 | ||
| 6 | # Just go to the first step. | 6 | # Just go to the first step. |
| 7 | - # | 7 | + # |
| 8 | # FIXME: shouldn't this action present some sort of welcome message and point | 8 | # FIXME: shouldn't this action present some sort of welcome message and point |
| 9 | # to the first step explicitly? | 9 | # to the first step explicitly? |
| 10 | def index | 10 | def index |
| @@ -15,7 +15,7 @@ class EnterpriseRegistrationController < ApplicationController | @@ -15,7 +15,7 @@ class EnterpriseRegistrationController < ApplicationController | ||
| 15 | @create_enterprise.target = Profile.find(params[:create_enterprise][:target_id]) | 15 | @create_enterprise.target = Profile.find(params[:create_enterprise][:target_id]) |
| 16 | end | 16 | end |
| 17 | elsif @validation == :admin || @validation == :none | 17 | elsif @validation == :admin || @validation == :none |
| 18 | - @create_enterprise.target = environment | 18 | + @create_enterprise.target = environment |
| 19 | end | 19 | end |
| 20 | @create_enterprise.requestor = user | 20 | @create_enterprise.requestor = user |
| 21 | the_action = | 21 | the_action = |
| @@ -40,7 +40,7 @@ class EnterpriseRegistrationController < ApplicationController | @@ -40,7 +40,7 @@ class EnterpriseRegistrationController < ApplicationController | ||
| 40 | 40 | ||
| 41 | protected | 41 | protected |
| 42 | 42 | ||
| 43 | - # Fill in the form and select your Region. | 43 | + # Fill in the form and select your Region. |
| 44 | # | 44 | # |
| 45 | # Posts back. | 45 | # Posts back. |
| 46 | def basic_information | 46 | def basic_information |
app/models/create_enterprise.rb
| @@ -22,7 +22,7 @@ class CreateEnterprise < Task | @@ -22,7 +22,7 @@ class CreateEnterprise < Task | ||
| 22 | #checks if the validation method is region to validates | 22 | #checks if the validation method is region to validates |
| 23 | validates_presence_of :region_id, :if => lambda { |obj| obj.environment.organization_approval_method == :region } | 23 | validates_presence_of :region_id, :if => lambda { |obj| obj.environment.organization_approval_method == :region } |
| 24 | 24 | ||
| 25 | - validates_numericality_of :foundation_year, only_integer: true, allow_nil: true | 25 | + validates_numericality_of :foundation_year, only_integer: true, if: -> o { o.foundation_year.present? } |
| 26 | 26 | ||
| 27 | # checks for actual attributes | 27 | # checks for actual attributes |
| 28 | validates_presence_of :requestor_id, :target_id | 28 | validates_presence_of :requestor_id, :target_id |
features/members_block.feature
| @@ -29,7 +29,6 @@ Feature: | @@ -29,7 +29,6 @@ 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 | ||
| 33 | Scenario: a user can leave a community by members block's button | 32 | Scenario: a user can leave a community by members block's button |
| 34 | Given "Maria Silva" is a member of "Sample Community" | 33 | Given "Maria Silva" is a member of "Sample Community" |
| 35 | And I am logged in as "mariasilva" | 34 | And I am logged in as "mariasilva" |
features/step_definitions/web_steps.rb
| @@ -55,6 +55,10 @@ When /^(?:|I )fill in "([^"]*)" for "([^"]*)"(?: within "([^"]*)")?$/ do |value, | @@ -55,6 +55,10 @@ When /^(?:|I )fill in "([^"]*)" for "([^"]*)"(?: within "([^"]*)")?$/ do |value, | ||
| 55 | end | 55 | end |
| 56 | end | 56 | end |
| 57 | 57 | ||
| 58 | +When /^(?:|I )move the cursor over "([^"]*)"/ do |selector| | ||
| 59 | + find(selector).hover if Capybara.default_driver == :selenium | ||
| 60 | +end | ||
| 61 | + | ||
| 58 | # Use this to fill in an entire form with data from a table. Example: | 62 | # Use this to fill in an entire form with data from a table. Example: |
| 59 | # | 63 | # |
| 60 | # When I fill in the following: | 64 | # When I fill in the following: |
features/support/selenium.rb
| 1 | +require 'selenium/webdriver' | ||
| 1 | 2 | ||
| 2 | Capybara.default_driver = :selenium | 3 | Capybara.default_driver = :selenium |
| 3 | Capybara.register_driver :selenium do |app| | 4 | Capybara.register_driver :selenium do |app| |
| 4 | - Capybara::Selenium::Driver.new(app, :browser => :firefox) | 5 | + profile = Selenium::WebDriver::Firefox::Profile.new |
| 6 | + profile.native_events = true | ||
| 7 | + Capybara::Selenium::Driver.new app, browser: :firefox, profile: profile | ||
| 5 | end | 8 | end |
| 6 | 9 | ||
| 7 | Before('@ignore-hidden-elements') do | 10 | Before('@ignore-hidden-elements') do |