Patch #37558 » 0001-Upgrade-webdrivers.patch
Gemfile | ||
---|---|---|
97 | 97 |
# For running system tests |
98 | 98 |
gem 'puma' |
99 | 99 |
gem 'capybara', '~> 3.36.0' |
100 |
gem "selenium-webdriver", "~> 3.142.7"
|
|
101 |
gem 'webdrivers', '4.6.1', require: false
|
|
100 |
gem "selenium-webdriver", Gem.ruby_version < Gem::Version.new('2.7') ? "4.1.0" : "~> 4.3.0"
|
|
101 |
gem 'webdrivers', '~> 5.0.0', require: false
|
|
102 | 102 |
# RuboCop |
103 | 103 |
gem 'rubocop', '~> 1.33.0' |
104 | 104 |
gem 'rubocop-performance', '~> 1.14.2' |
test/application_system_test_case.rb | ||
---|---|---|
18 | 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 | |
20 | 20 |
require File.expand_path('../test_helper', __FILE__) |
21 |
require 'webdrivers/chromedriver' |
|
22 | 21 | |
23 | 22 |
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase |
24 | 23 |
DOWNLOADS_PATH = File.expand_path(File.join(Rails.root, 'tmp', 'downloads')) |
... | ... | |
32 | 31 |
GOOGLE_CHROME_OPTS_ARGS = ENV['GOOGLE_CHROME_OPTS_ARGS'].split(",") if ENV['GOOGLE_CHROME_OPTS_ARGS'] |
33 | 32 | |
34 | 33 |
options = {} |
34 |
if ENV['SELENIUM_REMOTE_URL'] |
|
35 |
options[:url] = ENV['SELENIUM_REMOTE_URL'] |
|
36 |
options[:browser] = :remote |
|
37 |
else |
|
38 |
require 'webdrivers/chromedriver' |
|
39 |
end |
|
40 | ||
35 | 41 |
# Allow running tests using a remote Selenium hub |
36 |
options[:url] = ENV['SELENIUM_REMOTE_URL'] if ENV['SELENIUM_REMOTE_URL'] |
|
37 |
options[:desired_capabilities] = Selenium::WebDriver::Remote::Capabilities.chrome( |
|
42 |
options[:capabilities] = Selenium::WebDriver::Remote::Capabilities.chrome( |
|
38 | 43 |
'goog:chromeOptions' => { |
39 | 44 |
'args' => GOOGLE_CHROME_OPTS_ARGS, |
40 | 45 |
'prefs' => { |
... | ... | |
51 | 56 |
) |
52 | 57 | |
53 | 58 |
setup do |
59 |
Capybara.app_host = "http://#{Capybara.server_host}:#{Capybara.server_port}" |
|
54 | 60 |
# Allow defining a custom app host (useful when using a remote Selenium hub) |
55 | 61 |
if ENV['CAPYBARA_APP_HOST'] |
56 | 62 |
Capybara.configure do |config| |
... | ... | |
87 | 93 |
end |
88 | 94 |
end |
89 | 95 | |
96 |
def finally(timeout = Capybara.default_max_wait_time, start = Time.now) |
|
97 |
yield |
|
98 |
return |
|
99 |
rescue Minitest::Assertion, Capybara::ElementNotFound |
|
100 |
raise if Time.now > start + timeout |
|
101 |
sleep 0.1 |
|
102 |
retry |
|
103 |
end |
|
104 | ||
105 | ||
90 | 106 |
def clear_downloaded_files |
91 | 107 |
FileUtils.rm downloaded_files |
92 | 108 |
end |
test/system/issues_test.rb | ||
---|---|---|
442 | 442 |
# wait for ajax response |
443 | 443 |
assert page.has_select?('issue_project_id', selected: 'OnlineStore') |
444 | 444 | |
445 |
submit_buttons = page.all('input[type=submit]') |
|
446 |
assert_equal 2, submit_buttons.size |
|
445 |
submit_buttons = [] |
|
446 |
finally do |
|
447 |
submit_buttons = page.all('input[type=submit]') |
|
448 |
assert_equal 2, submit_buttons.size |
|
449 |
end |
|
447 | 450 |
assert_equal 'Move', submit_buttons[0].value |
448 | 451 |
assert_equal 'Move and follow', submit_buttons[1].value |
449 | 452 | |
... | ... | |
506 | 509 |
# wait for ajax response |
507 | 510 |
assert page.has_select?('issue_project_id', selected: 'OnlineStore') |
508 | 511 | |
509 |
submit_buttons = page.all('input[type=submit]') |
|
510 |
assert_equal 2, submit_buttons.size |
|
512 |
submit_buttons = [] |
|
513 |
finally do |
|
514 |
submit_buttons = page.all('input[type=submit]') |
|
515 |
assert_equal 2, submit_buttons.size |
|
516 |
end |
|
511 | 517 |
assert_equal 'Copy', submit_buttons[0].value |
512 | 518 |
assert_equal 'Copy and follow', submit_buttons[1].value |
513 | 519 |
page.find('#issue_priority_id').select('High') |
test/system/timelog_test.rb | ||
---|---|---|
41 | 41 |
within 'form#new_time_entry' do |
42 | 42 |
select 'eCookbook', :from => 'Project' |
43 | 43 |
end |
44 |
within 'select#time_entry_activity_id' do |
|
45 |
assert has_content?('Development') |
|
46 |
assert !has_content?('Design') |
|
44 |
finally do |
|
45 |
within 'select#time_entry_activity_id' do |
|
46 |
assert has_content?('Development') |
|
47 |
assert !has_content?('Design') |
|
48 |
end |
|
47 | 49 |
end |
48 | 50 |
end |
49 | 51 |