Full Stack SDET with +16 years Experience in QA, +14 years Experience in Test Automation and +8 years in Leadership, Delivering and Releasing Softwares in different platforms (Mobile, Desktop, Web)
Became a STEM Ambassador and a STEM Women Member in 2020 making an impact and bringing more people to the STEM area. Contribute to TestProject and instructor of Test Automation University.
View all posts by Rafaela Azevedo
Published
7 thoughts on “How take a property inside an element in calabash-ios and calabash-android”
Hi Rafaela, I have set up a Calabash iOS framework for a Native product and I found really useful some of your tips and info. Thanks for that! Now I need to run my tests for iphone and iPad as well, and because our product interfaz has many differences I need to get the device name from my Ruby code, So I will have different behavior depending on that. Do you know how to ask Calabash that info?
Hi Rodrigo, Thank you for sending me this message. It is a good question, I have never used before, but I tried this and worked 🙂
You can send this command through your terminal and try as well. system_profiler -detailLevel basic SPUSBDataType
OR
diskutil list
After this, you will receive a lot of infos about the devices connected, in the middle of this list you can find the name of the device, probably you will have treat the strings to get the name.
They are system commands, so in your code of ruby/calabash you will need use the %x()
Hi Rafaela, thanks for your quick answer. I think my description of the problem was not the best. I am running my tests in iPhone and iPad simulators (not in physical devices), So my code should have behaviors for both simulators. What I need to do from my code is something like this: If (device==iPhone) do ….. else if (device== iPad) do …. . But I did not find the way to get the simulator who is running. Any idea?
Thanks again!
Hi Rodrigo,
Ah ok 🙂 So, if you are using simulators device, you can figure out this in the command that you are sending in the calabash. Because when you send the command, you need to send the parameter device, ipad or iphone… So you can create a script (script.sh) and export the variables to set your environment in your starter, and after you can just verify if is ipad or iphone. ENV['DEVICE'].include? "iphone"
Hi Rafaela, I have set up a Calabash iOS framework for a Native product and I found really useful some of your tips and info. Thanks for that! Now I need to run my tests for iphone and iPad as well, and because our product interfaz has many differences I need to get the device name from my Ruby code, So I will have different behavior depending on that. Do you know how to ask Calabash that info?
Thanks a lot!
Rodrigo
Hi Rodrigo, Thank you for sending me this message. It is a good question, I have never used before, but I tried this and worked 🙂
You can send this command through your terminal and try as well.
system_profiler -detailLevel basic SPUSBDataType
OR
diskutil list
After this, you will receive a lot of infos about the devices connected, in the middle of this list you can find the name of the device, probably you will have treat the strings to get the name.
They are system commands, so in your code of ruby/calabash you will need use the %x()
Hope this helps you !
Bye 🙂
Hi Rafaela, thanks for your quick answer. I think my description of the problem was not the best. I am running my tests in iPhone and iPad simulators (not in physical devices), So my code should have behaviors for both simulators. What I need to do from my code is something like this: If (device==iPhone) do ….. else if (device== iPad) do …. . But I did not find the way to get the simulator who is running. Any idea?
Thanks again!
Hi Rodrigo,
Ah ok 🙂 So, if you are using simulators device, you can figure out this in the command that you are sending in the calabash. Because when you send the command, you need to send the parameter device, ipad or iphone… So you can create a script (script.sh) and export the variables to set your environment in your starter, and after you can just verify if is ipad or iphone.
ENV['DEVICE'].include? "iphone"
Like this one:
#!/bin/bash
export DEVICE='iPad Retina'
export APP_BRANCH=develop
export BUNDLE_ID="path"
CUCUMBER_COMMAND="BUNDLE_ID=$BUNDLE_ID DEVICE=$DEVICE APP_BRANCH=$APP_BRANCH cucumber features/ -t @ios -f html"
echo $CUCUMBER_COMMAND
eval $CUCUMBER_COMMAND
Let me know if this helps you.
Hi Rafaela, Thanks for your response. I already found an easy way:
From ruby code:
device = server_version[‘simulator_device’]
then you can ask:
if (device == “iPhone”)
..
if (device == “iPad”)
..
Good to contact you 🙂
Keep in touch
Hi Rodrigo,
Great ! I will take a note this ! Thank you 🙂