##// END OF EJS Templates
increase Capybara.default_wait_time from 12 to 20 (#12822)...
Toshi MARUYAMA -
r11747:484a3ffc8aa1
parent child
Show More
@@ -1,72 +1,72
1 1 # Redmine - project management software
2 2 # Copyright (C) 2006-2013 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 require File.expand_path('../../test_helper', __FILE__)
19 19 require 'capybara/rails'
20 20
21 21 Capybara.default_driver = :selenium
22 22 Capybara.register_driver :selenium do |app|
23 23 # Use the following driver definition to test locally using Chrome
24 24 # (also requires chromedriver to be in PATH)
25 25 # Capybara::Selenium::Driver.new(app, :browser => :chrome)
26 26 # Add :switches => %w[--lang=en] to force default browser locale to English
27 27 # Default for Selenium remote driver is to connect to local host on port 4444
28 28 # This can be change using :url => 'http://localhost:9195' if necessary
29 29 # PhantomJS 1.8 now directly supports Webdriver Wire API,
30 30 # simply run it with `phantomjs --webdriver 4444`
31 31 # Add :desired_capabilities => Selenium::WebDriver::Remote::Capabilities.internet_explorer)
32 32 # to run on Selenium Grid Hub with IE
33 33 Capybara::Selenium::Driver.new(app, :browser => :remote)
34 34 end
35 35
36 36 # default: 2
37 Capybara.default_wait_time = 12
37 Capybara.default_wait_time = 20
38 38
39 39 DatabaseCleaner.strategy = :truncation
40 40
41 41 module Redmine
42 42 module UiTest
43 43 # Base class for UI tests
44 44 class Base < ActionDispatch::IntegrationTest
45 45 include Capybara::DSL
46 46
47 47 # Stop ActiveRecord from wrapping tests in transactions
48 48 # Transactional fixtures do not work with Selenium tests, because Capybara
49 49 # uses a separate server thread, which the transactions would be hidden
50 50 self.use_transactional_fixtures = false
51 51
52 52 # Should not depend on locale since Redmine displays login page
53 53 # using default browser locale which depend on system locale for "real" browsers drivers
54 54 def log_user(login, password)
55 55 visit '/my/page'
56 56 assert_equal '/login', current_path
57 57 within('#login-form form') do
58 58 fill_in 'username', :with => login
59 59 fill_in 'password', :with => password
60 60 find('input[name=login]').click
61 61 end
62 62 assert_equal '/my/page', current_path
63 63 end
64 64
65 65 teardown do
66 66 Capybara.reset_sessions! # Forget the (simulated) browser state
67 67 Capybara.use_default_driver # Revert Capybara.current_driver to Capybara.default_driver
68 68 DatabaseCleaner.clean
69 69 end
70 70 end
71 71 end
72 72 end
General Comments 0
You need to be logged in to leave comments. Login now