-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathApp-test.js
329 lines (292 loc) · 9.23 KB
/
App-test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
import React from 'react';
import {create, act} from 'react-test-renderer';
import {ButtonExamplePage} from '../src/examples/ButtonExamplePage';
import {TextExamplePage} from '../src/examples/TextExamplePage';
import {TextInputExamplePage} from '../src/examples/TextInputExamplePage';
import {TouchableHighlightExamplePage} from '../src/examples/TouchableHighlightExamplePage';
import {TouchableOpacityExamplePage} from '../src/examples/TouchableOpacityExamplePage';
import {SwitchExamplePage} from '../src/examples/SwitchExamplePage';
import {ViewExamplePage} from '../src/examples/ViewExamplePage';
import {ImageExamplePage} from '../src/examples/ImageExamplePage';
import {PressableExamplePage} from '../src/examples/PressableExamplePage';
import {FlatListExamplePage} from '../src/examples/FlatListExamplePage';
import {ScrollViewExamplePage} from '../src/examples/ScrollViewExample';
import {PopupExamplePage} from '../src/examples/PopupExamplePage';
import {FlyoutExamplePage} from '../src/examples/FlyoutExamplePage';
import {CheckBoxExamplePage} from '../src/examples/CheckBoxExamplePage';
import {ClipboardExamplePage} from '../src/examples/ClipboardExamplePage';
import {ConfigExamplePage} from '../src/examples/ConfigExamplePage';
import {DatePickerExamplePage} from '../src/examples/DatePickerExamplePage';
import {TimePickerExamplePage} from '../src/examples/TimePickerExamplePage';
// Issue: Usage of UIManager.getViewManangerConfig returning undefined
//import {SketchExamplePage} from '../src/examples/SketchExamplePage';
import {SliderExamplePage} from '../src/examples/SliderExamplePage';
//import {PermissionsExamplePage} from '../src/examples/PermissionsExamplePage';
import {PickerExamplePage} from '../src/examples/PickerExamplePage';
import {PrintExamplePage} from '../src/examples/PrintExamplePage';
import {DeviceInfoExamplePage} from '../src/examples/DeviceInfoExamplePage';
import {TTSExamplePage} from '../src/examples/TTSExamplePage';
import {WebViewExamplePage} from '../src/examples/WebViewExamplePage';
import {SensitiveInfoExamplePage} from '../src/examples/SensitiveInfoExamplePage';
import {ProgressViewExamplePage} from '../src/examples/ProgressViewExamplePage';
import {XamlExamplePage} from '../src/examples/XamlExamplePage';
// Issue: Usage of UIManager.getViewManangerConfig returning undefined
//import {TrackPlayerExamplePage} from '../src/examples/TrackPlayerExamplePage';
import {WindowsHelloExamplePage} from '../src/examples/WindowsHelloExamplePage';
import {ExpanderExamplePage} from '../src/examples/ExpanderExamplePage';
// https://github.com/microsoft/react-native-gallery/issues/420
// Unable to import: {export * from './types'; SyntaxError: Unexpected token 'export'
//import {RadioButtonsExamplePage} from '../src/examples/RadioButtonsExamplePage';
import {NetworkExamplePage} from '../src/examples/NetworkExamplePage';
import {SvgExamplePage} from '../src/examples/SvgExamplePage';
import {View} from 'react-native';
jest.useFakeTimers();
function Control() {
return <View />;
}
test('Control', async () => {
let tree;
await act(async () => {
tree = create(<Control />);
});
expect(tree.toJSON()).toMatchSnapshot();
});
test('Button Example Page', async () => {
let tree;
await act(async () => {
tree = create(<ButtonExamplePage />);
});
expect(tree.toJSON()).toMatchSnapshot();
});
test('CheckBox Example Page', async () => {
let tree;
await act(async () => {
tree = create(<CheckBoxExamplePage />);
});
expect(tree.toJSON()).toMatchSnapshot();
});
test('Clipboard Example Page', async () => {
let tree;
await act(async () => {
tree = create(<ClipboardExamplePage />);
});
expect(tree.toJSON()).toMatchSnapshot();
});
test('Config Example Page', async () => {
let tree;
await act(async () => {
tree = create(<ConfigExamplePage />);
});
expect(tree.toJSON()).toMatchSnapshot();
});
test('DatePicker Example Page', async () => {
let tree;
await act(() => {
tree = create(<DatePickerExamplePage />).toJSON();
});
expect(tree).toMatchSnapshot();
});
test('DeviceInfo Example Page', async () => {
let tree;
await act(async () => {
tree = create(<DeviceInfoExamplePage />);
});
expect(tree.toJSON()).toMatchSnapshot();
});
test('Expander Example Page', async () => {
let tree;
await act(() => {
tree = create(<ExpanderExamplePage />);
});
expect(tree.toJSON()).toMatchSnapshot();
});
// Issue: Tests hang when this test is enabled
/*test('Permissions Example Page', async () => {
let tree;
await act(() => {
tree = create(<PermissionsExamplePage />);
});
expect(tree.toJSON()).toMatchSnapshot();
});
// Issue: https://github.com/microsoft/react-native-windows/issues/13436
test('FlatList Example Page', async() => {
let tree;
await act(() => {
tree = create(<FlatListExamplePage />);
});
expect(tree).toMatchSnapshot();
});
*/
test('Flyout Example Page', async () => {
let tree;
await act(() => {
tree = create(<FlyoutExamplePage />);
});
expect(tree.toJSON()).toMatchSnapshot();
});
test('Image Example Page', async () => {
let tree;
await act(() => {
tree = create(<ImageExamplePage />);
});
expect(tree.toJSON()).toMatchSnapshot();
});
test('Networking Example Page', async () => {
let tree;
await act(() => {
tree = create(<NetworkExamplePage />);
});
expect(tree.toJSON()).toMatchSnapshot();
});
test('Picker Example Page', async () => {
let tree;
await act(async () => {
tree = create(<PickerExamplePage />);
});
expect(tree.toJSON()).toMatchSnapshot();
});
test('Popup Example Page', async () => {
let tree;
await act(async () => {
tree = create(<PopupExamplePage />);
});
expect(tree.toJSON()).toMatchSnapshot();
});
test('Pressable Example Page', async () => {
let tree;
await act(async () => {
tree = create(<PressableExamplePage />);
});
expect(tree.toJSON()).toMatchSnapshot();
});
test('Print Example Page', async () => {
let tree;
await act(async () => {
tree = create(<PrintExamplePage />);
});
expect(tree.toJSON()).toMatchSnapshot();
});
test('ProgressView Example Page', async () => {
let tree;
await act(async () => {
tree = create(<ProgressViewExamplePage />);
});
expect(tree.toJSON()).toMatchSnapshot();
});
/*test('Radio Buttons Example Page', () => {
const tree = create(<RadioButtonsExamplePage />).toJSON();
expect(tree).toMatchSnapshot();
});*/
test('ScrollView Example Page', async () => {
let tree;
await act(async () => {
tree = create(<ScrollViewExamplePage />);
});
expect(tree.toJSON()).toMatchSnapshot();
});
test('SensitiveInfo Example Page', async () => {
let tree;
await act(async () => {
tree = create(<SensitiveInfoExamplePage />);
});
expect(tree.toJSON()).toMatchSnapshot();
});
/*test('SketchCanvas Example Page', () => {
const tree = create(<SketchExamplePage />).toJSON();
expect(tree).toMatchSnapshot();
});*/
test('Slider Example Page', async () => {
let tree;
await act(async () => {
tree = create(<SliderExamplePage />);
});
expect(tree.toJSON()).toMatchSnapshot();
});
test('SVG Example Page', async () => {
let tree;
await act(async () => {
tree = create(<SvgExamplePage />);
});
expect(tree.toJSON()).toMatchSnapshot();
});
test('Switch Example Page', async () => {
let tree;
await act(async () => {
tree = create(<SwitchExamplePage />);
});
expect(tree.toJSON()).toMatchSnapshot();
});
test('Text Example Page', async () => {
let tree;
await act(async () => {
tree = create(<TextExamplePage />);
});
expect(tree.toJSON()).toMatchSnapshot();
});
test('TextInput Example Page', async () => {
let tree;
await act(async () => {
tree = create(<TextInputExamplePage />);
});
expect(tree.toJSON()).toMatchSnapshot();
});
test('TimePicker Example Page', async () => {
let tree;
await act(() => {
tree = create(<TimePickerExamplePage />).toJSON();
});
expect(tree).toMatchSnapshot();
});
test('TextToSpeech Example Page', async () => {
let tree;
await act(async () => {
tree = create(<TTSExamplePage />);
});
expect(tree.toJSON()).toMatchSnapshot();
});
test('TouchableHighlight Example Page', async () => {
let tree;
await act(async () => {
tree = create(<TouchableHighlightExamplePage />);
});
expect(tree.toJSON()).toMatchSnapshot();
});
test('TouchableOpacity Example Page', async () => {
let tree;
await act(async () => {
tree = create(<TouchableOpacityExamplePage />);
});
expect(tree.toJSON()).toMatchSnapshot();
});
/*test('TrackPlayer Example Page', () => {
const tree = create(<TrackPlayerExamplePage />).toJSON();
expect(tree).toMatchSnapshot();
});*/
test('View Example Page', async () => {
let tree;
await act(async () => {
tree = create(<ViewExamplePage />);
});
expect(tree.toJSON()).toMatchSnapshot();
});
test('WebView Example Page', async () => {
let tree;
await act(async () => {
tree = create(<WebViewExamplePage />);
});
expect(tree.toJSON()).toMatchSnapshot();
});
test('Hello Example Page', async () => {
let tree;
await act(async () => {
tree = create(<WindowsHelloExamplePage />);
});
expect(tree.toJSON()).toMatchSnapshot();
});
test('Xaml Example Page', async () => {
let tree;
await act(async () => {
tree = create(<XamlExamplePage />);
});
expect(tree.toJSON()).toMatchSnapshot();
});