-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat: testID property for use with e2e testing without interfering with a11y #9793
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
7f90036
to
b38337e
Compare
ea6262b
to
f56d7c9
Compare
Co-authored-by: Eduardo Speroni <[email protected]>
f56d7c9
to
803553a
Compare
Marked as WIP - still need to do a cleanup pass and run a few more tests with both appium and detox. |
@NathanWalker seems quite good to me.
is removed if It is worth testing to ensure the code is removed completely |
@farfromrefug I'll be checking that - just got a detox demo set up, still need an appium one to check all cases - and then clean up anything that can be cleaned up... If that doesn't get tree-shaken, I'll just drop the typeof check - since we'll be setting it in webpack by default to false (unless |
@farfromrefug seems to be tree-shaken away just fine! // default
[_view_common__WEBPACK_IMPORTED_MODULE_0__.testIDProperty.setNative](value) {
this.setTestID(this.nativeViewProtected, value);
}
setTestID(view, value) {
if (false) {}
} // with --env.e2e
[_view_common__WEBPACK_IMPORTED_MODULE_0__.testIDProperty.setNative](value) {
this.setTestID(this.nativeViewProtected, value);
}
setTestID(view, value) {
if (true) {
const id = _utils__WEBPACK_IMPORTED_MODULE_11__.ad.resources.getId(':id/nativescript_accessibility_id');
if (id) {
view.setTag(id, value);
view.setTag(value);
}
view.setContentDescription(value);
}
} |
@rigor789 very good! very good to know we write something like this 😃 |
PR Checklist
What is the current behavior?
Using
automationText
for e2e testing interferes with a11y.What is the new behavior?
Adds a new
testID
property matching what the React Native community adopted, also reference api here which helps discern e2e testing id's apart from anything specific to a11y.