I'm currently trying to figure out a good way to test localization of an app and have some trouble accessing the label text of a button UIElement after i've accessed the element by automation text. After accessing the button UIElement i'm only able to get the automationText to test against.
It's my first time doing any form of testing with nativescript, appium and mocha and i might go about it completely wrong and if so advise would be much appreciated.
What i'm testing on
- iPad simulator (9.7 inch) with OS v. 12.4
- node v10.16.3
- npm v6.9.0
- {N} v. 6.0.1
- runtimes v 6.0.1
- nativescript-localize for i18n localization
I've followed setup instructions and found some issues here where people hadn't installed carthage, which i've installed.
A simple test looks something like this
const daDK = require(dk.default.json); // localization file for danish
const changeUserButton = await driver.findElementByAutomationText('changeUserButton');
expect(await changeUserButton.text()).to.be.equal(daDK.user.change_user);
The problem:
Doing a log of the await changeUserButton.text() retreives the automationText = changeUserButton where it should have been the text property with the value: Skift Bruger.
I've also tried to access elements in different way ie. with findElementByXPath and findElementByText (though i've read text is only android).
Any suggestions as to solve this?
I've also made an issue with even more details on nativescript-dev-appium Git repo here
Thanks in advance!
Related
React Native iOS apps, when tested in Appium UI Automation Inspector tool, unable to read static Text values.
Code:
<Text accessibilityLabel={'home_welcome_text'} testID={'home_welcome_text'}>Welcome Home
Issue:
In Appium Inspector, label field show 'home_welcome_text'. Which is not correct, it should give the text value 'Welcome Home' in the label field.
Note: This issue happens only in iOS builds. Android builds are working as expected.
Your help on this is much appreciated. Thank you.
I need to update my app and make it look good on the iphone X. I've seen a couple of answers on stackoverflow and on the internet regarding the new safe area option (Use Safe Area Layout Guides).
According to what I've read the app should adapt automatically using autolayout as well but what I've got is this:
If I start a new project it all works fine. The project is quite big, so starting all over again is not an option. What should I do?
Thanks
I just had the same problem, and in my case, the problem was that my app didn't have a Launch Screen.storyboard, it was using a image as launcher. So adding a new Launch Screen.storyboard and selecting that one fixed it, maybe the rest of the app takes some settings from that Launch Screen.storyboard
I'm trying to automate the App build using Titanium Appcelerator.
When I'm inspecting elements using UIAutomator I'm not able to find the resource-id. I'm using path as a workaround but this is not a long term solution.
Has anyone worked with Appcelerator and Appium and is able to help me out?
It is definitely possible to use Appium with Appcelerator Titanium! The key is using the accessibilityLabel property on your views.
i.e. <Label id="label1" accessibilityLabel="label1" text="I am label1" />
You can then do something like this in your Appium tests:
it('should have label1', function() {
return driver
.elementByAccessibilityId('label1')
.should.eventually.exist
.getAttribute('value')
.should.become('I am label1');
});
Let me know if you have any questions about it! I will probably together a blog post about it here because I know a lot of other devs have the same questions you have.
i'm new to android automation testing and i recently started to work with Appium.
I use it for android native app automation.
I have 2 question -
is there a way to verify toasts?
the latest posts i saw which referred to this issue are from the mid of 2014
and i wanted to know if there's something new in this subject before i will find another tool to run my tests with (as i understand selendroid can verify toasts).
is there a way to catch the http request which my app sends to the server when i'm pressing a button, during the automatic test?
something like a listener which works in the backround and wait for clicks?
tnx
To verify toast messages you can use one of image recognition libraries. For ruby I use RTesseract together with image processor RMgick
Idea is simple:
make toast message to appear
take few screenshots
iterate over taken screenshots and look for text
You may play with image processing, to increase recognition quality.
Here you can find code snippet which I use in my framework: link
We are going to develop a mobile app (iOS and Android), which should provide downloading and storing several user-selected PDF files and viewing them within the app (iOS with WebView) or with an external PDF Viewer (Android).
My Question is: Is this possible with Trigger.io? I didn't find anything concerning this in the official documentation. Can we do something with the file or the child browser / tabs module? If yes, do you have any examples?
Note: We will use Backbone.js and jQuery Mobile as additional libraries.
The Android webview doesn't allow for inline opening of PDFs - you can test that by opening e.g. http://trigger.io/cross-platform-application-development-blog/wp-content/uploads/2012/05/trigger.io-whitepaper.pdf in your stock browser.
On iOS, you can use:
forge.tools.getURL('my_file.pdf',
function (file) {
forge.tabs.open(file);
}
);
But that won't work on Android (tested on 2.3, 3 and 4.0).
Short answer - yes.
Downloading, storing, then showing/referencing later can definitely be done. Check out the forge.file documentation.
I have not tried the child browser feature yet. Although the tabs module will work, I think its best to just let the device (and its user settings) decide how to display/render the PDF. I am only saying this because my devices (especially the Android ones... 2.3 and 4.x) tend to behave differently. Either way... the device's "back button" always gets me back to where I left off in my trigger.io app.