UI testing for react native apps - user-interface

i am currently working on a UI automated testing project.
my job is to do UI automated testing on applications built via react-native.
the problem is that react-native doesn't provide resource-id.
i tried nativeID, and testID, and it didn't work out.
i tried accessibilityLabel but this is not the way to do it, because it assigns to the content-descp: which is used by the blind mode.
i tried cavy which is an integrated-ui testing tool, but it's very new, and there is not much support, plus it's not quit developped yet.
i tried selendroid, but i am facing some problems while loading the app in the local selendroid server, i think it has something to do with react native.
any help please!

On the project I’m working on right now, we are using Calabash for both Android and iOS. testID works with Calabash like this:
If you have a view with testID some-id, then you can query for it in calabash with query string ”* marked: some-id”
https://github.com/calabash/calabash-ios
I have also heard people having success with Appium, which is quite similar I think.

You can add AccessbiltiyLabel so that you will be able to automate via
driver.findElement(by.accessibility("id");

Related

How do I build Flutter application locally?

I have developed (on a Mac) a small Flutter app to learn the technology. Now, I would like to build it and use it on Mac, Linux and Android. The few packages I have used claim compatibility with all systems.
So the first thing I did was to run flutter build macos. I indeed obtain an application under build/macos/Build/Products/Release/nameofmyapp.app. It seems this runs correctly, but it fails, for instance, loading data from a DB, which is the first thing it should do.
I have a few questions:
are there any other steps that I should take? I see a long guide about the release process, but to be frank I don't need or want any of that: I only want to use the app myself. Is there something else to do other than flutter build macos?
am I looking for the built app in the right place?
if I did everything correctly, could it be that I need to authorize the app to access to the file in some way? Should I manage this workflow myself, or is there a standard way to perform this action in Flutter?
Sorry for asking more than one question, but I am not sure whether what I am doing wrong is
the build process
where to look for the built app, or
(not) handling the app permissions.
EDIT
Following a suggestion by Madhavam, I tried flutter run --release. The result is identical to running the built application: nothing is loaded from the database, and no errors appear in the console.
To be clear, these are the libraries that are not working:
sqflite should load data from a database (in my Documents folder) but does not show anything
file picker cross should allow me to load data from a JSON file, but when I try this interaction, I an not shown any dialog to load a file
shared preferences should read some settings, but they all appear as null
In short, anything that has to do with interacting with external files or storage does not seem to work
Yup, you have to manage it yourself. Take a look at this package
:https://pub.dev/packages/permission_handler
If you're using Firebase then you probably need to add the release keys.
One thing too, if you face an error only in the release build then I recommend running the app with flutter run --release so that you can see the errors that are being thrown.
So it seems that this is related to the default being an app that runs in sandbox. Since I do not want to distribute the app, it was fine for me to disable this setting. Details are in this answer

Using Theory and ClassData to Parametrize Xamarin UITests

I'm currently trying to make UI-Tests in Xamarin, where i want the app to be tested against different server versions.
Originally i wanted to do this like i did in unit-tests with parametrized tests by using [Theory] and [ClassData].
Unfortunately i haven't found anything about this in the web so far regarding this nUnit construct.
Is this even possible? or is there another way to tell my xamarin UI-Test to run all my tests once for each server version?.
Many thanks in advance.
Mav
Soo, the mistake i made was to assume that i could use xunit blocks for nunit tests.
My bad.
The solution is pretty simple and can be looked up here in the gitHub projects documentation:
https://github.com/nunit/docs/wiki/TestFixtureData

Nativescript force latest store version

I am trying to figure out how to force the user to use the app only if he has the last update of it( So the app should check if the local and store version are the same). I've seen this feature in some apps. Found this plugin : https://www.npmjs.com/package/nativescript-store-update. It works great on iOS but it does not work at all on Android, so I am clueless right now on how to do this. Any help would be much appreaciated. Thanks
While not sure about forcing to update the store version, you can use the newly introduced AppSync functionality to create mandatory updates for your codebase. See this blog post for details or just search for nativescript-app-sync

Web intent plugin in NativeScript

I building Bookmarks manager app in Nativescript. i am looking for a plugin related to web intent, but i could find any. If any one have any idea to achieve similar functionality like this React native plugin for intent, Please help
Thanks in advance
It's quite straight forward on Android, you would use JavaProxy to create an activity Or simply use your NativeScript activity if you want to open your application itself upon sharing, add the same intent-filter under that activity in AndroidManifest.xml file.
With iOS, there is an option feature request for building app extensions. But still there are some POCs for app extensions available on Github which seems to require some manual steps as mentioned in the Github issue.

Import ReactNative libraries into a NativeScript application

I have some Android development experience along with React.js. I'm working on a new mobile project and I haven't been sold entirely on either framework yet.
I'm thinking about using the NativeScript framework for its maturity and because it has more libraries with the functionality that I need but I'd like to design my views in a manner similar to ReactJS. I know I could write my own modules for ReactNative but that would require then I'd have to write modules for both Android and iOS. I'd like to avoid that if I could.
I was thinking about importing the necessary ReactNative libraries into a NativeScript project and then being able to write views in a way similar to ReactNative but still using NativeScript.
Is this doable?
Not sure about your exact question. I did just see an integration between Preact and NativeScript you may be interested in. Take a look here: https://github.com/staydecent/nativescript-preact
I believe that repo is in the early stages, but if enough people want something similar, it'll get worked on faster.
Using React Native in NativeScript is not the right approach, either of it are not built to work together and wouldn't work due to architectural reasons. Here is an NativeScript official comparison of these two.
Both are built for solving same problem (building native apps using JS, without webview hybrid app approach) by trans-compiling XML based view layer(which both these framework has its own syntax and so cant be shared) to build Native UI.
Said that view layer has its own syntax for both and cant be shared, model and controller layer cant be shared as well, due to the fact that NativeScript has few things packed as part of the application package, like JavaScript runtime, c++ and Java API layer which helps in exposing all the Native API without the need for any explicit native API wrapper we have in ReactNative.
React Native have platform specific UI components as well as hardware capabilities, which is not the case with NativeScript. Offcouse, that comes with the cost of a fatter app package size(50+MB) compared to <10MB for ReactNative. More on ReactNative vs NativeScript comparison here.

Resources