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
app/controllers/public/enterprise_registration_controller.rb
... | ... | @@ -4,7 +4,7 @@ class EnterpriseRegistrationController < ApplicationController |
4 | 4 | before_filter :login_required |
5 | 5 | |
6 | 6 | # Just go to the first step. |
7 | - # | |
7 | + # | |
8 | 8 | # FIXME: shouldn't this action present some sort of welcome message and point |
9 | 9 | # to the first step explicitly? |
10 | 10 | def index |
... | ... | @@ -15,7 +15,7 @@ class EnterpriseRegistrationController < ApplicationController |
15 | 15 | @create_enterprise.target = Profile.find(params[:create_enterprise][:target_id]) |
16 | 16 | end |
17 | 17 | elsif @validation == :admin || @validation == :none |
18 | - @create_enterprise.target = environment | |
18 | + @create_enterprise.target = environment | |
19 | 19 | end |
20 | 20 | @create_enterprise.requestor = user |
21 | 21 | the_action = |
... | ... | @@ -40,7 +40,7 @@ class EnterpriseRegistrationController < ApplicationController |
40 | 40 | |
41 | 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 | 45 | # Posts back. |
46 | 46 | def basic_information | ... | ... |
app/models/create_enterprise.rb
... | ... | @@ -22,7 +22,7 @@ class CreateEnterprise < Task |
22 | 22 | #checks if the validation method is region to validates |
23 | 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 | 27 | # checks for actual attributes |
28 | 28 | validates_presence_of :requestor_id, :target_id | ... | ... |
features/members_block.feature
... | ... | @@ -29,7 +29,6 @@ Feature: |
29 | 29 | And I follow "Manage my groups" |
30 | 30 | Then I should see "Sample Community" |
31 | 31 | |
32 | - @selenium | |
33 | 32 | Scenario: a user can leave a community by members block's button |
34 | 33 | Given "Maria Silva" is a member of "Sample Community" |
35 | 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 | 55 | end |
56 | 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 | 62 | # Use this to fill in an entire form with data from a table. Example: |
59 | 63 | # |
60 | 64 | # When I fill in the following: | ... | ... |
features/support/selenium.rb
1 | +require 'selenium/webdriver' | |
1 | 2 | |
2 | 3 | Capybara.default_driver = :selenium |
3 | 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 | 8 | end |
6 | 9 | |
7 | 10 | Before('@ignore-hidden-elements') do | ... | ... |