How to use Android date picked using detox? - detox

I am trying to test react-native-modal-datetime-picker and select a date for android, (later I will need for IOS).
I am unable tho to pick a date currently.
I found a solution for Appium using espresso(See this), But this solution uses findelementByID for getting the android element id which is unavailable using detox(detox by.id gets the android element tag and not id from what I saw).
This is how I got the ID of the element I want to test using android studio:
While using detox, is there any alternative for testing an android date picker? or a way to get an android element id?

Related

Webdriverio: selecting an option from options picker in React Native app

I'm writing an "enroll" BDD test for an ios react native app using webdriver and appium. When the user inputs their shipping information, we have an options-picker for inputting their state. The action they are to take is: click the field that inputs their home state then scroll down to their home state
I'm trying to select "NY" for the test. I've tried the following (from the appium docs):
$("~element").click();
$("~element").sendKeys("NY")
and I tried
$("~element").touchAction({})
from webdriverio docs.
Has anyone ever figured out a way to do this?

Is there a way to access test id's using expo web?

I'm trying to run end to end tests on an Expo Web project with Playwright. I was hoping that when I added a testId prop to a React Native view it would be converted to a data-testid so I could select the element for my tests.
However, it doesn't do this so I can't figure out a good way to select the elements. So far the best thing I can come up with is to add an accessibility label to the element.
Does anyone know a better way to add test id's to react-native expo projects that'll be tested on the web?
You can do this!
I may have made a casing mistake. You add a testID prop on the react native component and then query for div['data-testid="sampleId"']
Here's a code example: https://github.com/expo/expo/blob/b655ff28d924e2274c627294778a02dbec1268db/apps/bare-expo/e2e/TestSuite-test.web.js#L68

Using the inspect tool on a component with a percentage value in a style, crashes the simulator

I see that percentage values in styles are now supported in ReactNative. I am have started working on a project that uses react-native v0.55.4, with percentages in its styles. However, when I bring up the debug tools, click "inspect" and click on a component that uses a percentage I get the following error:
JSON value '6.4%; of type NSString cannot be converted to NSNumber
This also causes an equivalent error when using values like auto for width.
I've been trying to work out how fix this, but I can't work out where I need to put the fix. Does anyone have any ideas?
Note: I'm using iOS Simulator v10

Automate a react native Android application using selenium

I'm trying to inspect element on react native app
but unfortunately I could not find any element on it, I have use ui automator viewer and appium inspector.
Can anyone help me please?
I have no problem to inspect react native application with appium desktop, you can check article on Sauce Labs blog with pretty good details and iOS RN app/python example.
It's a bit tricky to uniquely identify UI elements, but still possible with setting unique accessibilityLabel for the View on RN side and search for it with AccessibilityId locator strategy in Appium.
Provide more details in case you need additional help.
Unfortunately, without having accessibilityLabel in Views of RN app, you are limited to use xpath locator and search by element text, like "//android.widget.TextView[contains(text(), 'Skip')]".
Avoid using strict #text= as it might not work for every element ,e.g. if text split in 2 lines on some device.

React Native Appium picker

We have started developing an iOS/Android app using React Native. We have automated a lot of our functionality so far using Appium, but have run into a problem with being able to set or select values in a picker (date or choice picker).
I am trying to find if we need to try to fix Appium or look into providing a solution in React Native. I know native iOS/Android apps have solved this issue in the past couple of years, so hoping someone might have an idea on how to solve it for ReactNative.
An example of what we tried to do with Appium (based on what we did with our old iOS Application).
To pick "Colorado" from a picker, we would do the following:
driver.getElementById("IdOfElementOnPage").sendKeys("Colorado");
The problem is that this does not work. Even though it can find the field by id, it cannot select the value from the picker.
Here is a screenshot from Appium of the issue. See how the picker options are just one big blob of text?
enter image description here