forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDatePickerIOS-test.js
More file actions
68 lines (55 loc) · 2.05 KB
/
DatePickerIOS-test.js
File metadata and controls
68 lines (55 loc) · 2.05 KB
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
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @emails oncall+react_native
* @format
*/
/* global element, by, expect, device */
const {
openComponentWithLabel,
openExampleWithTitle,
} = require('../e2e-helpers');
describe('DatePickerIOS', () => {
beforeAll(async () => {
await device.reloadReactNative();
await openComponentWithLabel(
'<DatePickerIOS>',
'<DatePickerIOS> Select dates and times using the native UIDatePicker.',
);
});
it('Should change indicator with datetime picker', async () => {
await openExampleWithTitle('Date and time picker');
const testID = 'date-and-time';
const testElement = await element(
by.type('UIPickerView').withAncestor(by.id(testID)),
);
const dateIndicator = await element(by.id('date-indicator'));
const timeIndicator = await element(by.id('time-indicator'));
await expect(testElement).toBeVisible();
await expect(dateIndicator).toBeVisible();
await expect(timeIndicator).toBeVisible();
await testElement.setColumnToValue(0, 'Dec 4');
await testElement.setColumnToValue(1, '4');
await testElement.setColumnToValue(2, '10');
await testElement.setColumnToValue(3, 'AM');
await expect(dateIndicator).toHaveText('12/4/2006');
await expect(timeIndicator).toHaveText('04:10 AM');
});
it('Should change indicator with date-only picker', async () => {
await openExampleWithTitle('Date only picker');
const testID = 'date-only';
const testElement = await element(
by.type('UIPickerView').withAncestor(by.id(testID)),
);
const indicator = await element(by.id('date-indicator'));
await expect(testElement).toBeVisible();
await expect(indicator).toBeVisible();
await testElement.setColumnToValue(0, 'November');
await testElement.setColumnToValue(1, '3');
await testElement.setColumnToValue(2, '2006');
await expect(indicator).toHaveText('11/3/2006');
});
});