devicefarm 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 710d4988cc9725cea1e1f5a4a06f3d85cd5ce191
4
+ data.tar.gz: 3298f35909aaec64242696bc0b9f54f2b424bdef
5
+ SHA512:
6
+ metadata.gz: 256e9c2ee640b9f6afeec37191757e11ea7f59478c668736005c8601a604ddd7ebb056dbd9dedba33e0651a07c29af0780e018239945ffaa4b87aa2a63549357
7
+ data.tar.gz: 7ae6ecf19603392bc0a229dfe85f0dc37eff12a02b3d1695b306babc29d2e3304448661bbc59e9e3aa4f320704d93d6b6f59a8a4641743f485e706b358b080f0
@@ -0,0 +1,42 @@
1
+ require "aws-sdk-devicefarm"
2
+
3
+ class DeviceFarm::DeviceFarmApi
4
+
5
+ def initialize
6
+ @client = Aws::DeviceFarm::Client.new
7
+ end
8
+
9
+ def get_project_by_name(project_name:)
10
+ project = @client.list_projects().projects.select{ |project| project.name == project_name}[0]
11
+ end
12
+
13
+ def get_device_pool_by_name(pool_name:,project:)
14
+ device_pool_response = @client.list_device_pools(type: "PRIVATE", arn: project.arn)
15
+ device_pool = device_pool_response.device_pools.select{ |device_pool| device_pool.name == pool_name}[0]
16
+ device_pool
17
+ end
18
+
19
+ def upload_artifact(file_path:,type:,project:)
20
+ file = File.new(file_path)
21
+ upload = @client.create_upload({
22
+ project_arn: project.arn,
23
+ name: File.basename(file),
24
+ type: type}).upload
25
+ %x[curl -T #{file_path} "#{upload.url}"]
26
+ upload
27
+ end
28
+
29
+ def run(project:,device_pool:,upload_apk:,upload_artifact_test:,type:)
30
+ @client.schedule_run({
31
+ project_arn: project.arn,
32
+ app_arn: upload_apk.arn,
33
+ device_pool_arn: device_pool.arn,
34
+ name: "Test 2",
35
+ test: {
36
+ type: type,
37
+ test_package_arn: upload_artifact_test.arn
38
+ }
39
+ })
40
+ end
41
+
42
+ end
data/lib/devicefarm.rb ADDED
@@ -0,0 +1,29 @@
1
+ class DeviceFarm
2
+
3
+ def self.test_with_calabash(project_name:,
4
+ device_pool_name:,
5
+ apk_path:,
6
+ calabash_test_package_path:)
7
+ devicefarmapi = DeviceFarm::DeviceFarmApi.new()
8
+ project = devicefarmapi.get_project_by_name(project_name:project_name)
9
+ device_pool = devicefarmapi.get_device_pool_by_name(
10
+ pool_name:device_pool_name,
11
+ project:project)
12
+ upload_apk = devicefarmapi.upload_artifact(
13
+ file_path:apk_path,
14
+ type: "ANDROID_APP",
15
+ project:project)
16
+ upload_artifact_test = devicefarmapi.upload_artifact(
17
+ file_path:calabash_test_package_path,
18
+ type: "CALABASH_TEST_PACKAGE",
19
+ project:project)
20
+ devicefarmapi.run(project:project,
21
+ device_pool:device_pool,
22
+ upload_apk:upload_apk,
23
+ upload_artifact_test:upload_artifact_test,
24
+ type: "CALABASH")
25
+ end
26
+
27
+ end
28
+
29
+ require "devicefarm/devicefarmapi"
metadata ADDED
@@ -0,0 +1,45 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: devicefarm
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - viniciusmo
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-04-19 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A simple way to upload your artifacts to test your app ;)
14
+ email: nick@quaran.to
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/devicefarm.rb
20
+ - lib/devicefarm/devicefarmapi.rb
21
+ homepage: http://rubygems.org/gems/devicefarm
22
+ licenses:
23
+ - MIT
24
+ metadata: {}
25
+ post_install_message:
26
+ rdoc_options: []
27
+ require_paths:
28
+ - lib
29
+ required_ruby_version: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ required_rubygems_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ requirements: []
40
+ rubyforge_project:
41
+ rubygems_version: 2.6.13
42
+ signing_key:
43
+ specification_version: 4
44
+ summary: Device Farm
45
+ test_files: []