feat: testID property for use with e2e testing without interfering with a11y#9793
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
automationTextfor e2e testing interferes with a11y.What is the new behavior?
Adds a new
testIDproperty matching what the React Native community adopted, also reference api here which helps discern e2e testing id's apart from anything specific to a11y.