lib/quke/configuration.rb in quke-0.2.8 vs lib/quke/configuration.rb in quke-0.3.0

- old
+ new

@@ -90,10 +90,23 @@ # This use of Yaml.load to convert a string to a boolean comes from # http://stackoverflow.com/a/21804027/6117745 YAML.load(@data['stop_on_error']) end + # Return the value for +max_wait_time+ + # + # +max_wait_time+ is the time Capybara will spend waiting for an element + # to appear. It's default is normally 2 seconds but you may want to increase + # this is you are having to deal with a site that is not performant or prone + # to delays. + # + # If the value is not set in config file, it will default to whatever is the + # current Capybara value for default_max_wait_time. + def max_wait_time + @data['max_wait_time'] + end + # Return the hash of +browserstack+ options. # # If you select the browserstack driver, there are a number of options you # can pass through to setup your browserstack tests, username and auth_key # being the critical ones. @@ -120,10 +133,14 @@ # to the different drivers when registering them with Capybara. def use_proxy? proxy['host'] == '' ? false : true end + def custom + @data['custom'] + end + # Override to_s to output the contents of Config as a readable string rather # than the standard object output you get. def to_s @data.to_s end @@ -136,19 +153,25 @@ data['proxy'] = proxy_data(data['proxy']) data end # rubocop:disable Metrics/AbcSize + # rubocop:disable Metrics/CyclomaticComplexity + # rubocop:disable Metrics/PerceivedComplexity def default_data!(data) data.merge( 'features_folder' => (data['features'] || 'features').downcase.strip, 'app_host' => (data['app_host'] || '').downcase.strip, 'driver' => (data['driver'] || 'phantomjs').downcase.strip, 'pause' => (data['pause'] || '0').to_s.downcase.strip.to_i, - 'stop_on_error' => (data['stop_on_error'] || 'false').to_s.downcase.strip + 'stop_on_error' => (data['stop_on_error'] || 'false').to_s.downcase.strip, + 'max_wait_time' => (data['max_wait_time'] || Capybara.default_max_wait_time).to_s.downcase.strip.to_i, + 'custom' => (data['custom'] || nil) ) end # rubocop:enable Metrics/AbcSize + # rubocop:enable Metrics/CyclomaticComplexity + # rubocop:enable Metrics/PerceivedComplexity # rubocop:disable Metrics/MethodLength def browserstack_data(data) data = {} if data.nil? data.merge(