MDTextField cannot be found by its testID attribute on Android
volkanatalan opened this issue ยท 10 comments
Which platform(s) does your issue occur on?
- Android
- Android version: 12
- Both emulator and device
Please, provide the following version numbers that your issue occurs with:
- CLI: 8.6.0
- Cross-platform modules: 8.6.2
- Plugin(s):
"dependencies": {
"@medirect/helpers": "^2.0.24",
"@medirect/me-bloks-core-ns": "file:../me-bloks-core/dist-ns",
"@nativescript-community/gesturehandler": "^2.0.28",
"@nativescript-community/ui-canvas": "^4.6.21",
"@nativescript-community/ui-chart": "^1.2.35",
"@nativescript-community/ui-image": "^4.3.34",
"@nativescript-community/ui-material-textfield": "^7.2.45",
"@nativescript-community/ui-pager-indicator": "^14.1.20",
"@nativescript-community/ui-svg": "^0.1.33",
"@nativescript/core": "^8.6.2",
"@nativescript/ui-charts": "0.1.8",
"@panter/vue-i18next": "^0.15.2",
"crypto-js": "^4.2.0",
"dompurify": "^3.0.9",
"i18next": "^23.10.1",
"lodash-es": "^4.17.21",
"markdown-it": "^14.0.0",
"nativescript-vue": "3.0.0-rc.1",
"vue": "^3.4.21"
},
"devDependencies": {
"@nativescript/android": "8.6.2",
"@nativescript/ios": "8.6.3",
"@nativescript/tailwind": "~2.0.1",
"@nativescript/types": "~8.6.1",
"@nativescript/webpack": "~5.0.0",
"@types/node": "~17.0.21",
"tailwindcss": "^3.1.8",
"typescript": "^5.2.2"
}
Please, tell us how to recreate the issue in as much detail as possible.
Describe the steps to reproduce it.
1- Add an MDTextField component to the page with a testID
attribute
<MDTextField text="text" testID="text-field" />
2- Run maestro studio
and do assertVisible for the "text-field" id
- assertVisible:
id: "text-field"
It returns false for the assertion on Android. However it works fine on iOS.
@volkanatalan could you share a simple repro example. I think i know what the issue is but i would need to reproduce it
@farfromrefug Thank you for your interest. Here it is:
https://github.com/volkanatalan/MDTextFieldTestIdIssue
I added both MDTextField and TextField components to the page. I can find TextField with its testID but can't find MDTextField.
@volkanatalan thanks but it is missing the maestro part isnt it? I never used maestro so would be nice for the sample project to have it set up
@farfromrefug
To install Maestro you need to run the following command:
curl -Ls "https://get.maestro.mobile.dev" | bash
I think this will be enough to install it, but if you need any further information, you can check the Maestro documentation.
Then you need to run Maestro Studio with the following command from the terminal:
maestro studio
This will open a page in the browser, similar to this:
If you click on the text fields, you will see the suggestions (tap, assert etc.). You will notice that it gives the suggestions with an "id" for the component on the bottom (TextField) but not for the component on the top (MDTextField).
@volkanatalan i just released a new version which should fix this!
Awesome thanks @farfromrefug
@farfromrefug I installed the latest version but the issue still persists.
I think this.nativeViewProtected
should be passed to setAccessibilityIdentifier instead of this.nativeTextViewProtected
. When I do this change, I can find the component.
@volkanatalan damn what did i do :D Indeed my commit is wrong!
@volkanatalan new release up. Hopefully this one is good
@farfromrefug haha no worries now it works like a charm. Thank you very very much ๐ ๐