Class: UtilityCommands
- Inherits:
-
Thor
- Object
- Thor
- UtilityCommands
- Defined in:
- lib/commands/utility_commands.rb
Instance Method Summary collapse
- #browser(default_browser = nil) ⇒ Object
- #browser_options(*opts) ⇒ Object
- #desktop ⇒ Object
- #headless(toggle) ⇒ Object
- #path(default_path) ⇒ Object
- #platform(platform) ⇒ Object
- #raid ⇒ Object
- #start_appium ⇒ Object
- #timeout(seconds) ⇒ Object
- #url(default_url) ⇒ Object
- #viewport(dimensions) ⇒ Object
Instance Method Details
#browser(default_browser = nil) ⇒ Object
32 33 34 35 36 |
# File 'lib/commands/utility_commands.rb', line 32 def browser(default_browser = nil) Utilities.browser = default_browser if default_browser = [:opts] () if || [:delete] end |
#browser_options(*opts) ⇒ Object
42 43 44 45 |
# File 'lib/commands/utility_commands.rb', line 42 def (*opts) Utilities. = opts unless opts.empty? Utilities. if [:delete] end |
#desktop ⇒ Object
104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/commands/utility_commands.rb', line 104 def desktop require_relative '../utilities/desktop_downloader' version = DesktopDownloader.latest_version unless version say 'Could not reach GitHub releases. Check your internet connection.', :red return end say "Raider Desktop v#{version} available for #{DesktopDownloader.platform_display_name}" DesktopDownloader.download([:path]) say 'Raider Desktop downloaded successfully!', :green end |
#headless(toggle) ⇒ Object
49 50 51 52 53 54 |
# File 'lib/commands/utility_commands.rb', line 49 def headless(toggle) enabled = %w[on true 1 yes].include?(toggle.downcase) Utilities.headless = enabled state = enabled ? 'enabled' : 'disabled' say "Headless mode #{state}", :green end |
#path(default_path) ⇒ Object
15 16 17 18 |
# File 'lib/commands/utility_commands.rb', line 15 def path(default_path) type = .empty? ? 'page' : .keys.first Utilities.send("#{type}_path=", default_path) end |
#platform(platform) ⇒ Object
91 92 93 |
# File 'lib/commands/utility_commands.rb', line 91 def platform(platform) Utilities.platform = platform end |
#raid ⇒ Object
62 63 64 65 66 67 68 69 |
# File 'lib/commands/utility_commands.rb', line 62 def raid = [:opts] if [:parallel] Utilities.parallel_run() else Utilities.run() end end |
#start_appium ⇒ Object
96 97 98 |
# File 'lib/commands/utility_commands.rb', line 96 def start_appium system 'appium --base-path /wd/hub' end |
#timeout(seconds) ⇒ Object
79 80 81 |
# File 'lib/commands/utility_commands.rb', line 79 def timeout(seconds) Utilities.timeout = seconds end |
#url(default_url) ⇒ Object
22 23 24 |
# File 'lib/commands/utility_commands.rb', line 22 def url(default_url) Utilities.url = default_url end |
#viewport(dimensions) ⇒ Object
85 86 87 |
# File 'lib/commands/utility_commands.rb', line 85 def (dimensions) Utilities. = dimensions end |