-
-
Notifications
You must be signed in to change notification settings - Fork 532
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
chore: Move E2E tests to Maestro #1905
Conversation
I see that you are also running into same issue of identifying back button. Is there a way we can pass testID or accessibilityIdentifier to back button on Stack header config props? |
I added this patch to make maestro pick testID diff --git a/node_modules/react-native-screens/ios/RNSScreenStackHeaderConfig.mm b/node_modules/react-native-screens/ios/RNSScreenStackHeaderConfig.mm
index a5eb013..0e4cd3c 100644
--- a/node_modules/react-native-screens/ios/RNSScreenStackHeaderConfig.mm
+++ b/node_modules/react-native-screens/ios/RNSScreenStackHeaderConfig.mm
@@ -495,8 +495,11 @@ + (void)updateViewController:(UIViewController *)vc
target:nil
action:nil];
[backBarButtonItem setMenuHidden:config.disableBackButtonMenu];
+ // add accessibilityIdentifier to backBarButtonItem
+ [backBarButtonItem setAccessibilityLabel:@"go back"];
if (config.isBackTitleVisible) {
+ [backBarButtonItem setAccessibilityLabel:@"go back"];
if (config.backTitleFontFamily || config.backTitleFontSize) {
NSMutableDictionary *attrs = [NSMutableDictionary new];
NSNumber *size = config.backTitleFontSize ?: @17;
@@ -521,6 +524,7 @@ + (void)updateViewController:(UIViewController *)vc
// of backButtonTitle
[backBarButtonItem setTitle:nil];
prevItem.backButtonTitle = resolvedBackTitle;
+ [backBarButtonItem setAccessibilityLabel:@"go back"];
}
prevItem.backBarButtonItem = backBarButtonItem;
@@ -579,6 +583,7 @@ + (void)updateViewController:(UIViewController *)vc
navitem.leftItemsSupplementBackButton = config.backButtonInCustomView;
#endif
UIBarButtonItem *buttonItem = [[UIBarButtonItem alloc] initWithCustomView:subview];
+ [buttonItem setAccessibilityLabel:@"go back"];
navitem.leftBarButtonItem = buttonItem;
break;
}
At first, I added |
Hi @khagesh, I was facing the issue of identifying back button, but I just needed that for pressing back button on iOS - I think that currently we don't need to set accessibility label for that 😄 If you'd like to press back button on iOS, I'd suggest to just tap on the |
Closing this PR, as currently Maestro doesn't meet our needs and is lacking support of running the tests on runners from Github Actions 🥲 |
The problem here is that back button's accessibilityLabel is always different for every screen. And hence I wanted to add accessibilityIdentifier on back button. testID from react native transforms to accessibilityIdentifier on iOS. So, adding testID support is not just of rn-screen's own tests. It would help others as well. Also, the reason I patched with |
Description
WIP WIP
Changes
WIP WIP
Before
After
Test code and steps to reproduce
Checklist