I'm using Robot Framework and Appium Library to test an app on Android and iOS. The problem is that when opening the app with capability noReset=False all app data is cleared between each test case. The data should only be cleared between each test suite (Open Application).
According to best practice from Appium Library you should use Quit Application / Launch Application between each test case to re-start the app.
http://serhatbolsu.github.io/robotframework-appiumlibrary/AppiumLibrary.html#Launch%20Application
The problem is that on Android all information entered in the first test case is cleared when the second test case is launched. (This is only the case for Android - not a problem for iOS.)
*** Settings ***
Suite Setup Open Application
Suite Teardown Close Application
Test Setup Launch Application
Test Teardown Quit Application
*** Test Cases ***
First Test
Input Text Hello World
Second Test
Page Should Contain Text Hello World
Second Test above will work on iOS but fail on Android. Is this intended or is there some way to avoid this behaviour?
This is the code for Open Application:
self.open_application('http://10.246.121.241:4723/wd/hub',
alias='MiniVoc',
app='se.volvo.androidvoc',
appActivity='se.volvo.androidvoc.ui.main.MainActivity',
appWaitActivity='se.volvo.androidvoc.ui.certificates.CertificatesActivity',
autoAcceptAlerts=True,
automationName='Appium',
deviceName='P20',
newCommandTimeout=60,
noReset=False,
platformName='Android',
platformVersion='8.0.0',
udid='9WVDU18C2600668',
wdaLocalPort=8101)
Set noReset=true, if you don't want to clear app data. For more information about reset strategy in appium check the following diagram:
Related
Appium has a way to inspect the view hierarchy of an app using an inspector. I am interested in building one myself.
I know the overview answer of: it uses some webdriver to accomplish this. But how?
It puzzles me that a separate iOS app can some how communicate to another app, and show even its screen.
How does it work under the hood? or how does the iOS app communicate to the UI inspector to send its screen shots and hierarchy?
It puzzles me that a separate iOS app can some how communicate to another app, and show even its screen.
Yes! Apps should not be able to do this. But there exists a special kind of app, built just for testing, which IS able to do this.
The way this is done is using Apple's XCUITest framework. When you write an XCUITest in XCode, it builds a special app which is able to start your test app and then communicate with it using the XCUITest methods. These methods allow you to inspect elements in the view.
In order to create a view tree, you start at the root view and iterate over the children, building out a tree with a tree traversal.
Normally, the XCUITest app exits when your test script finishes, which means you won't be able to access it from a desktop app for viewing the tree as it updates. If you write your test script to run an infinite loop and open a network port for communication with an outside process, now you can build your viewer. This is exactly what Appium does, so I suggest you check out the appium source code and maybe just use that?
More information in this blog post
[edit]: Oh yeah, Appium uses Feacebook's WebDriverAgent project as the script that runs on the app. So WebDriverAgent is basically an XCUITest script which runs a server and can take commands during a test. Appium does a ton of work to bundle and package it into the special kind of companion app that is able to access your app, installs it on the iOS device, and then runs the test. WebDriverAgent has a command which iterates over the UIHierarchy and returns the whole tree.
I'm testing a website using Appium for iOS. The site has an associated app and uses Apple's Smart App Banners to promote the app. I'd like to test for the presence of the banner and close it at the beginning of my Appium test, but the banner doesn't appear to exist in the DOM. Is there any way to do this, short of mousing around with a pixel location?
Try to switch to native context:
driver.context("NATIVE_APP");
and check if it contains banner, for quick investigation you can print to console result of driver.getPageSource()
I would like to use AWS Device Farm for automation test with Appium, and I passed the test with Appium on local, but after I use the same test to AWS Device Farm, the test failed.
The test result shows: "An element could not be located on the page using the given search parameters".
That is, it can't get the specific element(a button on webView) I want to click. But it's weird because the test passed with the local test.
Does anyone has the same situation with that? I use React Native to develop the app, but I think it's not the reason I got the fail result.
Can you please share your run url so that we can pull your logs to check what is going wrong.
For getting the run url, login to Device Farm console . Click on the run where you are seeing this problem. Copy paste the url from the browser.
Sample Run url looks like this
https://us-west-2.console.aws.amazon.com/devicefarm/home?region=us-west-2#/projects/61a601c1-6142-4e9e-beb0-de5618ae3c63/runs/20378f21-5502-4977-bd4c-69c3491ef7d7
Also a couple of questions
1) Are you seeing this issue on all devices or a single device
2) Do you look at the video of the test run? One common case where this can occur is because of system pop ups.
I am writing an iOS app and I started adding UI automated tests. I am using xcode7.1.1.
As the app relies heavily on data and a logged-in user - I want to create an app-data package and reuse it when running the tests, so when a test starts - there is already a logged-in user with some data in the app.
I followed this guide:
http://corporationunknown.com/blog/2014/07/10/preloading-development-data-into-your-ios-app/
And it works perfectly fine when I:
Install the app on a real device (iPhone), play with it and download the app-data to a file
Add the file to my project and execute my tests using that app-data - on the same real device
Ideally I would be able to:
Create the app-data form a simulator instead of a real device
Be able to use the app-data on any device, ideally a simulator
See, the thing is that for other team members to add UI tests - it would be best if we can simulate some scenario, save the app-data, include it in the project and allow anyone to use it on any device (real or simulator).
I tried running the app with the app-data (again - generated on a real device) on a simulator with no success. It is simply ignored and the app starts empty.
My questions:
Is it possible to run an app with a pre-loaded app-data created from a different device?
If yes - how?
Does it require editing the contents of the package?
Is it possible to create an app-data package from a simulator?
This might provide you some more information on it's current state, https://github.com/lionheart/openradar-mirror/issues/6578
I'm using IBM Mobile Test Workbench for Worklight 8.6.0 to test a hybrid app for ios. I'm using an Iphone 4S with ios 7.0.4, and I'm experiencing the following problems:
1 - I'm trying to run a compound test with 4 tests but only two tests are executed. Basically, after finnishing the second test iphone stays in passive mode and the app is not started.
2 - Before the second test of the compound test is started a pop-up appears asking "Open this page in {appName}". Is there any way to prevent this pop-up from appearing?
1 - I'm sorry but I have not yet experienced such an issue with compound test.
2 - This issue is a known issue that occurs with Safari.
2a) If you are on an iOS device, you could use another web browser such as Chrome in order to connect to the Workbench.
2b) If you are working on an iOS simulator you can use the native client instead the web one.
You will find the RTWiOS application and its installation script in the downloaded archive.
In order to download the archive, launch Safari on your Mac and browse your workbench url + "/mobile" (i.e: http://(mtww-ip-address):(port-number)/mobile
Best Regards, Alexandre.