picker icon indicating copy to clipboard operation
picker copied to clipboard

Running Picker on Appium for testing is giving some problems

Open ElavanResu opened this issue 6 years ago • 4 comments

Question

Okay, I have already asked this on the issues section of Appium, waiting for the answer. But I want to know wether I am doing anything wrong in picker library or not.

So, I wanted to test the flow of my app using Appium. While I was testing the picker on Appium, I noticed that when ever I am running the app normally, on the first render, components are rendered and onValueChange doesn't get called. But if I am running the app on Appium, on first render the onValueChange get called. Now the problem is if onValueChange calls some function to change data in parent it'll render the picker in children again and it'll call the onValueChange again which will again call the function in parent component to change the data.

Verisons

OS -> macOS High Sierra Version 10.13.6 (17G14019) Appium: 1.17.1-1 React Native: 0.61.2 Picker version: 1.6.6 Node: 10.14.2 Npm: 6.4.1

Code to reproduce

Install @react-native-community/picker in dummy react native project. after the write the code bellow in app.js The console log doesn't log anything on the first render when app is running normally. But it logs the string on first render when app is running via appium.

import React, { useState } from 'react'; import {Picker} from '@react-native-community/picker'; const app = () => { const [language, setLanguage] = useState('') return ( <Picker selectedValue={language} style={{height: 50, width: 100}} onValueChange={(itemValue, itemIndex) => { console.log('on change called') setLanguage(itemValue) }} > <Picker.Item label="Java" value="java" /> <Picker.Item label="JavaScript" value="js" /> </Picker> ) }

I want to know if anyone has worked with Appium and faced this issue or not. And if anyone got any answer.

Thanks for the help.

ElavanResu avatar Aug 21 '20 08:08 ElavanResu

I have the same issue, onValueChange gets called multiple times which leads to infinite loop. Any Solutions?

sandipbhambre avatar Sep 28 '20 06:09 sandipbhambre

Not yet, I was thinking to change the behaviour of my component but I got stuck as I can't really change it's intended behaviour just for Appium. I am still searching for solutions.

ElavanResu avatar Sep 28 '20 22:09 ElavanResu

@ElavanResu hello did u try testId for picker item does accesibilityId shows up

mohamed-ikram avatar Nov 30 '20 13:11 mohamed-ikram

Anyone had any luck with this?

antoniovassell avatar Dec 13 '20 05:12 antoniovassell