fastlane-plugin-saucectl 0.1.1 → 0.1.2.pre

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ecc67f53ebd122fc5083aeb466912f6cec328f7d5f966221c504c02577aa9534
4
- data.tar.gz: c735f2e42ff6199e6429a9d8927a6164e59adce8d1e08dd6633a6bcef9e6d0fe
3
+ metadata.gz: 2bb0bc0c918e497c8c4ec0d560635d0a059bed8d5456c6df34f33a5aa626d9ba
4
+ data.tar.gz: 9f4626de2b041b65e8fd0882726f29ef1053ed8054499a704b13ca96773300fc
5
5
  SHA512:
6
- metadata.gz: 5057e84ec4249ff5d9568a94838334c4324ffbc08be2d4fe83510a771b56512800adce790c8f4169eba62d30957a724401befab78c0f224e79b0db4fcf4faad6
7
- data.tar.gz: 29bcaa1636728cb1915d135267233d7601901a1a6619d12c75bbef23c91dc513a470345e1306f620930c62e68b4e39ce3f43fd65228a10d5c510e6a4831b9579
6
+ metadata.gz: 14a4fdcd1d5ce125a1d08af53d51f5c82fcc44cdd4dbab14e315cd6b417daedd41d7c7be6c3a8d420211b6697bf340e40fb1749331f6aff34db9c930f4365967
7
+ data.tar.gz: c07918fee9b5067146ea9b840d11c495218bb21229cf22221ed217a25574beacfba97902fffb4fc24484d13d1a89a267dcc4d1524d2946e1db7a026166e96380
@@ -4,11 +4,10 @@ require_relative '../helper/installer'
4
4
  module Fastlane
5
5
  module Actions
6
6
  class InstallSaucectlAction < Action
7
- def self.run(version = nil)
8
- version_message = version[:version].nil? ? 'Installing with latest version of saucectl' : "Installing saucectl with version #{version[:version]}"
9
- UI.message("#{version_message} 🤖 🚀")
7
+ def self.run(param = '')
8
+ UI.message("Installing saucectl 🤖 🚀")
10
9
  installer = Saucectl::Installer.new
11
- installer.install(version)
10
+ installer.install
12
11
  end
13
12
 
14
13
  def self.description
@@ -16,16 +15,7 @@ module Fastlane
16
15
  end
17
16
 
18
17
  def self.details
19
- "Optionally set the tag of the version you wish to install. If not tag is set, the latest tag will be downloaded. See: https://github.com/saucelabs/saucectl/tags "
20
- end
21
-
22
- def self.available_options
23
- [
24
- FastlaneCore::ConfigItem.new(key: :version,
25
- description: "Set the tag of saucectl you wish to install",
26
- optional: true,
27
- type: String)
28
- ]
18
+ "Installs the Sauce Labs saucectl cli binary"
29
19
  end
30
20
 
31
21
  def self.authors
@@ -81,14 +81,6 @@ module Fastlane
81
81
  description: "Array of tests to execute",
82
82
  optional: true,
83
83
  type: Array),
84
- FastlaneCore::ConfigItem.new(key: :size,
85
- description: "Instructs saucectl to run only tests that are annotated with the matching size value i.e @SmallTest, @MediumTest or @LargeTest. Valid values are small, medium, or large. You may only specify one value for this property",
86
- optional: true,
87
- type: String),
88
- FastlaneCore::ConfigItem.new(key: :annotation,
89
- description: "Instructs saucectl to run only tests that match a custom annotation that you have set",
90
- optional: true,
91
- type: String),
92
84
  FastlaneCore::ConfigItem.new(key: :emulators,
93
85
  description: "The parent property that defines details for running this suite on virtual devices using an emulator",
94
86
  optional: true,
@@ -5,7 +5,7 @@ require_relative "file_utils"
5
5
 
6
6
  module Fastlane
7
7
  module Saucectl
8
- # This class is responsible for creating test execution plans for android applications and will distribute tests
8
+ # This class is responsible for creating test execution plans for ios applications and will distribute tests
9
9
  # that will be be executed via the cloud provider.
10
10
  #
11
11
  class Espresso
@@ -12,11 +12,11 @@ module Fastlane
12
12
  include FileUtils
13
13
  UI = FastlaneCore::UI unless Fastlane.const_defined?(:UI)
14
14
 
15
- def install(version)
16
- timeout_in_seconds = 90
15
+ def install
16
+ timeout_in_seconds = 30
17
17
  Timeout.timeout(timeout_in_seconds) do
18
18
  download_saucectl_installer
19
- execute_saucectl_installer(version)
19
+ execute_saucectl_installer
20
20
  UI.success("✅ Successfully installed saucectl runner binary 🚀")
21
21
  rescue OpenURI::HTTPError => e
22
22
  response = e.io
@@ -26,14 +26,13 @@ module Fastlane
26
26
 
27
27
  def download_saucectl_installer
28
28
  URI.open('sauce', 'wb') do |file|
29
- file << URI.open('https://saucelabs.github.io/saucectl/install', ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE).read
29
+ file << URI.open('https://saucelabs.github.io/saucectl/install').read
30
30
  end
31
31
  end
32
32
 
33
- def execute_saucectl_installer(version)
34
- saucectl_version = version[:version].nil? ? '' : "v#{version[:version]}"
35
- status = system("sh sauce #{saucectl_version}")
36
- status == 1 ? UI.user_error!("❌ failed to install saucectl") : status
33
+ def execute_saucectl_installer
34
+ status = system('sh sauce')
35
+ status == 1 ? UI.user_error!(" failed to install saucectl: #{stderr}") : status
37
36
  executable = 'saucectl'
38
37
  FileUtils.mv("bin/#{executable}", executable) unless File.exist?(executable)
39
38
  end
@@ -41,9 +40,7 @@ module Fastlane
41
40
  def system(*cmd)
42
41
  Open3.popen2e(*cmd) do |stdin, stdout_stderr, wait_thread|
43
42
  Thread.new do
44
- stdout_stderr.each do |out|
45
- UI.message(out)
46
- end
43
+ stdout_stderr.each { |out| UI.message(out) }
47
44
  end
48
45
  stdin.close
49
46
  wait_thread.value
@@ -25,9 +25,7 @@ module Fastlane
25
25
  def system(*cmd)
26
26
  Open3.popen2e(*cmd) do |stdin, stdout_stderr, wait_thread|
27
27
  Thread.new do
28
- stdout_stderr.each do |out|
29
- UI.message(out)
30
- end
28
+ stdout_stderr.each { |out| UI.message(out) }
31
29
  end
32
30
  stdin.close
33
31
  wait_thread.value
@@ -60,7 +60,16 @@ module Fastlane
60
60
  elsif @config[:test_class]
61
61
  custom_test_classes
62
62
  else
63
- default_execution_suite
63
+ test_suites = []
64
+ @config[:emulators].each do |emulator|
65
+ test_distribution_array.each do |test_type|
66
+ test_suites << {
67
+ 'name' => suite_name(test_type).downcase,
68
+ 'testOptions' => default_test_options(test_type)
69
+ }.merge(virtual_device_options(emulator))
70
+ end
71
+ end
72
+ test_suites
64
73
  end
65
74
  end
66
75
 
@@ -124,34 +133,17 @@ module Fastlane
124
133
  elsif @config[:test_class].kind_of?(Array)
125
134
  custom_test_classes
126
135
  else
127
- default_execution_suite
128
- end
129
- end
130
-
131
- def default_execution_suite
132
- type = @config[:annotation] ? 'annotation' : 'size'
133
- UI.user_error!("❌ execution by #{type} is not supported on the iOS platform!") if @config[:platform].eql?('ios') && (@config[:size] || @config[:annotation])
134
- is_real_device = @config[:devices]
135
- test_devices = @config[:devices] || @config[:emulators]
136
- test_suites = []
137
- if @config[:size] || @config[:annotation]
138
- test_devices.each do |device|
139
- test_suites << {
140
- 'name' => suite_name(@config[:size] || @config[:annotation]).downcase,
141
- 'testOptions' => default_test_options(@config[:size])
142
- }.merge(is_real_device ? real_device_options(device) : virtual_device_options(device))
143
- end
144
- else
145
- test_devices.each do |device|
136
+ test_suites = []
137
+ @config[:devices].each do |device|
146
138
  test_distribution_array.each do |test_type|
147
139
  test_suites << {
148
140
  'name' => suite_name(test_type).downcase,
149
141
  'testOptions' => default_test_options(test_type)
150
- }.merge(is_real_device ? real_device_options(device) : virtual_device_options(device))
142
+ }.merge(real_device_options(device))
151
143
  end
152
144
  end
145
+ test_suites
153
146
  end
154
- test_suites
155
147
  end
156
148
 
157
149
  def virtual_device_options(device)
@@ -190,24 +182,14 @@ module Fastlane
190
182
  end
191
183
 
192
184
  def default_test_options(test_type)
185
+ test_option_type = @config[:test_distribution].eql?('package') ? 'package' : 'class'
193
186
  if @config[:platform] == 'android'
194
- test_option_type(test_type)
187
+ { test_option_type => test_type }.merge(android_test_options)
195
188
  else
196
189
  { 'class' => test_type }
197
190
  end
198
191
  end
199
192
 
200
- def test_option_type(test_type)
201
- if @config[:size] || @config[:annotation]
202
- key = @config[:size] ? 'size' : 'annotation'
203
- value = @config[:size] || @config[:annotation]
204
- { key => value }.merge(android_test_options)
205
- else
206
- test_option_type = @config[:test_distribution].eql?('package') ? 'package' : 'class'
207
- { test_option_type => test_type }.merge(android_test_options)
208
- end
209
- end
210
-
211
193
  def android_test_options
212
194
  {
213
195
  'clearPackageData' => @config[:clear_data],
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Saucectl
3
- VERSION = '0.1.1'.freeze
3
+ VERSION = "0.1.2.pre"
4
4
  end
5
5
  end
@@ -1,9 +1,11 @@
1
- require 'fastlane/plugin/saucectl/version'
1
+ require 'fastlane'
2
2
 
3
3
  module Fastlane
4
4
  module Saucectl
5
+ UI = FastlaneCore::UI
6
+ # Return all .rb files inside the "actions" and "helper" directory
5
7
  def self.all_classes
6
- Dir[File.expand_path('*/{actions,helper}/*.rb', File.dirname(__FILE__))]
8
+ Dir[File.expand_path('**/actions/*_action.rb', File.dirname(__FILE__))]
7
9
  end
8
10
  end
9
11
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-saucectl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Hamilton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-27 00:00:00.000000000 Z
11
+ date: 2022-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -170,8 +170,6 @@ executables: []
170
170
  extensions: []
171
171
  extra_rdoc_files: []
172
172
  files:
173
- - LICENSE
174
- - README.md
175
173
  - lib/fastlane/plugin/saucectl.rb
176
174
  - lib/fastlane/plugin/saucectl/actions/delete_from_storage_action.rb
177
175
  - lib/fastlane/plugin/saucectl/actions/disabled_tests_action.rb
@@ -190,7 +188,6 @@ files:
190
188
  - lib/fastlane/plugin/saucectl/helper/storage.rb
191
189
  - lib/fastlane/plugin/saucectl/helper/suites.rb
192
190
  - lib/fastlane/plugin/saucectl/helper/xctest.rb
193
- - lib/fastlane/plugin/saucectl/strings/messages.yml
194
191
  - lib/fastlane/plugin/saucectl/version.rb
195
192
  homepage: https://github.com/ianrhamilton/fastlane-plugin-saucectl
196
193
  licenses:
@@ -205,17 +202,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
205
202
  requirements:
206
203
  - - ">="
207
204
  - !ruby/object:Gem::Version
208
- version: '2.5'
205
+ version: '2.6'
209
206
  required_rubygems_version: !ruby/object:Gem::Requirement
210
207
  requirements:
211
- - - ">="
208
+ - - ">"
212
209
  - !ruby/object:Gem::Version
213
- version: '0'
210
+ version: 1.3.1
214
211
  requirements: []
215
- rubygems_version: 3.3.10
212
+ rubygems_version: 3.3.7
216
213
  signing_key:
217
214
  specification_version: 4
218
- summary: Simplify the set up, configuration, upload, and execution of espresso and
219
- XCUITest on the Sauce Labs platform by utilizing fastlane which will enable you
220
- to test your iOS and Android apps at scale.
215
+ summary: Test your iOS and and Android apps at scale using Sauce Labs toolkit.
221
216
  test_files: []
data/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2021 Ian Hamilton <ian.ross.hamilton@gmail.com>
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
data/README.md DELETED
@@ -1,81 +0,0 @@
1
- # fastlane-plugin-saucectl
2
-
3
- [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-saucectl)
4
- [![Gem Version](https://badge.fury.io/rb/fastlane-plugin-saucectl.svg)](https://badge.fury.io/rb/fastlane-plugin-saucectl)
5
- [![Gem Downloads](https://img.shields.io/gem/dt/fastlane-plugin-saucectl?color=light-green)](https://img.shields.io/gem/dt/fastlane-plugin-saucectl)
6
-
7
- ## Getting Started
8
-
9
- This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-saucectl`, add it to your project by running:
10
-
11
- ```bash
12
- fastlane add_plugin saucectl
13
- ```
14
-
15
- ## About fastlane-plugin-saucectl
16
-
17
- The purpose of this plugin is to simplify the set up, configuration, upload, and execution of espresso and XCUITest on the Sauce Labs platform by utilizing fastlane which will enable you to test your iOS and Android apps at scale.
18
-
19
- **IMPORTANT:** in order for you to use this plugin to execute UI tests, your test class names must proceed with `Spec`, `Specs`, `Tests`, or `Test`, for example `ExampleSpec`, `ExampleSpecs`, `ExampleTest`, `ExampleTests`. Your test case names must also begin with test, for example `testIDoSomething`, `testIDoSomethingElse`. This is so that the the plugin can search for test classes and their included test cases.
20
-
21
- Failure to do this will result in missing test classes and test cases from your test run.
22
-
23
- **For a detailed introduction to each of the actions available within this plugin, please see the [documentation](https://ianrhamilton.github.io/fastlane-plugin-saucectl/#fastlane-plugin-saucectl)**.
24
-
25
- | Available Actions | Description |
26
- |---------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
27
- | `install_saucectl` | Downloads the Sauce Labs saucectl cli binary for test execution. Optionally specify the [version](https://github.com/saucelabs/saucectl/releases/) you wish to install or automatically download the latest. |
28
- | `sauce_upload` | Upload test artifacts to sauce labs storage |
29
- | `sauce_config` | Create SauceLabs configuration file for test execution based on given parameters |
30
- | `sauce_runner` | Execute automated tests on sauce labs platform via saucectl binary for specified configuration |
31
- | `delete_from_storage` | Delete test artifacts from sauce labs storage by storage id or group id |
32
- | `sauce_apps` | Returns the set of files by specific app id that have been uploaded to Sauce Storage by the requester |
33
- | `sauce_devices` | Returns a list of Device IDs for all devices in the data center that are currently free for testing. |
34
- | `disabled_tests` | Fetches any disabled ui test cases (for android searches for @Ignore tests, and for ios skipped tests within an xcode test plan). Plan is to use this in the future for generating pretty HTML reports |
35
-
36
- An order of which you may utilize the above actions in your continuous integration platform could be:
37
- 1. Install the saucectl binary via `install_saucectl`
38
- 2. Upload your test artifacts to Sauce Labs storage (for example app apk, and test runner apk)
39
- 3. Create config.yml for given parameters via `sauce_config`
40
- 4. Execute test based on specified config via `sauce_runner`
41
- 5. Delete test artifacts via `delete_from_storage` so that your storage does not fill up (if you're executing tests on every PR, for example)
42
-
43
- ## Example
44
-
45
- Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane test`.
46
-
47
- **Note to author:** Please set up a sample project to make it easy for users to explore what your plugin does. Provide everything that is necessary to try out the plugin in this project (including a sample Xcode/Android project if necessary)
48
-
49
- ## Run tests for this plugin
50
-
51
- To run both the tests, and code style validation, run
52
-
53
- ```
54
- rake
55
- ```
56
-
57
- To automatically fix many of the styling issues, use
58
- ```
59
- rubocop -a
60
- ```
61
-
62
- ## Issues and Feedback
63
-
64
- For any other issues and feedback about this plugin, please submit it to this repository.
65
-
66
- ## Troubleshooting
67
-
68
- If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
69
-
70
- ## Using _fastlane_ Plugins
71
-
72
- For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
73
-
74
- ## About _fastlane_
75
-
76
- _fastlane_ is the easiest way to automate beta deployments and releases for your iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).
77
-
78
- ## Buy me a coffee
79
- If you're enjoying this plugin, feel free to **optionally** buy me a coffee :)
80
-
81
- [!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/ianrhamilton)
@@ -1,12 +0,0 @@
1
- ---
2
- platform_error: "No platform specified, set using: platform: 'android'"
3
- app_path_error: "No App path given, set using: app_path: 'path/to/my/testApp.apk'"
4
- file_error: "No file path given, set using: app_path: 'path/to/my/testApp.apk'"
5
- app_name_error: "No App name given, set using: app_name: 'testApp.apk'"
6
- test_runner_app_error: "No Test runner application given, set using: test_runner_app: 'testRunnerApp.apk'"
7
- region_error: "$region is an invalid region. Supported regions are 'us' and 'eu'"
8
- sauce_username_error: "No sauce labs username provided, set using: sauce_username: 'sauce user name', or consider setting your credentials as environment variables."
9
- sauce_api_key_error: "No sauce labs access key provided, set using: sauce_access_key: '1234' or consider setting your credentials as environment variables."
10
- supported_regions: ['us', 'eu']
11
- accepted_file_types: ['.apk', '.aab', '.ipa', '.zip']
12
- missing_file_name: "Please specify the name of the app that you wish to query on sauce storage"