diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 73b76f926..c662de50c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -13,7 +13,7 @@ The core team works directly on GitHub and all work is public. > **Working on your first pull request?** You can learn how from this _free_ series: [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github). 1. Fork the repo and create your branch from `master` (a guide on [how to fork a repository](https://help.github.com/articles/fork-a-repo/)). -2. Run `yarn` to setup the developement environment. +2. Run `yarn` to setup the development environment. 3. Do the changes you want and test them out in the example app before sending a pull request. ### Commit message convention @@ -32,7 +32,7 @@ Our pre-commit hooks verify that your commit message matches this format when co ### Linting and tests -We use `flow` for type checking, `eslint` with `prettier` for linting and formatting the code, and `jest` for testing. Our pre-commit hooks verify that the linter and tests pass when commiting. You can also run the following commands manually: +We use `flow` for type checking, `eslint` with `prettier` for linting and formatting the code, and `jest` for testing. Our pre-commit hooks verify that the linter and tests pass when committing. You can also run the following commands manually: - `yarn flow`: run flow on all files. - `yarn lint`: run eslint and prettier. diff --git a/src/__tests__/a11yAPI.test.js b/src/__tests__/a11yAPI.test.js index 1524a0a35..29077fd15 100644 --- a/src/__tests__/a11yAPI.test.js +++ b/src/__tests__/a11yAPI.test.js @@ -90,7 +90,7 @@ test('getByA11yLabel, queryByA11yLabel, findByA11yLabel', async () => { ); }); -test('getAllByA11yLabel, queryAllByA11yLabel', async () => { +test('getAllByA11yLabel, queryAllByA11yLabel, findAllByA11yLabel', async () => { const { getAllByA11yLabel, queryAllByA11yLabel, findAllByA11yLabel } = render(
); @@ -134,7 +134,7 @@ test('getByA11yHint, queryByA11yHint, findByA11yHint', async () => { ); }); -test('getAllByA11yHint, queryAllByA11yHint', async () => { +test('getAllByA11yHint, queryAllByA11yHint, findAllByA11yHint', async () => { const { getAllByA11yHint, queryAllByA11yHint, findAllByA11yHint } = render(
); @@ -345,3 +345,78 @@ test('getAllByA11yValue, queryAllByA11yValue, findAllByA11yValue', async () => { ); await expect(findAllByA11yValue({ max: 60 })).resolves.toHaveLength(2); }); + +test('a11y label queries have aliases', () => { + const { + getByA11yLabel, + getByLabelText, + queryByA11yLabel, + queryByLabelText, + findByA11yLabel, + findByLabelText, + getAllByA11yLabel, + getAllByLabelText, + queryAllByA11yLabel, + queryAllByLabelText, + findAllByA11yLabel, + findAllByLabelText, + } = render(
); + + // Assert that query aliases are referencing the same function + expect(getByA11yLabel).toBe(getByLabelText); + expect(queryByA11yLabel).toBe(queryByLabelText); + expect(findByA11yLabel).toBe(findByLabelText); + expect(getAllByA11yLabel).toBe(getAllByLabelText); + expect(queryAllByA11yLabel).toBe(queryAllByLabelText); + expect(findAllByA11yLabel).toBe(findAllByLabelText); +}); + +test('a11y hint queries have aliases', () => { + const { + getByA11yHint, + getByHintText, + queryByA11yHint, + queryByHintText, + findByA11yHint, + findByHintText, + getAllByA11yHint, + getAllByHintText, + queryAllByA11yHint, + queryAllByHintText, + findAllByA11yHint, + findAllByHintText, + } = render(
); + + // Assert that query aliases are referencing the same function + expect(getByA11yHint).toBe(getByHintText); + expect(queryByA11yHint).toBe(queryByHintText); + expect(findByA11yHint).toBe(findByHintText); + expect(getAllByA11yHint).toBe(getAllByHintText); + expect(queryAllByA11yHint).toBe(queryAllByHintText); + expect(findAllByA11yHint).toBe(findAllByHintText); +}); + +test('a11y role queries have aliases', () => { + const { + getByA11yRole, + getByRole, + queryByA11yRole, + queryByRole, + findByA11yRole, + findByRole, + getAllByA11yRole, + getAllByRole, + queryAllByA11yRole, + queryAllByRole, + findAllByA11yRole, + findAllByRole, + } = render(
); + + // Assert that query aliases are referencing the same function + expect(getByA11yRole).toBe(getByRole); + expect(queryByA11yRole).toBe(queryByRole); + expect(findByA11yRole).toBe(findByRole); + expect(getAllByA11yRole).toBe(getAllByRole); + expect(queryAllByA11yRole).toBe(queryAllByRole); + expect(findAllByA11yRole).toBe(findAllByRole); +}); diff --git a/src/helpers/a11yAPI.js b/src/helpers/a11yAPI.js index 77f1b063e..1bd33a9bd 100644 --- a/src/helpers/a11yAPI.js +++ b/src/helpers/a11yAPI.js @@ -13,27 +13,45 @@ type FindAllReturn = Promise; type A11yAPI = {| // Label getByA11yLabel: (string | RegExp) => GetReturn, + getByLabelText: (string | RegExp) => GetReturn, getAllByA11yLabel: (string | RegExp) => GetAllReturn, + getAllByLabelText: (string | RegExp) => GetAllReturn, queryByA11yLabel: (string | RegExp) => QueryReturn, + queryByLabelText: (string | RegExp) => QueryReturn, queryAllByA11yLabel: (string | RegExp) => QueryAllReturn, + queryAllByLabelText: (string | RegExp) => QueryAllReturn, findByA11yLabel: (string | RegExp, ?WaitForOptions) => FindReturn, + findByLabelText: (string | RegExp, ?WaitForOptions) => FindReturn, findAllByA11yLabel: (string | RegExp, ?WaitForOptions) => FindAllReturn, + findAllByLabelText: (string | RegExp, ?WaitForOptions) => FindAllReturn, // Hint getByA11yHint: (string | RegExp) => GetReturn, + getByHintText: (string | RegExp) => GetReturn, getAllByA11yHint: (string | RegExp) => GetAllReturn, + getAllByHintText: (string | RegExp) => GetAllReturn, queryByA11yHint: (string | RegExp) => QueryReturn, + queryByHintText: (string | RegExp) => QueryReturn, queryAllByA11yHint: (string | RegExp) => QueryAllReturn, + queryAllByHintText: (string | RegExp) => QueryAllReturn, findByA11yHint: (string | RegExp, ?WaitForOptions) => FindReturn, + findByHintText: (string | RegExp, ?WaitForOptions) => FindReturn, findAllByA11yHint: (string | RegExp, ?WaitForOptions) => FindAllReturn, + findAllByHintText: (string | RegExp, ?WaitForOptions) => FindAllReturn, // Role getByA11yRole: (A11yRole | RegExp) => GetReturn, + getByRole: (A11yRole | RegExp) => GetReturn, getAllByA11yRole: (A11yRole | RegExp) => GetAllReturn, + getAllByRole: (A11yRole | RegExp) => GetAllReturn, queryByA11yRole: (A11yRole | RegExp) => QueryReturn, + queryByRole: (A11yRole | RegExp) => QueryReturn, queryAllByA11yRole: (A11yRole | RegExp) => QueryAllReturn, + queryAllByRole: (A11yRole | RegExp) => QueryAllReturn, findByA11yRole: (A11yRole, ?WaitForOptions) => FindReturn, + findByRole: (A11yRole, ?WaitForOptions) => FindReturn, findAllByA11yRole: (A11yRole, ?WaitForOptions) => FindAllReturn, + findAllByRole: (A11yRole, ?WaitForOptions) => FindAllReturn, // States getByA11yStates: (A11yStates | Array) => GetReturn, @@ -103,36 +121,84 @@ const a11yAPI = (instance: ReactTestInstance): A11yAPI => ...makeQuery( 'accessibilityLabel', { - getBy: ['getByA11yLabel', 'getByAccessibilityLabel'], - getAllBy: ['getAllByA11yLabel', 'getAllByAccessibilityLabel'], - queryBy: ['queryByA11yLabel', 'queryByAccessibilityLabel'], - queryAllBy: ['queryAllByA11yLabel', 'queryAllByAccessibilityLabel'], - findBy: ['findByA11yLabel', 'findByAccessibilityLabel'], - findAllBy: ['findAllByA11yLabel', 'findAllByAccessibilityLabel'], + getBy: ['getByA11yLabel', 'getByAccessibilityLabel', 'getByLabelText'], + getAllBy: [ + 'getAllByA11yLabel', + 'getAllByAccessibilityLabel', + 'getAllByLabelText', + ], + queryBy: [ + 'queryByA11yLabel', + 'queryByAccessibilityLabel', + 'queryByLabelText', + ], + queryAllBy: [ + 'queryAllByA11yLabel', + 'queryAllByAccessibilityLabel', + 'queryAllByLabelText', + ], + findBy: [ + 'findByA11yLabel', + 'findByAccessibilityLabel', + 'findByLabelText', + ], + findAllBy: [ + 'findAllByA11yLabel', + 'findAllByAccessibilityLabel', + 'findAllByLabelText', + ], }, matchStringValue )(instance), ...makeQuery( 'accessibilityHint', { - getBy: ['getByA11yHint', 'getByAccessibilityHint'], - getAllBy: ['getAllByA11yHint', 'getAllByAccessibilityHint'], - queryBy: ['queryByA11yHint', 'queryByAccessibilityHint'], - queryAllBy: ['queryAllByA11yHint', 'queryAllByAccessibilityHint'], - findBy: ['findByA11yHint', 'findByAccessibilityHint'], - findAllBy: ['findAllByA11yHint', 'findAllByAccessibilityHint'], + getBy: ['getByA11yHint', 'getByAccessibilityHint', 'getByHintText'], + getAllBy: [ + 'getAllByA11yHint', + 'getAllByAccessibilityHint', + 'getAllByHintText', + ], + queryBy: [ + 'queryByA11yHint', + 'queryByAccessibilityHint', + 'queryByHintText', + ], + queryAllBy: [ + 'queryAllByA11yHint', + 'queryAllByAccessibilityHint', + 'queryAllByHintText', + ], + findBy: ['findByA11yHint', 'findByAccessibilityHint', 'findByHintText'], + findAllBy: [ + 'findAllByA11yHint', + 'findAllByAccessibilityHint', + 'findAllByHintText', + ], }, matchStringValue )(instance), ...makeQuery( 'accessibilityRole', { - getBy: ['getByA11yRole', 'getByAccessibilityRole'], - getAllBy: ['getAllByA11yRole', 'getAllByAccessibilityRole'], - queryBy: ['queryByA11yRole', 'queryByAccessibilityRole'], - queryAllBy: ['queryAllByA11yRole', 'queryAllByAccessibilityRole'], - findBy: ['findByA11yRole', 'findByAccessibilityRole'], - findAllBy: ['findAllByA11yRole', 'findAllByAccessibilityRole'], + getBy: ['getByA11yRole', 'getByAccessibilityRole', 'getByRole'], + getAllBy: [ + 'getAllByA11yRole', + 'getAllByAccessibilityRole', + 'getAllByRole', + ], + queryBy: ['queryByA11yRole', 'queryByAccessibilityRole', 'queryByRole'], + queryAllBy: [ + 'queryAllByA11yRole', + 'queryAllByAccessibilityRole', + 'queryAllByRole', + ], + findBy: ['findByA11yRole', 'findByAccessibilityRole', 'findByRole'], + findAllBy: [ + 'findAllByA11yRole', + 'findAllByAccessibilityRole', + 'findAllByRole', + ], }, matchStringValue )(instance), diff --git a/typings/__tests__/index.test.tsx b/typings/__tests__/index.test.tsx index 7cf125812..fb45261f7 100644 --- a/typings/__tests__/index.test.tsx +++ b/typings/__tests__/index.test.tsx @@ -41,8 +41,11 @@ const getBy: ReactTestInstance[] = [ tree.getByDisplayValue(/value/g), tree.getByTestId('test-id'), tree.getByA11yLabel('label'), + tree.getByLabelText('label'), tree.getByA11yHint('label'), + tree.getByHintText('label'), tree.getByA11yRole('button'), + tree.getByRole('button'), tree.getByA11yStates('selected'), tree.getByA11yStates(['selected']), tree.getByA11yState({ busy: true }), @@ -61,8 +64,11 @@ const getAllBy: ReactTestInstance[][] = [ tree.getAllByDisplayValue(/value/g), tree.getAllByTestId('test-id'), tree.getAllByA11yLabel('label'), + tree.getAllByLabelText('label'), tree.getAllByA11yHint('label'), + tree.getAllByHintText('label'), tree.getAllByA11yRole('button'), + tree.getAllByRole('button'), tree.getAllByA11yStates('selected'), tree.getAllByA11yStates(['selected']), tree.getAllByA11yState({ busy: true }), @@ -82,8 +88,11 @@ const queryBy: Array = [ tree.queryByDisplayValue(/value/g), tree.queryByTestId('test-id'), tree.queryByA11yHint('label'), + tree.queryByHintText('label'), tree.queryByA11yLabel('label'), + tree.queryByLabelText('label'), tree.queryByA11yRole('button'), + tree.queryByRole('button'), tree.queryByA11yStates('selected'), tree.queryByA11yStates(['selected']), tree.queryByA11yState({ busy: true }), @@ -102,8 +111,11 @@ const queryAllBy: ReactTestInstance[][] = [ tree.queryAllByDisplayValue(/value/g), tree.queryAllByTestId('test-id'), tree.queryAllByA11yLabel('label'), + tree.queryAllByLabelText('label'), tree.queryAllByA11yHint('label'), + tree.queryAllByHintText('label'), tree.queryAllByA11yRole('button'), + tree.queryAllByRole('button'), tree.queryAllByA11yStates('selected'), tree.queryAllByA11yStates(['selected']), tree.queryAllByA11yState({ busy: true }), @@ -131,10 +143,16 @@ const findBy: Promise[] = [ tree.findByTestId('test-id', { timeout: 10, interval: 10 }), tree.findByA11yLabel('label'), tree.findByA11yLabel('label', { timeout: 10, interval: 10 }), + tree.findByLabelText('label'), + tree.findByLabelText('label', { timeout: 10, interval: 10 }), tree.findByA11yHint('label'), tree.findByA11yHint('label', { timeout: 10, interval: 10 }), + tree.findByHintText('label'), + tree.findByHintText('label', { timeout: 10, interval: 10 }), tree.findByA11yRole('button'), tree.findByA11yRole('button', { timeout: 10, interval: 10 }), + tree.findByRole('button'), + tree.findByRole('button', { timeout: 10, interval: 10 }), tree.findByA11yState({ busy: true }), tree.findByA11yState({ busy: true }, { timeout: 10, interval: 10 }), tree.findByA11yValue({ min: 10 }), @@ -158,8 +176,12 @@ const findAllBy: Promise[] = [ tree.findAllByTestId('test-id', { timeout: 10, interval: 10 }), tree.findAllByA11yLabel('label'), tree.findAllByA11yLabel('label', { timeout: 10, interval: 10 }), + tree.findAllByLabelText('label'), + tree.findAllByLabelText('label', { timeout: 10, interval: 10 }), tree.findAllByA11yHint('label'), tree.findAllByA11yHint('label', { timeout: 10, interval: 10 }), + tree.findAllByHintText('label'), + tree.findAllByHintText('label', { timeout: 10, interval: 10 }), tree.findAllByA11yState({ busy: true }), tree.findAllByA11yState({ busy: true }, { timeout: 10, interval: 10 }), tree.findAllByA11yValue({ min: 10 }), @@ -274,8 +296,11 @@ const withinGet: Array = [ within(instance).getByPlaceholder('Test'), within(instance).getByTestId('Test'), within(instance).getByA11yLabel('Test'), + within(instance).getByLabelText('Test'), within(instance).getByA11yHint('Test'), + within(instance).getByHintText('Test'), within(instance).getByA11yRole('button'), + within(instance).getByRole('button'), within(instance).getByA11yState({ busy: true }), within(instance).getByA11yValue({ min: 10 }), ]; @@ -286,8 +311,11 @@ const withinGetAll: Array = [ within(instance).getAllByPlaceholder('Test'), within(instance).getAllByTestId('Test'), within(instance).getAllByA11yLabel('Test'), + within(instance).getAllByLabelText('button'), within(instance).getAllByA11yHint('Test'), + within(instance).getAllByHintText('button'), within(instance).getAllByA11yRole('button'), + within(instance).getAllByRole('button'), within(instance).getAllByA11yState({ busy: true }), within(instance).getAllByA11yValue({ min: 10 }), ]; @@ -298,8 +326,11 @@ const withinQuery: Array = [ within(instance).queryByPlaceholder('Test'), within(instance).queryByTestId('Test'), within(instance).queryByA11yLabel('Test'), + within(instance).queryByLabelText('button'), within(instance).queryByA11yHint('Test'), + within(instance).queryByHintText('button'), within(instance).queryByA11yRole('button'), + within(instance).queryByRole('button'), within(instance).queryByA11yState({ busy: true }), within(instance).queryByA11yValue({ min: 10 }), ]; @@ -310,8 +341,11 @@ const withinQueryAll: Array = [ within(instance).queryAllByPlaceholder('Test'), within(instance).queryAllByTestId('Test'), within(instance).queryAllByA11yLabel('Test'), + within(instance).queryAllByLabelText('Test'), within(instance).queryAllByA11yHint('Test'), + within(instance).queryAllByHintText('Test'), within(instance).queryAllByA11yRole('button'), + within(instance).queryAllByRole('button'), within(instance).queryAllByA11yState({ busy: true }), within(instance).queryAllByA11yValue({ min: 10 }), ]; @@ -322,8 +356,11 @@ const withinFind: Promise[] = [ within(instance).findByPlaceholder('Test'), within(instance).findByTestId('Test'), within(instance).findByA11yLabel('Test'), + within(instance).findByLabelText('Test'), within(instance).findByA11yHint('Test'), + within(instance).findByHintText('Test'), within(instance).findByA11yRole('button'), + within(instance).findByRole('button'), within(instance).findByA11yState({ busy: true }), within(instance).findByA11yValue({ min: 10 }), ]; @@ -334,8 +371,11 @@ const withinFindAll: Promise[] = [ within(instance).findAllByPlaceholder('Test'), within(instance).findAllByTestId('Test'), within(instance).findAllByA11yLabel('Test'), + within(instance).findAllByLabelText('Test'), within(instance).findAllByA11yHint('Test'), + within(instance).findAllByHintText('Test'), within(instance).findAllByA11yRole('button'), + within(instance).findAllByRole('button'), within(instance).findAllByA11yState({ busy: true }), within(instance).findAllByA11yValue({ min: 10 }), ]; diff --git a/typings/index.d.ts b/typings/index.d.ts index 1ce700596..da01039a7 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -167,45 +167,81 @@ export type A11yValue = { type A11yAPI = { // Label getByA11yLabel: (matcher: string | RegExp) => GetReturn; + getByLabelText: (matcher: string | RegExp) => GetReturn; getAllByA11yLabel: (matcher: string | RegExp) => GetAllReturn; + getAllByLabelText: (matcher: string | RegExp) => GetAllReturn; queryByA11yLabel: (matcher: string | RegExp) => QueryReturn; + queryByLabelText: (matcher: string | RegExp) => QueryReturn; queryAllByA11yLabel: (matcher: string | RegExp) => QueryAllReturn; + queryAllByLabelText: (matcher: string | RegExp) => QueryAllReturn; findByA11yLabel: ( matcher: string | RegExp, waitForOptions?: WaitForOptions ) => FindReturn; + findByLabelText: ( + matcher: string | RegExp, + waitForOptions?: WaitForOptions + ) => FindReturn; findAllByA11yLabel: ( matcher: string | RegExp, waitForOptions?: WaitForOptions ) => FindAllReturn; + findAllByLabelText: ( + matcher: string | RegExp, + waitForOptions?: WaitForOptions + ) => FindAllReturn; // Hint getByA11yHint: (matcher: string | RegExp) => GetReturn; + getByHintText: (matcher: string | RegExp) => GetReturn; getAllByA11yHint: (matcher: string | RegExp) => GetAllReturn; + getAllByHintText: (matcher: string | RegExp) => GetAllReturn; queryByA11yHint: (matcher: string | RegExp) => QueryReturn; + queryByHintText: (matcher: string | RegExp) => QueryReturn; queryAllByA11yHint: (matcher: string | RegExp) => QueryAllReturn; + queryAllByHintText: (matcher: string | RegExp) => QueryAllReturn; findByA11yHint: ( matcher: string | RegExp, waitForOptions?: WaitForOptions ) => FindReturn; + findByHintText: ( + matcher: string | RegExp, + waitForOptions?: WaitForOptions + ) => FindReturn; findAllByA11yHint: ( matcher: string | RegExp, waitForOptions?: WaitForOptions ) => FindAllReturn; + findAllByHintText: ( + matcher: string | RegExp, + waitForOptions?: WaitForOptions + ) => FindAllReturn; // Role getByA11yRole: (matcher: AccessibilityRole | RegExp) => GetReturn; + getByRole: (matcher: AccessibilityRole | RegExp) => GetReturn; getAllByA11yRole: (matcher: AccessibilityRole | RegExp) => GetAllReturn; + getAllByRole: (matcher: AccessibilityRole | RegExp) => GetAllReturn; queryByA11yRole: (matcher: AccessibilityRole | RegExp) => QueryReturn; + queryByRole: (matcher: AccessibilityRole | RegExp) => QueryReturn; queryAllByA11yRole: (matcher: AccessibilityRole | RegExp) => QueryAllReturn; + queryAllByRole: (matcher: AccessibilityRole | RegExp) => QueryAllReturn; findByA11yRole: ( matcher: AccessibilityRole | RegExp, waitForOptions?: WaitForOptions ) => FindReturn; + findByRole: ( + matcher: AccessibilityRole | RegExp, + waitForOptions?: WaitForOptions + ) => FindReturn; findAllByA11yRole: ( matcher: AccessibilityRole | RegExp, waitForOptions?: WaitForOptions ) => FindAllReturn; + findAllByRole: ( + matcher: AccessibilityRole | RegExp, + waitForOptions?: WaitForOptions + ) => FindAllReturn; // States getByA11yStates: ( diff --git a/website/docs/Queries.md b/website/docs/Queries.md index 5a288b119..756c97cb8 100644 --- a/website/docs/Queries.md +++ b/website/docs/Queries.md @@ -111,10 +111,11 @@ const element = getByTestId('unique-id'); Please be mindful when using these API and **treat it as an escape hatch**. Your users can't interact with `testID` anyhow, so you may end up writing tests that provide false sense of security. Favor text and accessibility queries instead. ::: -### `ByA11yLabel`, `ByAccessibilityLabel` +### `ByA11yLabel`, `ByAccessibilityLabel`, `ByLabelText` > getByA11yLabel, getAllByA11yLabel, queryByA11yLabel, queryAllByA11yLabel, findByA11yLabel, findAllByA11yLabel > getByAccessibilityLabel, getAllByAccessibilityLabel, queryByAccessibilityLabel, queryAllByAccessibilityLabel, findByAccessibilityLabel, findAllByAccessibilityLabel +> getByLabelText, getAllByLabelText, queryByLabelText, queryAllByLabelText, findByLabelText, findAllByLabelText Returns a `ReactTestInstance` with matching `accessibilityLabel` prop. @@ -125,10 +126,11 @@ const { getByA11yLabel } = render(); const element = getByA11yLabel('my-label'); ``` -### `ByA11yHint`, `ByAccessibilityHint` +### `ByA11yHint`, `ByAccessibilityHint`, `ByHintText` > getByA11yHint, getAllByA11yHint, queryByA11yHint, queryAllByA11yHint, findByA11yHint, findAllByA11yHint > getByAccessibilityHint, getAllByAccessibilityHint, queryByAccessibilityHint, queryAllByAccessibilityHint, findByAccessibilityHint, findAllByAccessibilityHint +> getByHintText, getAllByHintText, queryByHintText, queryAllByHintText, findByHintText, findAllByHintText Returns a `ReactTestInstance` with matching `accessibilityHint` prop. @@ -154,10 +156,11 @@ const element = getByA11yStates(['checked']); const element2 = getByA11yStates('checked'); ``` -### `ByA11yRole`, `ByAccessibilityRole` +### `ByA11yRole`, `ByAccessibilityRole`, `ByRole` > getByA11yRole, getAllByA11yRole, queryByA11yRole, queryAllByA11yRole, findByA11yRole, findAllByA11yRole > getByAccessibilityRole, getAllByAccessibilityRole, queryByAccessibilityRole, queryAllByAccessibilityRole, findByAccessibilityRole, findAllByAccessibilityRole +> getByRole, getAllByRole, queryByRole, queryAllByRole, findByRole, findAllByRole Returns a `ReactTestInstance` with matching `accessibilityRole` prop.