Module: Utilities
- Defined in:
- lib/utilities/utilities.rb
Class Method Summary collapse
- .browser=(browser) ⇒ Object
- .browser_options=(*opts) ⇒ Object
- .delete_browser_options ⇒ Object
- .download_android_build ⇒ Object
- .download_build(name, url) ⇒ Object
- .download_ios_build ⇒ Object
- .feature_path=(path) ⇒ Object
- .helper_path=(path) ⇒ Object
- .page_path=(path) ⇒ Object
- .parallel_run(opts = nil, _settings = nil) ⇒ Object
- .platform=(platform) ⇒ Object
- .run(opts = nil) ⇒ Object
- .spec_path=(path) ⇒ Object
- .url=(url) ⇒ Object
Class Method Details
.browser=(browser) ⇒ Object
10 11 12 13 |
# File 'lib/utilities/utilities.rb', line 10 def browser=(browser) config['browser'] = browser overwrite_yaml end |
.browser_options=(*opts) ⇒ Object
45 46 47 48 |
# File 'lib/utilities/utilities.rb', line 45 def (*opts) config['browser_options'] = opts.flatten overwrite_yaml end |
.delete_browser_options ⇒ Object
50 51 52 53 |
# File 'lib/utilities/utilities.rb', line 50 def config.delete('browser_options') overwrite_yaml end |
.download_android_build ⇒ Object
65 66 67 68 |
# File 'lib/utilities/utilities.rb', line 65 def download_android_build download_build('Android-MyDemoAppRN.1.3.0.build-244.apk', 'https://github.com/saucelabs/my-demo-app-rn/releases/download/v1.3.0/Android-MyDemoAppRN.1.3.0.build-244.apk') end |
.download_build(name, url) ⇒ Object
75 76 77 78 79 80 81 82 |
# File 'lib/utilities/utilities.rb', line 75 def download_build(name, url) response = Faraday.get(url) build_url = Faraday.get(response.headers['location']) File.open(name, 'wb') do |file| file.write(build_url.body) end end |
.download_ios_build ⇒ Object
70 71 72 73 |
# File 'lib/utilities/utilities.rb', line 70 def download_ios_build download_build('iOS-Simulator-MyRNDemoApp.1.3.0-162.zip', 'https://github.com/saucelabs/my-demo-app-rn/releases/download/v1.3.0/iOS-Simulator-MyRNDemoApp.1.3.0-162.zip') end |
.feature_path=(path) ⇒ Object
25 26 27 28 |
# File 'lib/utilities/utilities.rb', line 25 def feature_path=(path) config['feature_path'] = path overwrite_yaml end |
.helper_path=(path) ⇒ Object
30 31 32 33 |
# File 'lib/utilities/utilities.rb', line 30 def helper_path=(path) config['helper_path'] = path overwrite_yaml end |
.page_path=(path) ⇒ Object
15 16 17 18 |
# File 'lib/utilities/utilities.rb', line 15 def page_path=(path) config['page_path'] = path overwrite_yaml end |
.parallel_run(opts = nil, _settings = nil) ⇒ Object
60 61 62 63 |
# File 'lib/utilities/utilities.rb', line 60 def parallel_run(opts = nil, _settings = nil) command = File.directory?('spec') ? 'parallel_rspec spec/' : 'parallel_cucumber features' system "#{command} #{opts}" end |
.platform=(platform) ⇒ Object
40 41 42 43 |
# File 'lib/utilities/utilities.rb', line 40 def platform=(platform) config['platform'] = platform overwrite_yaml end |
.run(opts = nil) ⇒ Object
55 56 57 58 |
# File 'lib/utilities/utilities.rb', line 55 def run(opts = nil) command = File.directory?('spec') ? 'rspec spec/' : 'cucumber features' system "#{command} #{opts}" end |
.spec_path=(path) ⇒ Object
20 21 22 23 |
# File 'lib/utilities/utilities.rb', line 20 def spec_path=(path) config['spec_path'] = path overwrite_yaml end |
.url=(url) ⇒ Object
35 36 37 38 |
# File 'lib/utilities/utilities.rb', line 35 def url=(url) config['url'] = url overwrite_yaml end |