support/doctest_helper.rb in watir-webdriver-0.9.3 vs support/doctest_helper.rb in watir-webdriver-0.9.9

- old
+ new

@@ -1,17 +1,25 @@ require 'watir-webdriver' require 'spec/watirspec/lib/watirspec' # # 1. If example does not start browser, start new one, reuse until example -# finishes and close after +# finishes and close after. # 2. If example starts browser and assigns it to local variable `browser`, -# it will still be closed +# it will still be closed. # def browser - @browser ||= Watir::Browser.start(WatirSpec.url_for('forms_with_input_elements.html')) + @browser ||= begin + opts = {} + opts[:args] = ['--no-sandbox'] if ENV['TRAVIS'] + + browser = Watir::Browser.new(:chrome, opts) + browser.goto WatirSpec.url_for('forms_with_input_elements.html') + + browser + end end YARD::Doctest.configure do |doctest| doctest.skip 'Watir::Browser.start' doctest.skip 'Watir::Cookies' @@ -19,11 +27,11 @@ doctest.skip 'Watir::Option' doctest.skip 'Watir::Screenshot' doctest.skip 'Watir::Window#size' doctest.skip 'Watir::Window#position' - %w[text ok close exists?].each do |name| + %w[text ok close exists? present?].each do |name| doctest.before("Watir::Alert##{name}") do browser.goto WatirSpec.url_for('alerts.html') browser.button(id: 'alert').click end end @@ -41,11 +49,11 @@ doctest.before('Watir::Element#attribute_value') do browser.goto WatirSpec.url_for('non_control_elements.html') end - %w[inner_html outer_html].each do |name| + %w[inner_html outer_html html].each do |name| doctest.before("Watir::Element##{name}") do browser.goto WatirSpec.url_for('inner_outer.html') end end @@ -62,6 +70,9 @@ end end if ENV['TRAVIS'] ENV['DISPLAY'] = ':99.0' + + Selenium::WebDriver::Chrome.path = File.expand_path 'chrome-linux/chrome' + Selenium::WebDriver::Chrome.driver_path = File.expand_path 'chrome-linux/chromedriver' end