gless 1.1.3 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -11,6 +11,7 @@ spec/reports
11
11
  test/tmp
12
12
  test/version_tmp
13
13
  tmp
14
+ gless/lib/config/development.yml
14
15
 
15
16
  # YARD artifacts
16
17
  .yardoc
data/Changelog.txt CHANGED
@@ -1,3 +1,5 @@
1
1
  - 1.1.0: 29 Jan 2013: By default, "element"s now ignore non-visible
2
2
  elements on the page; use { :invisible => true } to get the old
3
3
  behaviour.
4
+ - 1.2.0: 10 Jun 2013: Changes by bairyn. Added caching, finding
5
+ based on parent element, and block validators.
@@ -3,10 +3,11 @@
3
3
  :class: TestGithub
4
4
  :url: https://github.com
5
5
  :browser:
6
- :type: local # local or remote
7
- :browser: firefox # Which browser to use
6
+ :type: remote # Local or remote
7
+ :browser: chrome # Which browser to use
8
8
  :port: 4444 # If remote, port to connect to the selenimu server, otherwise ignored
9
9
  :verbose: false # Whether to engage in more verbose/info level logging
10
10
  :debug: false # Whether to engage in debug logging
11
11
  :screenshots: false # Whether, if debugging is on, to create screenshots as part of the replay log
12
12
  :thumbnails: false # Whether, if screenshots are on, to create small-ish "thumbnail" pictures on the replay page; requires the imagemagick system package and the mini_magick gem
13
+ :cache: false # Whether, by default, to cache elements, significantly improving performance. For individual elements, caching can be disabled by adding ":cache => false" to the element specifier.
@@ -5,7 +5,7 @@ module TestGithub
5
5
 
6
6
  url %r{^:base_url/blog$}
7
7
 
8
- expected_title 'The Official GitHub Blog · GitHub'
8
+ expected_title 'The GitHub Blog · GitHub'
9
9
 
10
10
  # Stub page, but BasePage stuff still works
11
11
 
@@ -3,10 +3,17 @@
3
3
  module TestGithub
4
4
  class SearchPage < TestGithub::BasePage
5
5
 
6
- element :search_input , :text_field , :class => 'search-page-input' , :validator => true
7
- element :search_button , :button , :text => 'Search' , :validator => true
6
+ element :search_form , :form , :id => 'search_form' , :validator => true
7
+ element :search_input , :text_field , :class => 'search-page-input' , :validator => true , :parent => :search_form
8
+ element :search_button , :button , :text => 'Search' , :validator => true , :parent => :search_form
9
+
10
+ # Test validator blocks.
11
+ add_validator do |browser, session|
12
+ browser.url =~ /search/
13
+ end
8
14
 
9
15
  url %r{^:base_url/search}
16
+ set_entry_url ':base_url/search'
10
17
 
11
18
  expected_title %r{^(Code Search · GitHub|Search · \S+ · GitHub)$}
12
19
 
@@ -35,14 +42,14 @@ module TestGithub
35
42
  end
36
43
 
37
44
  def repositories
38
- repos = self.divs.select { |div| div.class_name == 'result' }
45
+ repos = self.lis.select { |li| li.class_name == 'public source' }
39
46
 
40
47
  @session.log.debug "SearchPage: repositories: repos: #{repos.inspect}"
41
48
 
42
49
  repositories = Hash.new
43
50
  i = 0
44
51
  repos.each do |repo|
45
- link = repo.h2.a
52
+ link = repo.h3.a
46
53
  data = Hash.new
47
54
  data[:index] = i
48
55
  data[:link] = link
@@ -1,11 +1,10 @@
1
1
  module TestGithub
2
2
  class TestGithub::BasePage < Gless::BasePage
3
3
 
4
- element :home , :link , :href => "https://github.com/" , :validator => true , :click_destination => :LoginPage
5
- element :explore , :link , :href => "https://github.com/explore" , :validator => true , :click_destination => :ExplorePage
6
- element :search , :link , :href => "https://github.com/search" , :validator => true , :click_destination => :SearchPage
7
- element :features , :link , :href => "https://github.com/features" , :validator => true , :click_destination => :FeaturesPage
8
- element :blog , :link , :href => "https://github.com/blog" , :validator => true , :click_destination => :BlogPage
4
+ element :home , :link , :href => %r{^(https://github.com|)/?$} , :validator => true , :click_destination => :LoginPage
5
+ element :explore , :link , :href => %r{^(https://github.com|)/explore/?$} , :validator => true , :click_destination => :ExplorePage
6
+ element :features , :link , :href => %r{^(https://github.com|)/features/?$} , :validator => true , :click_destination => :FeaturesPage
7
+ element :blog , :link , :href => %r{^(https://github.com|)/blog/?$} , :validator => true , :click_destination => :BlogPage
9
8
 
10
9
  end
11
10
  end
@@ -34,7 +34,7 @@ module TestGithub
34
34
  def goto_repository_from_anywhere name, repo_pattern
35
35
  @logger.info "TestGithub Application: going to repository #{name}"
36
36
 
37
- @session.search.click
37
+ @session.enter TestGithub::SearchPage
38
38
 
39
39
  @session.search_for name
40
40
 
@@ -52,9 +52,6 @@ module TestGithub
52
52
  @logger.info "TestGithub Application: clicking explore."
53
53
  @session.explore.click
54
54
 
55
- @logger.info "TestGithub Application: clicking search."
56
- @session.search.click
57
-
58
55
  @logger.info "TestGithub Application: clicking features."
59
56
  @session.features.click
60
57
 
@@ -54,11 +54,21 @@ module Gless
54
54
  end
55
55
 
56
56
  # Calls back to Gless::Session. See overview documentation
57
- # fro +Gless::BasePage+
57
+ # for +Gless::BasePage+
58
58
  def inherited(klass)
59
59
  Gless::Session.add_page_class klass
60
60
  end
61
61
 
62
+ # @return [Array<String>] An list of element method names that the page
63
+ # model contains.
64
+ attr_writer :elements
65
+
66
+ # @return [Array] Just sets up a default (to wit, []) for
67
+ # elements
68
+ def elements
69
+ @elements ||= []
70
+ end
71
+
62
72
  # @return [Array<String>] An list of elements (actually just
63
73
  # their method names) that should *always* exist if this
64
74
  # page is loaded; used to wait for the page to load and
@@ -72,6 +82,17 @@ module Gless
72
82
  @validator_elements ||= []
73
83
  end
74
84
 
85
+ # @return [Array<String>] An list of validator procedures for this page.
86
+ # This provides a more low-level version of validator elements. For
87
+ # more information, see the documentation for +add_validator+.
88
+ attr_writer :validator_blocks
89
+
90
+ # @return [Array] Just sets up a default (to wit, []) for
91
+ # validator_blocks
92
+ def validator_blocks
93
+ @validator_blocks ||= []
94
+ end
95
+
75
96
  # Specifies the title that this page is expected to have.
76
97
  #
77
98
  # @param [String,Regexp] expected_title
@@ -98,8 +119,8 @@ module Gless
98
119
  # That's about as complicated as it gets.
99
120
  #
100
121
  # The first two arguments (name and type) are required. The
101
- # rest is a hash. +:validator_elements+ and +:click_destination+
102
- # (see below) have special meaning.
122
+ # rest is a hash. +:validator+, +:click_destination+, +:parent+,
123
+ # +:proc+, and +:cache+ (see below) have special meaning.
103
124
  #
104
125
  # Anything else is taken to be a Watir selector. If no
105
126
  # selector is forthcoming, the name is taken to be the element
@@ -126,6 +147,21 @@ module Gless
126
147
  # bit of the class name of the page that clicking on this
127
148
  # element leads to, if any.
128
149
  #
150
+ # @option opts [Symbol] :parent (nil) A symbol of a parent element
151
+ # to which matching is restricted.
152
+ #
153
+ # @option opts [Symbol] :cache (nil) If non-nil, overrides the default
154
+ # cache setting and determines whether caching is enabled for this
155
+ # element. If false, a new look-up will be performed each time the
156
+ # element is accessed, and, if true, a look-up will only be performed
157
+ # once until the session changes the page.
158
+ #
159
+ # @option opts [Symbol] :proc (nil) If present, specifies a manual,
160
+ # low-level procedure to return a watir element, which overrides other
161
+ # selectors. When the watir element is needed, this procedure is
162
+ # called with the parent watir element passed as the argument (see
163
+ # +:parent+) if it exists, and otherwise the browser.
164
+ #
129
165
  # @option opts [Object] ANY All other opts keys are used as
130
166
  # Watir selectors to find the element on the page.
131
167
  def element basename, type, opts = {}
@@ -134,11 +170,12 @@ module Gless
134
170
 
135
171
  # Promote various other things into selectors; do this before
136
172
  # we add in the default below
137
- non_selector_opts = [ :validator, :click_destination ]
173
+ non_selector_opts = [ :validator, :click_destination, :parent, :cache ]
138
174
  if ! opts[:selector]
175
+ opts[:selector] = {} if ! opts.keys.empty?
139
176
  opts.keys.each do |key|
140
- if ! non_selector_opts.member?(key)
141
- opts[:selector] = { key => opts[key] }
177
+ if (! non_selector_opts.member?(key)) && (key != :selector)
178
+ opts[:selector][key] = opts[key]
142
179
  opts.delete(key)
143
180
  end
144
181
  end
@@ -152,9 +189,12 @@ module Gless
152
189
  selector = opts[:selector]
153
190
  click_destination = opts[:click_destination]
154
191
  validator = opts[:validator]
192
+ parent = opts[:parent]
193
+ cache = opts[:cache]
155
194
 
156
- methname = basename.to_s.tr('-', '_')
195
+ methname = basename.to_s.tr('-', '_').to_sym
157
196
 
197
+ elements << methname
158
198
  if validator
159
199
  # No class-compile-time logging; it's way too much work, as this runs at *rake* time
160
200
  # $master_logger.debug "In GenericBasePage, for #{self.name}, element: #{basename} is a validator"
@@ -167,10 +207,21 @@ module Gless
167
207
  end
168
208
 
169
209
  define_method methname do
170
- Gless::WrapWatir.new(@browser, @session, type, selector, click_destination)
210
+ cached_elements[methname] ||= Gless::WrapWatir.new(@browser, @session, self, type, selector, click_destination, parent, cache)
171
211
  end
172
212
  end
173
213
 
214
+ # Adds the given block to the list of validators to this page, which is
215
+ # run to ensure that the page is loaded. This provides a low-level
216
+ # version of validator elements, which has more flexibility in
217
+ # determining whether the page is loaded. The block is given two
218
+ # arguments: the browser, and the session. The block is expected to
219
+ # return true if the validation succeeded; i.e., the page is currently
220
+ # loaded according to the validator's test; and otherwise false.
221
+ def add_validator &blk
222
+ validator_blocks << blk
223
+ end
224
+
174
225
  # @return [Rexexp,String] Used to give the URL string or pattern that matches this page; example:
175
226
  #
176
227
  # url %r{^:base_url/accounts/[0-9]+/apps$}
@@ -235,12 +286,14 @@ module Gless
235
286
  end
236
287
 
237
288
  # Fake inheritance time
238
- self.class.validator_elements = self.class.validator_elements + self.class.ancestors.map { |x| x.respond_to?( :validator_elements ) ? x.validator_elements : nil }
289
+ self.class.elements += self.class.ancestors.map { |x| x.respond_to?( :elements ) ? x.elements : nil }
290
+ self.class.elements = self.class.elements.flatten.compact.uniq
291
+ self.class.validator_elements += self.class.ancestors.map { |x| x.respond_to?( :validator_elements ) ? x.validator_elements : nil }
239
292
  self.class.validator_elements = self.class.validator_elements.flatten.compact.uniq
240
293
 
241
294
  self.class.url_patterns.map! { |x| substitute x }
242
295
 
243
- @session.log.debug "In GenericBasePage, for #{self.class.name}, init: class vars: #{self.class.entry_url}, #{self.class.url_patterns}, #{self.class.validator_elements}"
296
+ @session.log.debug "In GenericBasePage, for #{self.class.name}, init: class vars: #{self.class.entry_url}, #{self.class.url_patterns}, #{self.class.elements}, #{self.class.validator_elements}"
244
297
  end
245
298
 
246
299
  # Return true if the given url matches this page's patterns
@@ -264,6 +317,8 @@ module Gless
264
317
  def enter
265
318
  @session.log.debug "#{self.class.name}: enter"
266
319
 
320
+ raise "#{self.class.name}.enter: no entry_url has been set" if self.class.entry_url.nil?
321
+
267
322
  arrived? do
268
323
  @session.log.info "#{self.class.name}: about to goto #{self.class.entry_url} from #{@browser.url}"
269
324
  @browser.goto self.class.entry_url
@@ -296,6 +351,13 @@ module Gless
296
351
  end
297
352
  end
298
353
 
354
+ self.class.validator_blocks.each do |x|
355
+ if ! x.call @browser, @session
356
+ @session.log.debug "In GenericBasePage, for #{self.class.name}, arrived?: a validator block failed."
357
+ all_validate = false
358
+ end
359
+ end
360
+
299
361
  if all_validate
300
362
  if match_url( @browser.url )
301
363
  @session.log.debug "In GenericBasePage, for #{self.class.name}, arrived?: all validator elements found."
@@ -335,5 +397,19 @@ module Gless
335
397
  end
336
398
  end
337
399
  end
400
+
401
+ #******************************
402
+ # Object Level
403
+ #******************************
404
+
405
+ # @return [Hash] A hash of cached +WrapWatir+ elements indexed by the
406
+ # symbol name. This hash is cleared whenever the page changes.
407
+ attr_writer :cached_elements
408
+
409
+ # @return [Hash] A hash of cached +WrapWatir+ elements indexed by the
410
+ # symbol name. This hash is cleared whenever the page changes.
411
+ def cached_elements
412
+ @cached_elements ||= {}
413
+ end
338
414
  end
339
415
  end
data/lib/gless/browser.rb CHANGED
@@ -30,7 +30,7 @@ module Gless
30
30
  @browser = Watir::Browser.new(:remote, :url => "http://127.0.0.1:#{port}/wd/hub", :desired_capabilities => capabilities)
31
31
  else
32
32
  @logger.info "Launching local browser #{browser}"
33
- @browser = Watir::Browser.new :browser
33
+ @browser = Watir::Browser.new browser
34
34
  end
35
35
  end
36
36
 
data/lib/gless/session.rb CHANGED
@@ -123,6 +123,7 @@ module Gless
123
123
  @acceptable_pages.each do |page|
124
124
  log.debug "Session: Checking our current url, #{@browser.url}, for a match in #{page.name}: #{@pages[page].match_url(@browser.url)}"
125
125
  if @pages[page].match_url(@browser.url)
126
+ clear_cache
126
127
  good_page = true
127
128
  @current_page = page
128
129
  new_page = @pages[page]
@@ -281,21 +282,53 @@ module Gless
281
282
 
282
283
  # Deals with popup alerts in the browser (i.e. the javascript
283
284
  # alert() function). Always clicks "ok" or equivalent.
284
- #
285
- # FIXME: Check the text of the alert to see that it's the one
286
- # we want.
287
285
  #
288
286
  # Note that we're using @browser because things can be a bit
289
287
  # wonky during an alert; we don't want to run session's "are we
290
288
  # on the right page?" tests, or even talk to the page object.
291
- def handle_alert
292
- @browser.alert.wait_until_present
289
+ #
290
+ # @param [Boolean] wait_for_alert (true) Whether to wait until an alert
291
+ # is present, failing if the request times out, before processing it;
292
+ # otherwise, handle any alerts if there are any currently present.
293
+ #
294
+ # @param [String,Regexp] expected_text (nil) If not nil, the text of the
295
+ # pop-up alert is checked against this parameter; if it
296
+ # differs, an exception will be raised.
297
+ def handle_alert wait_for_alert = true, expected_text = nil
298
+ @browser.alert.wait_until_present if wait_for_alert
293
299
 
294
300
  if @browser.alert.exists?
295
- @browser.alert.ok
301
+ begin
302
+ if expected_text
303
+ current_text = @browser.alert.text
304
+ if (expected_text.kind_of? Regexp) ? expected_text !~ current_text : expected_text != current_text
305
+ msg = "The actual alert text differs from what was expected. current_text: #{current_text}; expected_text: #{expected_text}"
306
+ @logger.error msg
307
+ raise msg
308
+ end
309
+ end
310
+
311
+ @browser.alert.ok
312
+ rescue Selenium::WebDriver::Error::NoAlertPresentError => e
313
+ msg = "Alert no longer exists; likely closed by user: #{e.message}"
314
+ if wait_for_alert
315
+ @logger.warn msg
316
+ raise
317
+ else
318
+ @logger.info msg
319
+ end
320
+ end
296
321
  end
297
322
  end
298
323
 
324
+ # Clears the cached elements. Used before each page change.
325
+ #
326
+ # @param [Class] page_class The page class of the page whose cached
327
+ # elements are to be cleared; defaults to the current page.
328
+ def clear_cache page_class = nil
329
+ @pages[page_class || current_page].cached_elements = Hash.new
330
+ end
331
+
299
332
  # Does the heavy lifting, such as it is, for +acceptable_pages=+
300
333
  #
301
334
  # @param [Class, Symbol, Array] newpage A page class, or a
@@ -372,6 +405,7 @@ module Gless
372
405
  @acceptable_pages.each do |page|
373
406
  log.debug "Session: change_pages: Checking our current url, #{url}, for a match in #{page.name}: #{@pages[page].match_url(url)}"
374
407
  if @pages[page].match_url(url) and @pages[page].arrived? == true
408
+ clear_cache
375
409
  good_page = true
376
410
  @current_page = page
377
411
  new_page = @pages[page]
@@ -21,6 +21,10 @@ module Gless
21
21
  require 'rspec'
22
22
  include RSpec::Matchers
23
23
 
24
+ # @return [Gless::WrapWatir] The symbol for the parent of this element,
25
+ # restricting the scope of its selectorselement.
26
+ attr_accessor :parent
27
+
24
28
  # Sets up the wrapping.
25
29
  #
26
30
  # As a special case, note that the selectors can include a :proc
@@ -38,6 +42,7 @@ module Gless
38
42
  #
39
43
  # @param [Gless::Browser] browser
40
44
  # @param [Gless::Session] session
45
+ # @param [Gless::BasePage] page
41
46
  # @param [Symbol] orig_type The type of the element; normally
42
47
  # with watir you'd do something like
43
48
  #
@@ -51,32 +56,61 @@ module Gless
51
56
  #
52
57
  # is the selector arguments.
53
58
  # @param [Gless::BasePage, Array<Gless::BasePage>] click_destination Optional. A list of pages that are OK places to end up after we click on this element
54
- def initialize(browser, session, orig_type, orig_selector_args, click_destination)
59
+ # @param [Gless:WrapWatir] parents The symbol for the parent element under which the wrapped element is restricted.
60
+ # @param [Boolean] cache Whether to cache this element. If false,
61
+ # +find_elem+, unless overridden with its argument, performs a lookup
62
+ # each time it is invoked; otherwise, the watir element is recorded
63
+ # and kept until the session changes the page. If nil, the default value
64
+ # is retrieved from the config.
65
+ def initialize(browser, session, page, orig_type, orig_selector_args, click_destination, parent, cache)
55
66
  @browser = browser
56
67
  @session = session
68
+ @page = page
57
69
  @orig_type = orig_type
58
70
  @orig_selector_args = orig_selector_args
59
71
  @num_retries = 3
60
72
  @wait_time = 30
61
73
  @click_destination = click_destination
74
+ @parent = parent
75
+ @cache = cache.nil? ? @session.get_config(:global, :cache) : cache
62
76
  end
63
77
 
64
78
  # Finds the element in question; deals with the fact that the
65
- # selector could actually be a Proc.
79
+ # selector could actually be a Proc. If the element has already been
80
+ # found, return it; to find the element regardless, use find_elem_directly.
66
81
  #
67
82
  # Has no parameters because it uses @orig_type and
68
83
  # @orig_selector_args. If @orig_selector_args has a :proc
69
84
  # element, runs that with the browser as an argument, otherwise
70
85
  # just passes those variables to the Watir browser as normal.
71
- def find_elem
86
+ #
87
+ # @param [Boolean] use_cache If not nil, overrides the element's +cache+
88
+ # value. If false, the element is re-located; otherwise, if the element
89
+ # has already been found, return it.
90
+ def find_elem use_cache = nil
91
+ use_cache = @cache if use_cache.nil?
92
+ if use_cache
93
+ @cached_elem ||= find_elem_directly
94
+ else
95
+ @cached_elem = find_elem_directly
96
+ end
97
+ end
98
+
99
+ # Find the element in question, regardless of whether the element has
100
+ # already been identified. The cache is complete ignored and is not
101
+ # updated. To update the cache and re-locate the element, use +find_elem
102
+ # false+
103
+ def find_elem_directly
72
104
  tries=0
73
105
  begin
74
- # Do we want to return more than on element?
106
+ # Do we want to return more than one element?
75
107
  multiples = false
76
108
 
109
+ par = parent ? @page.send(parent).find_elem : @browser
110
+
77
111
  if @orig_selector_args.has_key? :proc
78
112
  # If it's a Proc, it can handle its own visibility checking
79
- return @orig_selector_args[:proc].call @browser
113
+ return @orig_selector_args[:proc].call par
80
114
  else
81
115
  # We want all the relevant elements, so force that if it's
82
116
  # not what was asked for
@@ -91,7 +125,7 @@ module Gless
91
125
  end
92
126
  end
93
127
  @session.log.debug "WrapWatir: find_elem: elements type: #{type}"
94
- elems = @browser.send(type, @orig_selector_args)
128
+ elems = par.send(type, @orig_selector_args)
95
129
  end
96
130
 
97
131
  @session.log.debug "WrapWatir: find_elem: elements identified by #{trimmed_selectors.inspect} initial version: #{elems.inspect}"
@@ -101,7 +135,7 @@ module Gless
101
135
  # Generally, watir-webdriver code expects *something*
102
136
  # back, and uses .present? to see if it's really there, so
103
137
  # we get the singleton to satisfy that need.
104
- return @browser.send(@orig_type, @orig_selector_args)
138
+ return par.send(@orig_type, @orig_selector_args)
105
139
  end
106
140
 
107
141
  # We got something unexpected; just give it back
data/lib/gless.rb CHANGED
@@ -6,7 +6,7 @@
6
6
  # project.
7
7
  module Gless
8
8
  # The current version number.
9
- VERSION = '1.1.3'
9
+ VERSION = '1.2.0'
10
10
 
11
11
  # Sets up the config, logger and browser instances, the ordering
12
12
  # of which is slightly tricky.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gless
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-07 00:00:00.000000000 Z
12
+ date: 2013-06-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -118,7 +118,6 @@ extensions: []
118
118
  extra_rdoc_files: []
119
119
  files:
120
120
  - .gitignore
121
- - .rvmrc
122
121
  - Changelog.txt
123
122
  - README.md
124
123
  - Rakefile
@@ -127,7 +126,6 @@ files:
127
126
  - examples/test_github/features/support/env.rb
128
127
  - examples/test_github/features/support/step_definitions/test_github_steps.rb
129
128
  - examples/test_github/features/test_github/test_github.feature
130
- - examples/test_github/lib/config/development.yml
131
129
  - examples/test_github/lib/config/development.yml.example
132
130
  - examples/test_github/lib/pages/test_github/blog_page.rb
133
131
  - examples/test_github/lib/pages/test_github/explore_page.rb
@@ -166,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
166
164
  version: '0'
167
165
  requirements: []
168
166
  rubyforge_project:
169
- rubygems_version: 1.8.24
167
+ rubygems_version: 1.8.25
170
168
  signing_key:
171
169
  specification_version: 3
172
170
  summary: A wrapper for Watir-WebDriver based on modelling web page and web site structure.
data/.rvmrc DELETED
@@ -1,34 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- # This is an RVM Project .rvmrc file, used to automatically load the ruby
4
- # development environment upon cd'ing into the directory
5
-
6
- # First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,
7
- # Only full ruby name is supported here, for short names use:
8
- # echo "rvm use 1.9.3" > .rvmrc
9
- environment_id="ruby-1.9.3-p194@gless"
10
-
11
- # Uncomment the following lines if you want to verify rvm version per project
12
- # rvmrc_rvm_version="1.14.12 (stable)" # 1.10.1 seams as a safe start
13
- # eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
14
- # echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
15
- # return 1
16
- # }
17
-
18
- # First we attempt to load the desired environment directly from the environment
19
- # file. This is very fast and efficient compared to running through the entire
20
- # CLI and selector. If you want feedback on which environment was used then
21
- # insert the word 'use' after --create as this triggers verbose mode.
22
- if [[ -d "${rvm_path:-$HOME/.rvm}/environments"
23
- && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
24
- then
25
- \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
26
- [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]] &&
27
- \. "${rvm_path:-$HOME/.rvm}/hooks/after_use" || true
28
- else
29
- # If the environment file has not yet been created, use the RVM CLI to select.
30
- rvm --create "$environment_id" || {
31
- echo "Failed to create RVM environment '${environment_id}'."
32
- return 1
33
- }
34
- fi
@@ -1,12 +0,0 @@
1
- :global: # This tag distinguishes the global config from the per-test configs; *do not remove*
2
- :site:
3
- :class: TestGithub
4
- :url: https://github.com
5
- :browser:
6
- :type: remote # Local or remote
7
- :browser: chrome # Which browser to use
8
- :port: 7444 # If remote, port to connect to the selenimu server, otherwise ignored
9
- :verbose: false # Whether to engage in more verbose/info level logging
10
- :debug: false # Whether to engage in debug logging
11
- :screenshots: false # Whether, if debugging is on, to create screenshots as part of the replay log
12
- :thumbnails: false # Whether, if screenshots are on, to create small-ish "thumbnail" pictures on the replay page; requires the imagemagick system package and the mini_magick gem