question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`accessible=true` prop on Fluent Tester root view breaks element querying on iOS E2E tests

See original GitHub issue

Willing to submit a PR to fix?

  • I am willing to submit a PR to fix

Requested priority

Normal

Products/applications affected

CI fails without disabling the accessible prop on ios for this PR: https://github.com/microsoft/fluentui-react-native/pull/2226

Package version(s)

- yarn 1.22.19
- npm 8.0.0
- react-native ^0.68.0
- react-native-macos ^0.68.0
- appium 2.0.0-beta.41
- appium-xcuitest-driver 4.11.1

OS version(s)

iOS 15.5

Platform

  • iOS
  • macOS
  • win32
  • windows
  • android

Xcode version

xCode 14.0.1

Please provide a reproduction of the bug

  1. Clone this PR: https://github.com/microsoft/fluentui-react-native/pull/2226
  2. In apps/fluent-tester/src/FluentTester.tsx, change the accessible prop on the View with testID={ROOT_VIEW} from Platform.OS === 'ios' to true.
  return (
    // TODO: Figure out why making this view accessible breaks element querying on iOS.
    <View accessible={Platform.OS !== 'ios'} testID={ROOT_VIEW} style={commonTestStyles.flex}>
      {Platform.OS === ('win32' as any) ? (
        <FocusTrapZone style={themedStyles.root}>
          <TesterContent />
        </FocusTrapZone>
      ) : (
        <RootView style={themedStyles.root}>
          <TesterContent />
        </RootView>
      )}
    </View>
  );

  1. From apps/fluent-tester, run yarn ios to build the iOS app. Then, once the app is running, run yarn e2etest:ios to run the E2E test suite. Watch the tests fail. (if you don’t have a mac, just run this in the CI)

Actual behavior

The compiled native app returns this view hierarchy: ca73c893-602a-4fe6-9094-b335db00b42d

When querying elements in appium with strategy accessibility id, we start from the highlighted RCTView with accessibility id Fluent_Tester_Root_View. For each chained query, we try and find the RCTTextView saying “Fluent UI Tests”, which is a direct child of Fluent_Tester_Root_View. This query always fails when the view is accessible.

Expected behavior

Given that the RCTTextView is a direct child of our starting View, our query should succeed and return the text view.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Saadnajmicommented, Oct 21, 2022

Thanks. I opened a bug internally with my team mirroring this one too.

0reactions
lyzhan7commented, Dec 15, 2022

Update - seems like setting accessible=true is the right thing to do on windows, and I also tested the macOS FluentTester with the accessibility inspector, and confirmed that it doesn’t have the same issue as iOS. Confirmed that iOS is the exception here and we should keep accessible=false for iOS only. Updated the comment in FluentTester to explain this, and closing this issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting Started With iOS UI Testing | Capital One
The best way to first learn this is to let Xcode do it for us. Place your cursor inside your new test function...
Read more >
What is End To End Testing? - BrowserStack
Explore end to end testing, a software testing technique that tests an application's workflow from beginning to end in real user scenarios.
Read more >
React Testing Crash Course - YouTube
Learn about testing in React including unit, e2e and integration testing with React Testing Library, Jest & CypressTechbase YouTube ...
Read more >
Test Renderer - React
This package provides a React renderer that can be used to render React components to pure JavaScript objects, without depending on the DOM...
Read more >
Best Practices for Creating End-to-End Tests - Datadog
Along the way, we'll show how Datadog can help you follow these best practices and enable you to easily create and organize your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found