fastlane-plugin-browserstack 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/fastlane/plugin/browserstack/actions/upload_to_browserstack_app_automate_action.rb +1 -2
- data/lib/fastlane/plugin/browserstack/actions/upload_to_browserstack_app_live_action.rb +116 -0
- data/lib/fastlane/plugin/browserstack/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 15a1011f5cb81188007410f51847f406d47034f022e299af044f57777e4e0e54
|
4
|
+
data.tar.gz: 1cb3247472102baf837df8be19c95088800248eab4fc0dea783d63b4cdb8aaf0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2226322f19bc79017d784494fd6a892c3fd9a9844631b7c3d9ee5e056fe7de5ad510e8a581f09f9f06cdfe1c480c999da944d51437b3280e03486ff09021293b
|
7
|
+
data.tar.gz: c809023ec0abf8cbe19fba30abc9998df99cb08976ea06dd2349f65a81510e74bbbbd4edb528d055acfafa414a4d70929fabe7ff5273f35c7effc3a28b468fb7
|
data/README.md
CHANGED
@@ -40,7 +40,7 @@ module Fastlane
|
|
40
40
|
# Validate file extension.
|
41
41
|
file_path_parts = file_path.split(".")
|
42
42
|
unless file_path_parts.length > 1 && SUPPORTED_FILE_EXTENSIONS.include?(file_path_parts.last)
|
43
|
-
UI.user_error!("file_path is invalid, only files with extensions
|
43
|
+
UI.user_error!("file_path is invalid, only files with extensions " + SUPPORTED_FILE_EXTENSIONS.to_s + " are allowed to be uploaded.")
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
@@ -64,7 +64,6 @@ module Fastlane
|
|
64
64
|
|
65
65
|
def self.default_file_path
|
66
66
|
platform = Actions.lane_context[Actions::SharedValues::PLATFORM_NAME]
|
67
|
-
|
68
67
|
if platform == :ios
|
69
68
|
# Shared value for ipa path if it was generated by gym https://docs.fastlane.tools/actions/gym/.
|
70
69
|
return Actions.lane_context[Actions::SharedValues::IPA_OUTPUT_PATH]
|
@@ -0,0 +1,116 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
require_relative '../helper/browserstack_helper'
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
module Fastlane
|
6
|
+
module Actions
|
7
|
+
module SharedValues
|
8
|
+
BROWSERSTACK_LIVE_APP_ID ||= :BROWSERSTACK_LIVE_APP_ID
|
9
|
+
end
|
10
|
+
class UploadToBrowserstackAppLiveAction < Action
|
11
|
+
SUPPORTED_FILE_EXTENSIONS = ["apk", "ipa"]
|
12
|
+
UPLOAD_API_ENDPOINT = "https://api-cloud.browserstack.com/app-live/upload"
|
13
|
+
|
14
|
+
def self.run(params)
|
15
|
+
browserstack_username = params[:browserstack_username] # Required
|
16
|
+
browserstack_access_key = params[:browserstack_access_key] # Required
|
17
|
+
file_path = params[:file_path].to_s # Required
|
18
|
+
|
19
|
+
validate_file_path(file_path)
|
20
|
+
|
21
|
+
UI.message("Uploading app to BrowserStack AppLive...")
|
22
|
+
|
23
|
+
browserstack_app_id = Helper::BrowserstackHelper.upload_file(browserstack_username, browserstack_access_key, file_path, UPLOAD_API_ENDPOINT)
|
24
|
+
|
25
|
+
# Set 'BROWSERSTACK_APP_ID' environment variable, if app upload was successful.
|
26
|
+
ENV['BROWSERSTACK_LIVE_APP_ID'] = browserstack_app_id
|
27
|
+
|
28
|
+
UI.success("Successfully uploaded app " + file_path + " to BrowserStack AppLive with app_url : " + browserstack_app_id)
|
29
|
+
|
30
|
+
UI.success("Setting Environment variable BROWSERSTACK_LIVE_APP_ID = " + browserstack_app_id)
|
31
|
+
|
32
|
+
# Setting app id in SharedValues, which can be used by other fastlane actions.
|
33
|
+
Actions.lane_context[SharedValues::BROWSERSTACK_LIVE_APP_ID] = browserstack_app_id
|
34
|
+
end
|
35
|
+
|
36
|
+
# Validate file_path.
|
37
|
+
def self.validate_file_path(file_path)
|
38
|
+
UI.user_error!("No file found at '#{file_path}'.") unless File.exist?(file_path)
|
39
|
+
|
40
|
+
# Validate file extension.
|
41
|
+
file_path_parts = file_path.split(".")
|
42
|
+
unless file_path_parts.length > 1 && SUPPORTED_FILE_EXTENSIONS.include?(file_path_parts.last)
|
43
|
+
UI.user_error!("file_path is invalid, only files with extensions " + SUPPORTED_FILE_EXTENSIONS.to_s + " are allowed to be uploaded.")
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.description
|
48
|
+
"Uploads IPA and APK files to BrowserStack AppLive for running manual tests."
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.authors
|
52
|
+
["Hitesh Raghuvanshi"]
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.details
|
56
|
+
"Uploads IPA and APK files to BrowserStack AppLive for running manual tests."
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.output
|
60
|
+
[
|
61
|
+
['BROWSERSTACK_LIVE_APP_ID', 'App id of uploaded app.']
|
62
|
+
]
|
63
|
+
end
|
64
|
+
|
65
|
+
def self.default_file_path
|
66
|
+
platform = Actions.lane_context[Actions::SharedValues::PLATFORM_NAME]
|
67
|
+
if platform == :ios
|
68
|
+
# Shared value for ipa path if it was generated by gym https://docs.fastlane.tools/actions/gym/.
|
69
|
+
return Actions.lane_context[Actions::SharedValues::IPA_OUTPUT_PATH]
|
70
|
+
else
|
71
|
+
# Shared value for apk if it was generated by gradle.
|
72
|
+
return Actions.lane_context[Actions::SharedValues::GRADLE_APK_OUTPUT_PATH]
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def self.available_options
|
77
|
+
[
|
78
|
+
FastlaneCore::ConfigItem.new(key: :browserstack_username,
|
79
|
+
description: "BrowserStack's username",
|
80
|
+
optional: false,
|
81
|
+
is_string: true,
|
82
|
+
verify_block: proc do |value|
|
83
|
+
UI.user_error!("No browserstack_username given.") if value.to_s.empty?
|
84
|
+
end),
|
85
|
+
FastlaneCore::ConfigItem.new(key: :browserstack_access_key,
|
86
|
+
description: "BrowserStack's access key",
|
87
|
+
optional: false,
|
88
|
+
is_string: true,
|
89
|
+
verify_block: proc do |value|
|
90
|
+
UI.user_error!("No browserstack_access_key given.") if value.to_s.empty?
|
91
|
+
end),
|
92
|
+
FastlaneCore::ConfigItem.new(key: :file_path,
|
93
|
+
description: "Path to the app file",
|
94
|
+
optional: true,
|
95
|
+
is_string: true,
|
96
|
+
default_value: default_file_path)
|
97
|
+
]
|
98
|
+
end
|
99
|
+
|
100
|
+
def self.is_supported?(platform)
|
101
|
+
[:ios, :android].include?(platform)
|
102
|
+
end
|
103
|
+
|
104
|
+
def self.example_code
|
105
|
+
[
|
106
|
+
'upload_to_browserstack_app_live',
|
107
|
+
'upload_to_browserstack_app_live(
|
108
|
+
browserstack_username: ENV["BROWSERSTACK_USERNAME"],
|
109
|
+
browserstack_access_key: ENV["BROWSERSTACK_ACCESS_KEY"],
|
110
|
+
file_path: "path_to_apk_or_ipa_file"
|
111
|
+
)'
|
112
|
+
]
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-browserstack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- BrowserStack
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-06-
|
11
|
+
date: 2018-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -166,6 +166,7 @@ files:
|
|
166
166
|
- README.md
|
167
167
|
- lib/fastlane/plugin/browserstack.rb
|
168
168
|
- lib/fastlane/plugin/browserstack/actions/upload_to_browserstack_app_automate_action.rb
|
169
|
+
- lib/fastlane/plugin/browserstack/actions/upload_to_browserstack_app_live_action.rb
|
169
170
|
- lib/fastlane/plugin/browserstack/helper/browserstack_helper.rb
|
170
171
|
- lib/fastlane/plugin/browserstack/version.rb
|
171
172
|
homepage: https://github.com/browserstack/browserstack-fastlane-plugin
|
@@ -191,5 +192,5 @@ rubyforge_project:
|
|
191
192
|
rubygems_version: 2.7.6
|
192
193
|
signing_key:
|
193
194
|
specification_version: 4
|
194
|
-
summary: Uploads IPA and APK files to BrowserStack for automation testing.
|
195
|
+
summary: Uploads IPA and APK files to BrowserStack for automation and manual testing.
|
195
196
|
test_files: []
|