Appium - strange message when initializing appium (ruby/BrowserStack) - appium

I am writing a series of appium mobile ui tests using ruby and executing the tests in BrowserStack. Here are my desired capabilities and appium initialization:
caps = {
"browserstack.user": ENV["BROWSERSTACK_USER"],
"browserstack.key": ENV["BROWSERSTACK_ACCESS_KEY"],
"browserstack.local": true,
platformName: "ios",
device: "iPhone 11",
os_version: "14",
app: myapp_ios,
project: "Product Name",
build: "Build ID #{build_id}",
name: "Some Test Case"
}
Appium::Driver.new({
caps: caps,
appium_lib: {
server_url: "http://hub-cloud.browserstack.com/wd/hub"
}
}, global_driver: true)
When I initialize Appium, I get this message
Use myapp_ios directly since /Users/kroe761/Documents/Automation/Automation-Projects/myapp-tests-automation/myapp_ios does not exist.
This doesn't affect the test at all, but I write automation for manual app testers and I want to clean up the terminal output as much as possible so they only see what they need to see. The app desired cap is the custom id I gave my app when I uploaded it to BrowserStack, so it obviously doesn't exist on my file system.
Thank you!

It should point to the ipa file that you are planning to automate.

Related

Purchase.wasParchased returns falls in Google Internal Testing

Internal testing with google-play use to give "TRUE" values for Purchased.wasPurchased() method if purcahased. However, after "publishing app", new "internal tests" for new versions do not give TRUE for the waspurchased method.
Ofcourse the wasPurcahsed method works fine in Codenameone Simulator.
Did anyone encounter this?

Appium: Ruby: Distributed tests with appium for iOS

I am having a fully fledged suite for automated tests written using ruby with Appium for mobile automation.
I am running these suites in one simulator in one machine and it takes up a lot of time, around 1 hour to run 56 test cases(We have system test cases where multiple checks like database/Api/functional are integrated). We have more additional test cases adding to our way.
We have implemented running our tests across 3 mac machines currently with running different cucumber tags integrated to Jenkins. However, more addition of tests is only going to take us more time or more mac's
With xcode 9 we can initiate multiple simulators on one machine at the same time, and I had like to know, if there is any sample scenario or documentation on how to implement distributed tests across simulators in one mac machine
I had tried loading two or three different desired capabilities with different platform version, but it only loads the tests in sequential order.
I had gone through a lot of material online that has only the steps to make this possible in android. Does iOS support it?
Or could anyone possibly provide links that would help me? to
1. Implement distributed tests across various simulators in one mac
2. Use cucumber tags to distribute tests creating instance for each desired capability
Update:
I had tried implementing the multithread option and tried to initiate the tests to specific simulator creating instance with each thread. However, I find the tests not running in parallel but sequential.
This is my code:
def start_app(device_id, wdalocalport)
caps_config = {
platformName: "iOS",
wdaLocalPort: wdalocalport,
deviceName: "iPhone Simulator", #update device as per your need
app: (File.join(File.dirname(__FILE__), "Sequoia.app")),
bundleId: "something",
automationName: "XCUITest",
xcodeOrgId: "something",
xcodeSigningId: "iPhone Developer",
#platformVersion: "10.2",
noReset: "true",
fullReset: "false",
showIOSLog: "true",
autoAcceptAlerts: "true",
showXcodeLog: "true",
useNewWDA: "true",
resetOnSessionStartOnly: "true",
udid: device_id }
appium_lib_config={ port: 4723 }
$opts={ caps: caps_config, appium_lib: appium_lib_config }
setup
end
def setup
#appium = Appium::Driver.new($opts)
#appium.start_driver
#Makes all appium_lib methods accessible from steps
#Starts appium driver before the tests begin
end
def test(device1,device2)
threads = []
threads << Thread.new {
start_app(device1, '8100')
}
threads << Thread.new {
start_app(device2, '8200')
}
threads.each(&:join)
end
end
I am calling the launch tests using the test method passing the udid's. The simulators launch at the same time, and also installs the application at the same time, but the tests aren't parallel.
Any help to improvise this case?
I was able to use the rake to parallel run, but I still find this approach runs the tests in sequential manner or doesnt run at all
PFB the code
def run_cucumber(cucumber_options)
Cucumber::Rake::Task.new do |t|
t.cucumber_opts = cucumber_options
end
Rake::Task[:cucumber].invoke
end
task :iphone_7 do |t|
ENV['DEVICE'] = 'iphone7'
run_cucumber('-r features features/test.feature --format pretty --tags #slave1')
end
task :iphone_8 do |t|
ENV['DEVICE'] = 'iphone8'
run_cucumber('-r features features/test.feature --format pretty --tags #slave2')
end
multitask :all => [:iphone_7,:iphone_8]
My hooks.rb
Before do
check
end
def check
if ENV['DEVICE'] == 'iphone7'
start_app('iPhone6','port','udid')
elsif ENV['DEVICE'] == 'iphone8'
start_app('iphone6','port','udid')
else
puts "Device not"
end
end
I have been getting DEVICE NOT. Not sure what am I missing.
You need to create a method which invokes cucumber rake first in the Rakefile as follows:
def run_cucumber(cucumber_options)
Cucumber::Rake::Task.new do |t|
t.cucumber_opts = cucumber_options
end
Rake::Task[:cucumber].invoke
end
This method will need cucumber_options. You can pass same options as you pass on the command line like this:
-r features features/test.feature --format pretty --tags #test1
After this, define rake tasks for a particular configuration in the same Rakefile:
task :iphone_7 do |t|
ENV["DEVICE"] = "iphone 7"
run_cucumber('-r features features/test.feature --format pretty --tags #test1')
end
task :iphone_8 do |t|
ENV["DEVICE"] = "iphone 8"
run_cucumber('-r features features/test.feature --format pretty --tags #test2')
end
Here, ENV["DEVICE"] is used set to device config. You can use this variable in your env.rb in Before block to initialize the test. In Before block you can initialize devices based on this environment variable.
You can create rake tasks like this as many as you need.
Then you can invoke multiple tasks at the same time by using ruby's parallel gem. Examples are in this link -> Ruby Parallel gem
Just pass different types of rake task as the arguments in the Parallel object.
Eg:
task :run_parallel do |t|
Parallel.map([:iphone_7,:iphone_8]) {|task| Rake::Task[task].invoke }
end
And then trigger the run_parallel rake task to execute the whole code.
Eg:
bundle exec rake run_parallel

Check Mark/Tick Mark in XCUI Test

I am currently automating iOS Native application using Appium 1.6.x
Problem Statement:
I am not able to find whether a TableCell is selected or not in Appium 1.6.x XCUITest framework. [A tick mark displays in the application on selecting, but not able to find that in automation]. The element attribute is as follows:
Device : iPad 10.x / Appium 1.6.1
Type: XCUIElementTypeCell
Accessibility Id:
Value:
Label:
Is Visible: true
Rect: x=694, y=195, h=44, w=320
Absolute XPath:
/AppiumAUT/XCUIElementTypeApplication/XCUIElementTypeWindow/XCUIElementTypeOther[2]/XCUIElementTypeOther[3]/XCUIElementTypeOther[2]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeTable/XCUIElementTypeCell
The same application when I inspect using Older appium 1.5.x UIAutomation framework, I am able to find the TableCell is selected or not. The element attribute is as follows:
Device : iPad 8.x / Appium 1.4.3
Name: Management
type: UIATableCell
value: 1
label:
enabled: true
visible: false
valid: true
location: {694, 195}
size: {320, 44}
xpath: //UIAApplication[1]/UIAWindow[1]/UIAPopover[1]/UIATableView[1]/UIATableCell[1]
Do anyone know the problem exists because of XCUI Test Framework or due to any other changes?

TFS Build 2015 not publishing test results

UPDATE (I have restructured this question with a new and basic solution and build as the same problem exists there)
I'm using the new build system in Tfs 2015 and I'm using Update 1. I have noticed that on the build summary screen, no test results or Code Coverage results are submitted:
I have a test step which runs and contains results and I have a .trx and a .coverage file but the test step log contains the warning:
##[warning]Failed to publish test results: The value for the Build.Id property is not within the permissible values for it.
The Build is very basic, it contains 2 steps and Code Coverage is Enabled on the test step:
Here is the build def as retrieved by the TEST REST API:
{
"build":[
{
"enabled":true,
"continueOnError":false,
"alwaysRun":false,
"displayName":"Build solution $/IsdDev/SQTestBuild/Main/TestBuildSystem.sln",
"task":{
"id":"71a9a2d3-a98a-4caa-96ab-affca411ecda",
"versionSpec":"*"
},
"inputs":{
"solution":"$/IsdDev/SQTestBuild/Main/TestBuildSystem.sln",
"msbuildArgs":"",
"platform":"$(BuildPlatform)",
"configuration":"$(BuildConfiguration)",
"clean":"false",
"restoreNugetPackages":"true",
"vsVersion":"14.0",
"msbuildArchitecture":"x86",
"logProjectEvents":"true"
}
},
{
"enabled":true,
"continueOnError":false,
"alwaysRun":false,
"displayName":"Test Assemblies **\\$(BuildConfiguration)\\*test*.dll;-:**\\obj\\**",
"task":{
"id":"ef087383-ee5e-42c7-9a53-ab56c98420f9",
"versionSpec":"*"
},
"inputs":{
"testAssembly":"**\\$(BuildConfiguration)\\*test*.dll;-:**\\obj\\**",
"testFiltercriteria":"",
"platform":"$(BuildPlatform)",
"configuration":"$(BuildConfiguration)",
"runSettingsFile":"",
"overrideTestrunParameters":"",
"codeCoverageEnabled":"true",
"vsTestVersion":"14.0",
"pathtoCustomTestAdapters":"",
"otherConsoleOptions":""
}
}
],
"options":[
{
"enabled":false,
"definition":{
"id":"7c555368-ca64-4199-add6-9ebaf0b0137d"
},
"inputs":{
"multipliers":"[]",
"parallel":"false",
"continueOnError":"true"
}
}
],
"variables":{
"BuildConfiguration":{
"value":"debug",
"allowOverride":true
},
"BuildPlatform":{
"value":"any cpu",
"allowOverride":true
}
},
"retentionRules":[
{
"branches":[
"+refs/heads/*"
],
"artifacts":[
"build.SourceLabel"
],
"daysToKeep":10,
"deleteBuildRecord":true,
"deleteTestResults":true
}
],
"_links":{
"self":{
"href":"http://removed/343974ee-60a8-40ee-a103-37fa5db37c41/_apis/build/Definitions/71"
},
"web":{
"href":"http://removed/_permalink/_build/index?collectionId=808a695f-85b6-49db-a2df-ca4aaf8bbb9f&projectId=343974ee-60a8-40ee-a103-37fa5db37c41&definitionId=71"
}
},
"buildNumberFormat":"$(date:yyyyMMdd)$(rev:.r)",
"createdDate":"2015-11-19T07:43:27.977Z",
"jobAuthorizationScope":"projectCollection",
"jobTimeoutInMinutes":60,
"repository":{
"properties":{
"labelSources":"0",
"labelSourcesFormat":"$(build.buildNumber)",
"tfvcMapping":"{\"mappings\":[{\"serverPath\":\"$/IsdDev\",\"mappingType\":\"map\",\"localPath\":\"\\\\\"},{\"serverPath\":\"$/IsdDev/Drops\",\"mappingType\":\"cloak\",\"localPath\":\"\"}]}"
},
"id":"$/",
"type":"TfsVersionControl",
"name":"IsdDev",
"url":"http://removed/",
"defaultBranch":"$/IsdDev",
"rootFolder":"$/IsdDev",
"clean":"undefined",
"checkoutSubmodules":false
},
"quality":"definition",
"authoredBy":{
"id":"7d24caba-6c09-4b78-8ff1-2404e0b0ec64",
"displayName":"Rod Hall",
"uniqueName":"ISD-NR\\Rod.Hall",
"url":"http://removed/_apis/Identities/7d24caba-6c09-4b78-8ff1-2404e0b0ec64",
"imageUrl":"http://removed/_api/_common/identityImage?id=7d24caba-6c09-4b78-8ff1-2404e0b0ec64"
},
"queue":{
"pool":{
"id":2,
"name":"Back Office Pool"
},
"id":2,
"name":"Back Office Pool"
},
"uri":"vstfs:///Build/Definition/71",
"type":"build",
"revision":1,
"id":71,
"name":"SQ Test",
"url":"http://removed/343974ee-60a8-40ee-a103-37fa5db37c41/_apis/build/Definitions/71",
"project":{
"id":"343974ee-60a8-40ee-a103-37fa5db37c41",
"name":"IsdDev",
"url":"http://removed/_apis/projects/343974ee-60a8-40ee-a103-37fa5db37c41",
"state":"wellFormed",
"revision":7
}
}
What is the Build.Id that the warning refers to, how can I view it and set it?
This could even be a problem with TFS 2015 Update 1...
UPDATE I'm not sure if it matters but when I go to the Build section of the TFS Admin Console it appears to not be configured:
I have my application tier on 1 server and then I have 3 Agent Pools each with 3 Agents. There are 3 build servers each of which have 1 agent from each pool installed for a total of 9 agents. I set these up using PowerShell and I downloaded the agent from the TFS page. My builds still work Ok, it's just this tests publishing
Check the attached vNext build configuration, with which I can get the Test result and Code coverage. Make sure you have specified the solution in Visual Studio Build and select Code Coverage Enabled in Visual Studio Test.
Credit to Jesse Houwing for helping me on this one. I had to detach and reattach the Team Project Collection using the TFS Admin Console on the App Server. It seems there is an issue with Update 1 (or perhaps one of the Release Candidates).
For those with the same problem, it will obviously take TFS offline but it took less than 5 minutes.
I had a similar issue yesterday: Visual Studio Test using Test Agent step was failing with the "The value for the Build.Id property is not within the permissible values for it" error message when it was trying to execute Coded UI tests on the remote test machine. Detaching project collection and re-attaching it back fixed the issue.

Unable to findByXpath using Leadfoot / Intern

Using Intern JS with WebDirver to communicate with Appium 1.4.1, I have a simple functional test, part of which should find a text input box on the login screen of our iOS app, tap into it and type the user's login name:
define([
'intern!object',
'intern/chai!assert',
'require'
], function (registerSuite, assert, require) {
registerSuite({
name: 'Suite Name',
'Login Screen': function () {
return this.remote
.setFindTimeout(50000)
.findByXpath("//UIAApplication[1]/UIAWindow[1]/UIAScrollView[1]/UIATextField[1]/UIATextField[1]")
.tap()
.type('student1#demo.com')
.end()
.then(function (pagetitle) {
assert.strictEqual(pagetitle, 'DEMO COLLEGE',
'Should land on app dashboard with school title displayed');
});
}
});
});
When executed using intern-runner everything appears to go well, Appium launches our app and awaits my input - but no matter what I try I can't find the element I need to type into using Leadfoot's findByXpath:
$ intern-runner config=tests/appium
Listening on 0.0.0.0:9000
Starting tunnel...
Initialised iOS on MAC 8.1
Test main - Suite Name - Login Screen FAILED on iOS on MAC 8.1:
NoSuchElement: [POST http://[appium-server-address]:4723/wd/hub/session/80e20453-452e-4181-8713-4f9e0cfa427f/element / {"using":"xpath","value":"//UIAApplication[1]/UIAWindow[1]/UIAScrollView[1]/UIATextField[1]/UIATextField[1]"}] An element could not be located on the page using the given search parameters.
at Server._post <../../.nvm/v0.10.35/lib/node_modules/intern/node_modules/leadfoot/Server.js:68:9>
Using Appium's GUI "inspector" I've confirmed the Xpath to the text-input-box element is:
"//UIAApplication[1]/UIAWindow[1]/UIAScrollView[1]/UIATextField[1]/UIATextField[1]"
Can anyone suggest where I'm going wrong please?
Looks like the Appium Inspector tool on my Mac was duplicating part of the path?
.findByXPath("//UIAApplication[1]/UIAWindow[1]/UIAScrollView[1]/UIATextField[1]/**UIATextField[1]**")
.type("wibble")
Remove the duplicated element in bold (the final UIATextField[1]) ....
.findByXPath("//UIAApplication[1]/UIAWindow[1]/UIAScrollView[1]/UIATextField[1]/**UIATextField[1]**")
.type("wibble")
And it works.
Thanks Appium Inspector. Thanks a lot.

Resources