Skip to content

Commit 9f34321

Browse files
author
Vineeth K
committed
Added Test Cases for the accessibilty Label,Level etc
1 parent 0ab8881 commit 9f34321

File tree

2 files changed

+35
-6
lines changed

2 files changed

+35
-6
lines changed

packages/@react-native-windows/tester/src/js/examples-win/Accessibility/AccessibilityExampleWindows.tsx

+8-6
Original file line numberDiff line numberDiff line change
@@ -19,28 +19,30 @@ class AccessibilityBaseExample extends React.Component {
1919
public render() {
2020
return (
2121
<View>
22-
<Text accessibilityLevel={1}>
23-
The following has accessibilityLabel and accessibilityHint:
24-
</Text>
22+
<Text>The following has accessibilityLabel and accessibilityHint:</Text>
2523
<View
2624
style={{width: 50, height: 50, backgroundColor: 'blue'}}
25+
accessible={true}
2726
accessibilityLabel="A blue box"
2827
accessibilityHint="A hint for the blue box."
29-
accessibilityLevel={2}
28+
accessibilityLevel={1}
29+
testID="accessibility-base-view-1"
3030
/>
3131
<Text>The following has accessible and accessibilityLabel:</Text>
3232
<View
3333
style={{width: 50, height: 50, backgroundColor: 'red'}}
3434
accessible={true}
3535
accessibilityLabel="A hint for the red box."
36-
accessibilityLevel={3}
36+
accessibilityLevel={2}
37+
testID="accessibility-base-view-2"
3738
/>
38-
<Text accessibilityLevel={4}>
39+
<Text>
3940
The following has accessibilitySetSize, accessibilityPosInSet and
4041
accessibilityLabel:
4142
</Text>
4243
<View
4344
style={{width: 50, height: 50, backgroundColor: 'red'}}
45+
testID="accessibility-base-view-3"
4446
accessible={true}
4547
accessibilityRole="listitem"
4648
accessibilityLabel="This label should not be used"

packages/e2e-test-app-fabric/test/AccessibilityTest.test.ts

+27
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,31 @@ describe('Accessibility Tests', () => {
7777
const dump = await dumpVisualTree('accessibilityValue-text');
7878
expect(dump).toMatchSnapshot();
7979
});
80+
test('Accessibility data for Label,Level and Hint', async () => {
81+
await searchBox('Lab');
82+
const componentsTab = await app.findElementByTestID(
83+
'accessibility-base-view-1',
84+
);
85+
await componentsTab.waitForDisplayed({timeout: 5000});
86+
const dump = await dumpVisualTree('accessibility-base-view-1');
87+
expect(dump).toMatchSnapshot();
88+
});
89+
test('Accessibility data for Label and Level', async () => {
90+
await searchBox('Lab');
91+
const componentsTab = await app.findElementByTestID(
92+
'accessibility-base-view-2',
93+
);
94+
await componentsTab.waitForDisplayed({timeout: 5000});
95+
const dump = await dumpVisualTree('accessibility-base-view-2');
96+
expect(dump).toMatchSnapshot();
97+
});
98+
test('Accessibility data for Role, Setsize etc.', async () => {
99+
await searchBox('Lab');
100+
const componentsTab = await app.findElementByTestID(
101+
'accessibility-base-view-3',
102+
);
103+
await componentsTab.waitForDisplayed({timeout: 5000});
104+
const dump = await dumpVisualTree('accessibility-base-view-3');
105+
expect(dump).toMatchSnapshot();
106+
});
80107
});

0 commit comments

Comments
 (0)