Monday, 10 October 2016

1) Appium 1.6.0 beta1 Installation

I have managed to run my IOS tests on XCUItest using below changes.
Elements have to migrated from UIA to XCUI elements

Inorder to run appium on 1.6.0 beta 1 for ios 10 and xcode 8
use below settings

platformName = "iOS"
orientation = "PORTRAIT"
platformVersion = "10.0"
deviceName ="iPhone Simulator"
noReset = "false"
automationName = "xcuitest"
appiumVersion = "1.6.0-beta1"


npm uninstall appium
npm install appium@1.6.0-beta1

npm install -g appium-xcuitest-driver
brew install carthage

Install carthage dependency manager

Error : Fetching dependencies\nPlease make sure that you have Carthage installed (\nNote: We are expecting that carthage installed in /usr/local/bin/\n',
Solution : brew install carthage

Xcode 8 Installation : 
download xcode
unzip the xcode file 
Rename old /Applications/ to /Applications/ you still want to keep it)
Drag new Xcode app to /Applications/
Open Xcode and install it 

Other fixes: 

If you encounter issues  check here -
I had to manually run bootstrap as mentioned in above link 
cd ~/.npm-global/lib/node_modules/appium-xcuitest-driver/WebDriverAgent
sh Scripts/ 

To Properly install node check this link -

Friday, 18 March 2016

Android adb command to filter logs specific to app and log time

adb logcat -v threadtime
Android adb command option threadtime will show information about pid, time and more info.

`adb shell ps | grep <> | cut -c10-15` 
Find the pid of application and filter adb logs using that

adb logcat -v threadtime | grep `adb shell ps | grep <> | cut -c10-15`

Thursday, 11 February 2016

Calabash-ios Shell script to create .ipa file from .app file

#Shell script to create .ipa file from .app file, where .app file is built using '-sdk iphoneos' in xcodebuild command

#Delete old Payload dir
if [ -d Payload ]; then
rm -rf Payload

mkdir Payload
#Copy .app file from derived data foldercp -Rf ../Products/Debug-iphoneos/ Payload/
echo "Copying & Zipping APP file into .ipa file"
zip -qry Payload
mv App-cal.ipa
rm -rf Payload

if [ ! -f 'App-cal.ipa' ]; then
exit 1

Setting up bridged adapter on genymotion to make it work on intranet

Setting up bridged adapter on genymotion to make it work on intranet 

Open up Virtual box
choose genymotion virtual device 
click settings
Navigate to Network -> Adapter2 (Adapter 1 has to be set to host only)
set "Attached to" to "Bridged Adapter"
"Name" to "en0:Ethernet" (any network adapter being used)
Click OK
restart device 

Wednesday, 11 November 2015

Useful Calabash Android methods for scrolling, reading and counting items in Android List view

Calabash queries for Android list view

#Get total items in List view
query "ListView",:getCount

#Get first visible item from android list view
query "ListView",:getFirstVisiblePosition

#Get item details at row 2 in current list
query "ListView",{:getItemAtPosition=>1}

#get last visible position of item currently visible in list view
query "ListView",:getLastVisiblePosition

#Scroll in list view
query "ListView",{:smoothScrollToPosition=>5}

#scroll progressively in list view
query "ListView",{:smoothScrollByOffset=>1} # scroll by one position

Example of Android list view -

Query for Android hint text

query for hint text in android text fields (Edittext)

query "*",:hint 

Monday, 2 March 2015

Expect script to compile Titanium project and add calabash framework to it using ticalabash

Expect script is bit advanced version of shell script
Where terminal can wait for the result of the previous command and execute the next query based on the output of the previous result.
Take a look at this amazing blog for expect script examples -

TiCalabash is a package which can be used to add calabash to Titanium project and execute tests. -

Below shell script does the following sequence of steps 

  1. Cleans Project
  2. Builds project
  3. Adds calabash-ios framework to code and creates -cal scheme
  4. compile the project with calabash framework added


set arg1 [lindex $argv 0]

set timeout 20
spawn ti clean
expect {
    "Project cleaned successfully" { puts "STEP 1 DONE" }
    timeout { puts "failed to find text"; exit 1 }

if { $arg1 == "phone" } {
 spawn ti build -p ios -b;
 puts "expect.exp - Phone build"
} elseif { $arg1 == "tablet" } {
 spawn ti build -p ios -Y ipad -b --retina;
 puts "expect.exp - Tablet build"

set timeout 400
expect {
    "Initiating Xcode pre-compile" { puts "STEP 2 DONE" }
    timeout { puts "*** FAILED TO FIND - Initiating Xcode pre-compile "; exit 1 }

expect {
    "Project built successfully" { puts "STEP 3 DONE" }
    timeout { puts "*** FAILED TO FIND - Project built successfully "; exit 1 }

set timeout 20
spawn ti calabash —platform=iphone
expect "Please answer yes (y) or no (n)"  { send "n\r" }

set timeout 200
expect {
    "Default target:" { send "\r" }
    timeout { puts "failed to find text"; exit 1 }

expect {
    "Setup done" { puts "STEP 4 DONE" }
 timeout { puts "failed to find text: Setup done"; exit 1}

expect {
 timeout { puts "failed to find text"; exit 1 }