How do I access React-native button(TouchableHighlight) in Appium test case - react-native

I am writing automation test for my ReactNative app with Appium. I'm unable to access react native components in appium. Even Appium inspector can't inspect inside react native view.
I'm trying something like this :
it("Testing Automation", function () {
return driver
.waitForElementById('LogoutButton', 5000).click()
});
Is there anyway to know react native component's Xpath or anyway to access them by any other attribute? Thanks

For the elements from react-native using chrome://inspect/#devices on your Chrome browser could provide you help inspect the elements similar to any other Webview.
You can find there class, css, x-path etc as assigned to them during development.

Related

Not able to inspect elements inside <ScrollView> for an iOS app with Appium Inspector

We are automating on an iOS mobile application which has been developed with react native. For the automation we have been asked to use Appium tool with Pytest-BDD. Currently we are facing an issue with the while inspecting the Mobile elements with the help of Appium Inspector… As developers already provided the Accessibility Id’s, Accessibility label and other elements props but we are not able to access elements inside (Child elements) using Appium inspector…Is there anyone who has already faced this issue and can help ?Thanks in Advance !!!
Tried Inspecting elements with Appium Inspector

Expo web browser emulator is blank - React Native Error

While working on my app yesterday, the web emulator of Expo was working properly.
Now when I am trying to start the app on the browser today using expo start and then w, the whole screen is blank.
Nothing is there on the browser.
What kind of issue is this? How should I fix this?
Image of the emulator:
EDIT
These are the Screenshot from Snack:
App.js
LoginScreen.js
HomeScreen.js
The problem you're having is in navigation and has nothing to do with emulator,
the issue is that react Navigation on web require linking prop, you can check for details in documentation
Another solution is to use #react-navigation/web and here is a example web navigation in react native
For your case try using :
const LoginScreen({navigation})
and use navigation object normally like that :
navigation.navigate('HomeScreen')
no need to use useNavigation

Can you reload a React Native app from React Native Debugger?

I've just switched from debugging my React Native app in the browser using the console to React Native Debugger. In the browser, there is a button to reload the app which is very useful and something that I need to do a lot. Now using React Native Debugger I can't find a way to reload the app which means I need to shake the device (very annoying).
I've searched the docs but can't find way of doing it.
Is there a way I'm missing?
Yes, a reload can be done I think. Right click -> reload Js.
You can find this under the shortcut references: https://github.com/jhen0409/react-native-debugger/blob/master/docs/shortcut-references.md

How to to implement background functionalities in react native android application?

I need do some functionalities in Android application background , so how to implement in my application ?
For React Native Android there is a native api called Headless JS for running js tasks while app is in background. You could also try
react-native-background-job which is actually based on Headless JS.

Why in WEBVIEW Context the xpath generated by Appium isn't working using iOS simulator?

I want to know why in WEBVIEW Context the xpath generated by Appium isn't working using iOS simulator with java to write our scripts?
Other question is there a way to make the code generated by appium recorder working in our java classes, because for now while we are in WEBVIEW there is no chance with appium we have to take a look into html code to create code.
PS : I have already tried to change the context to NATIVE then turn
back to WEBVIEW_1 but no changes.