Class: DeviceFarm

Inherits:
Object
  • Object
show all
Defined in:
lib/devicefarm.rb

Defined Under Namespace

Classes: DeviceFarmApi

Class Method Summary collapse

Class Method Details

.get_device_type_by_binary(binary_path) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/devicefarm.rb', line 3

def self.get_device_type_by_binary(binary_path)
    if binary_path.include? ".apk"
        "ANDROID_APP"
    else
        "IOS_APP"
    end
end

.test_with_calabash(project_name:, device_pool_name:, binary_path:, calabash_test_package_path:, wait_for_completion: true) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/devicefarm.rb', line 11

def self.test_with_calabash(
     project_name:,
     device_pool_name:,
     binary_path:,
     calabash_test_package_path:,
     wait_for_completion:true)
 
     devicefarmapi = DeviceFarm::DeviceFarmApi.new()
     project = devicefarmapi.get_project_by_name(project_name:project_name)
     device_pool = devicefarmapi.get_device_pool_by_name(
 		pool_name:device_pool_name,
 		project:project)
 	upload_app = devicefarmapi.upload_artifact(
 		file_path:binary_path,
 		type: get_device_type_by_binary(binary_path),
 		project:project)
 	upload_artifact_test = devicefarmapi.upload_artifact(
 		file_path:calabash_test_package_path,
 		type: "CALABASH_TEST_PACKAGE",
 		project:project)
 	devicefarmapi.run(
         project:project,
 		device_pool:device_pool,
 		upload_app:upload_app,
 		upload_artifact_test:upload_artifact_test,
 		type: "CALABASH")
end