File tree Expand file tree Collapse file tree 6 files changed +50
-43
lines changed Expand file tree Collapse file tree 6 files changed +50
-43
lines changed Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ export default function App(): JSX.Element {
71
71
< View style = { styles . testPickerContainer } > { navigationBar } </ View >
72
72
73
73
< View
74
- testID = { `${ currentTest . testId } -view` }
74
+ accessibilityLabel = { `${ currentTest . testId } -view` }
75
75
key = { currentTest . title + iteration }
76
76
style = { styles . exampleContainer }
77
77
>
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ import { commands as cmd } from './commands' ;
2
+ import testCases from '../examples/tests' ;
3
+
4
+ describe ( 'Async Storage' , ( ) => {
5
+ describe ( 'functional tests' , ( ) => {
6
+ it ( 'should be visible' , async ( ) => {
7
+ const el = await cmd . elementByLabel ( 'functional-view' ) ;
8
+ await expect ( await el . isExisting ( ) ) . toEqual ( true ) ;
9
+ } ) ;
10
+
11
+ const testNames = Object . keys ( testCases ) ;
12
+ for ( const name of testNames ) {
13
+ it ( `${ name } ` , async ( ) => {
14
+ const el = await cmd . elementByLabel ( `test:${ name } ` ) ;
15
+ await expect ( await el . getText ( ) ) . toEqual ( 'Pass' ) ;
16
+ } ) ;
17
+ }
18
+
19
+ // Re-run tests with native delegate set
20
+ for ( const currentName of testNames ) {
21
+ const name = currentName + ' with delegate' ;
22
+ it ( `${ name } ` , async ( ) => {
23
+ const el = await cmd . elementByLabel ( `test:${ name } ` ) ;
24
+ const label = await el . getText ( ) ;
25
+ if ( label === 'Skip' ) {
26
+ return ;
27
+ }
28
+
29
+ expect ( label ) . toEqual ( 'Pass' ) ;
30
+ } ) ;
31
+ }
32
+ } ) ;
33
+ } ) ;
Original file line number Diff line number Diff line change
1
+ import { e2e } from '../jest.setup' ;
2
+
3
+ const testAppId = 'com.microsoft.reacttestapp' ;
4
+
5
+ export const commands = {
6
+ restartApp : async ( ) => {
7
+ await e2e . terminateApp ( testAppId ) ;
8
+ await e2e . activateApp ( testAppId ) ;
9
+ } ,
10
+ elementByLabel : async ( id : string ) => await e2e . $ ( `~${ id } ` ) ,
11
+ elementByLabelBy : async ( id : string ) => await e2e . $ ( `aria/${ id } ` ) ,
12
+ } ;
Original file line number Diff line number Diff line change @@ -141,11 +141,7 @@ function Functional(): JSX.Element {
141
141
return (
142
142
< View key = { name } style = { styles . passed } >
143
143
< Text style = { styles . testLabel } > { name } </ Text >
144
- < Text
145
- accessibilityLabel = "Pass"
146
- testID = { testID }
147
- style = { styles . testResult }
148
- >
144
+ < Text accessibilityLabel = { testID } style = { styles . testResult } >
149
145
Pass
150
146
</ Text >
151
147
</ View >
@@ -156,11 +152,7 @@ function Functional(): JSX.Element {
156
152
return (
157
153
< View key = { name } style = { styles . skipped } >
158
154
< Text style = { styles . testLabel } > { name } </ Text >
159
- < Text
160
- accessibilityLabel = "Skip"
161
- testID = { testID }
162
- style = { styles . testResult }
163
- >
155
+ < Text accessibilityLabel = { testID } style = { styles . testResult } >
164
156
Skip
165
157
</ Text >
166
158
</ View >
@@ -170,7 +162,7 @@ function Functional(): JSX.Element {
170
162
return (
171
163
< View key = { name } style = { styles . failed } >
172
164
< Text style = { styles . testLabel } > { name } </ Text >
173
- < View accessibilityLabel = "Fail" testID = { testID } >
165
+ < View accessibilityLabelledBy = "Fail" accessibilityLabel = { testID } >
174
166
< Text style = { styles . testResult } > { `Step: ${
175
167
result . step + 1
176
168
} `} </ Text >
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ const config: JestConfig = {
7
7
bail : 0 ,
8
8
rootDir : '..' ,
9
9
setupFilesAfterEnv : [ './example/jest.setup.ts' ] ,
10
- testMatch : [ '**/?(*.)e2e .ts(x)?' ] ,
10
+ testMatch : [ '**/?(*.)spec .ts(x)?' ] ,
11
11
moduleNameMapper : {
12
12
'^uuid$' : '<rootDir>/node_modules/uuid/wrapper.mjs' ,
13
13
} ,
You can’t perform that action at this time.
0 commit comments