-
Notifications
You must be signed in to change notification settings - Fork 10
/
android-sample.rb
51 lines (43 loc) · 1.53 KB
/
android-sample.rb
1
2
3
4
5
6
7
8
9
10
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
require 'rubygems'
require 'appium_lib'
username= ENV["LT_USERNAME"] || "LT_Username" #Enter your username here
accessToken= ENV["LT_ACCESS_KEY"] || "LT_AccessKey" #Enter your Access Key here
caps = {
"lt:options" => {
:deviceName => "OnePlus 7",
:platformName => "Android",
:platformVersion => "11",
:build => "Ruby Vanilla - Android",
:name => "Ruby Android Test",
:isRealMobile => true,
:queueTimeout => 300,
:app => "lt://proverbial-android", #Enter the App URL here
:w3c => true
},
:platformName => "Android"
}
appium_driver = Appium::Driver.new({
'caps' => caps,
'appium_lib' => {
:server_url => "https://"+username+":"+accessToken+"@mobile-hub.lambdatest.com/wd/hub"
}},true)
driver = appium_driver.start_driver
wait = Selenium::WebDriver::Wait.new(:timeout => 30)
el1 = driver.find_element(:id, "com.lambdatest.proverbial:id/color")
el1.click
el2 = driver.find_element(:id, "com.lambdatest.proverbial:id/geoLocation")
el2.click
sleep(5)
driver.back
el3 = driver.find_element(:id, "com.lambdatest.proverbial:id/Text")
el3.click
el4 = driver.find_element(:id, "com.lambdatest.proverbial:id/notification")
el4.click
el5 = driver.find_element(:id, "com.lambdatest.proverbial:id/toast")
el5.click
el6 = driver.find_element(:id, "com.lambdatest.proverbial:id/speedTest")
el6.click
sleep(10)
driver.back
puts "Found results - Test Passed"
driver.quit