@@ -65,6 +65,12 @@ describe("DateTimePicker", () => {
65
65
expect ( title ) . to . exist ;
66
66
} ) ;
67
67
68
+ it ( "Should expand date picker field examples" , async ( ) => {
69
+ const dateFieldTitle = await driver . findElementByText ( "DatePickerField" , SearchOptions . contains ) ;
70
+ expect ( dateFieldTitle ) . to . exist ;
71
+ await dateFieldTitle . click ( ) ;
72
+ } ) ;
73
+
68
74
it ( "Should select date and verify value of picker field" , async ( ) => {
69
75
const selectDateField = await driver . findElementByText ( "select date" , SearchOptions . contains ) ;
70
76
await selectDateField . click ( ) ;
@@ -74,15 +80,6 @@ describe("DateTimePicker", () => {
74
80
expect ( dateSelected ) . to . exist ;
75
81
} ) ;
76
82
77
- it ( "Should select time and verify value of picker field" , async ( ) => {
78
- const selectTimeField = await driver . findElementByText ( "select time" , SearchOptions . contains ) ;
79
- await selectTimeField . click ( ) ;
80
- const timeString = await getPickerTime ( driver , 12 ) ;
81
- await clickOkBtn ( driver ) ;
82
- const timeSelected = await driver . findElementByText ( timeString , SearchOptions . contains ) ;
83
- expect ( timeSelected ) . to . exist ;
84
- } ) ;
85
-
86
83
it ( "Should select date from min/max limited field" , async ( ) => {
87
84
const minMaxDatePicker = await driver . findElementByText ( "tap to select" , SearchOptions . contains ) ;
88
85
await minMaxDatePicker . click ( ) ;
@@ -93,22 +90,6 @@ describe("DateTimePicker", () => {
93
90
expect ( dateSelected ) . to . exist ;
94
91
} ) ;
95
92
96
- it ( "Should open 12h time format and verify wheelers values" , async ( ) => {
97
- const twelveHourFormat = await driver . findElementByText ( "4:00 PM" , SearchOptions . contains ) ;
98
- await twelveHourFormat . click ( ) ;
99
- const timeString = await getPickerTime ( driver , 12 ) ;
100
- await clickOkBtn ( driver ) ;
101
- expect ( timeString ) . to . equal ( "4:00 PM" ) ;
102
- } ) ;
103
-
104
- it ( "Should open 24h format and verify wheeler value" , async ( ) => {
105
- const twentyFourFormat = await scrollToElement ( driver , "16:00" , Direction . down ) ;
106
- await twentyFourFormat . click ( ) ;
107
- const timeString = await getPickerTime ( driver , 24 ) ;
108
- await clickOkBtn ( driver ) ;
109
- expect ( timeString ) . to . equal ( "16:00" ) ;
110
- } ) ;
111
-
112
93
it ( "Should verify modified texts field for date picker" , async ( ) => {
113
94
await scrollToElement ( driver , "preferred locale: en_US" , Direction . down ) ;
114
95
const pickers = await driver . findElementsByText ( "tap to choose" ) ;
@@ -126,23 +107,8 @@ describe("DateTimePicker", () => {
126
107
expect ( dateString ) . to . exist ;
127
108
} ) ;
128
109
129
- it ( "Should verify modified texts field for time picker" , async ( ) => {
130
- const datePicker = await driver . findElementByText ( "tap to choose" ) ;
131
- await datePicker . click ( ) ;
132
- const time = await getPickerTime ( driver , 12 ) ;
133
- const approveBtn = await driver . findElementByText ( "Approve" , SearchOptions . contains ) ;
134
- const rejectBtn = await driver . findElementByText ( "Reject" , SearchOptions . contains ) ;
135
- const title = await driver . findElementByText ( "Confirm predefined time selection" , SearchOptions . contains ) ;
136
- expect ( approveBtn ) . to . exist ;
137
- expect ( rejectBtn ) . to . exist ;
138
- expect ( title ) . to . exist ;
139
- await approveBtn . click ( ) ;
140
- const dateString = await driver . findElementByText ( time ) ;
141
- expect ( dateString ) . to . exist ;
142
- } ) ;
143
-
144
110
it ( "Should select date from de_De locale picker and verify format" , async ( ) => {
145
- await scrollToElement ( driver , "zeit wählen " , Direction . down ) ;
111
+ await scrollToElement ( driver , "datum auswählen " , Direction . down ) ;
146
112
const deLocale = await driver . findElementByText ( "preferred locale: de_DE" ) ;
147
113
expect ( deLocale ) . to . exist ;
148
114
const datePicker = await driver . findElementByText ( "datum auswählen" , SearchOptions . contains ) ;
@@ -181,56 +147,35 @@ describe("DateTimePicker", () => {
181
147
expect ( dateString ) . to . exist ;
182
148
} ) ;
183
149
184
- it ( "Should select time from de_DE locale picker and verify format" , async ( ) => {
185
- const timePicker = await driver . findElementByText ( "zeit wählen" , SearchOptions . contains ) ;
186
- await timePicker . click ( ) ;
187
- const time = await getPickerTime ( driver , 24 ) ;
188
- let acceptBtn ;
189
- let rejectBtn ;
190
- if ( driver . isAndroid ) {
191
- let buttons = await driver . findElementsByClassName ( "android.widget.Button" ) ;
192
- acceptBtn = buttons [ 5 ] ;
193
- rejectBtn = buttons [ 4 ] ;
194
- }
195
- else {
196
- acceptBtn = await driver . findElementByText ( "Bestätigen" , SearchOptions . exact ) ;
197
- rejectBtn = await driver . findElementByText ( "Stornieren" , SearchOptions . exact ) ;
198
- }
199
- const title = await driver . findElementByText ( "Zeit wählen" , SearchOptions . exact ) ;
200
- expect ( acceptBtn ) . to . exist ;
201
- expect ( rejectBtn ) . to . exist ;
202
- expect ( title ) . to . exist ;
203
- await acceptBtn . click ( ) ;
204
- const dateField = await driver . findElementByText ( time ) ;
205
- expect ( time ) . to . exist ;
206
- } ) ;
207
-
208
150
it ( "Should scroll to custom format and verify values" , async ( ) => {
209
151
await scrollToElement ( driver , "binding" , Direction . down ) ;
210
152
const customFromatLabel = await driver . findElementByText ( "custom format" ) ;
211
153
expect ( customFromatLabel ) . to . exist ;
212
154
const customFormatDate = await driver . findElementByText ( "date: 24 February 2019" , SearchOptions . exact ) ;
213
155
expect ( customFormatDate ) . to . exist ;
214
- const customFormatTime = await driver . findElementByText ( "time: 01:00" , SearchOptions . exact ) ;
215
- expect ( customFormatTime ) . to . exist ;
156
+ } ) ;
157
+
158
+ it ( "Should scroll to css styled DatePicker and verify picker style" , async ( ) => {
159
+ let cssPickers = await driver . findElementsByText ( "Feb 24, 2019" , SearchOptions . exact ) ;
160
+ await cssPickers [ cssPickers . length - 1 ] . click ( ) ;
161
+ await getPickerDate ( driver ) ;
162
+ await driver . compareScreen ( "cssDatePicker" ) ;
163
+ await clickOkBtn ( driver ) ;
216
164
} ) ;
217
165
218
166
it ( "Should scroll to binding example and verify picker and label values" , async ( ) => {
219
- await scrollToElement ( driver , "css applied " , Direction . down ) ;
167
+ await scrollToElement ( driver , "TimePickerField " , Direction . down ) ;
220
168
const bindingLabel = await driver . findElementByText ( "binding" , SearchOptions . exact ) ;
221
169
expect ( bindingLabel ) . to . exist ;
222
170
let selector = driver . isAndroid ? "android.widget.EditText" : "XCUIElementTypeTextField"
223
171
let fields = await driver . findElementsByClassName ( selector ) ;
224
- let timeField ;
225
172
let dateField ;
226
173
if ( driver . isAndroid ) {
227
- timeField = fields [ 2 ] ;
228
- dateField = fields [ 1 ] ;
174
+ dateField = fields [ 3 ] ;
229
175
}
230
176
else {
231
- let index = fields . length - 3 ;
177
+ let index = fields . length ;
232
178
console . log ( "index: " + index ) ;
233
- timeField = fields [ index ] ;
234
179
dateField = fields [ index - 1 ] ;
235
180
}
236
181
await dateField . click ( ) ;
@@ -243,13 +188,84 @@ describe("DateTimePicker", () => {
243
188
let bindingDate = await driver . findElementByText ( dateLabel , SearchOptions . contains ) ;
244
189
} ) ;
245
190
246
- it ( "Should scroll to css styled DatePicker and verify picker style" , async ( ) => {
247
- await scrollToElement ( driver , "tap to select time" , Direction . down ) ;
248
- let cssPickers = await driver . findElementsByText ( "Feb 24, 2019" , SearchOptions . exact ) ;
249
- await cssPickers [ cssPickers . length - 1 ] . click ( ) ;
250
- await getPickerDate ( driver ) ;
251
- await driver . compareScreen ( "cssDatePicker" ) ;
191
+ it ( "Should expand time picker field examples" , async ( ) => {
192
+ const timeFieldTitle = await driver . findElementByText ( "TimePickerField" , SearchOptions . contains ) ;
193
+ expect ( timeFieldTitle ) . to . exist ;
194
+ await timeFieldTitle . click ( ) ;
195
+ } ) ;
196
+
197
+ it ( "Should select time and verify value of picker field" , async ( ) => {
198
+ const selectTimeField = await driver . findElementByText ( "select time" , SearchOptions . contains ) ;
199
+ await selectTimeField . click ( ) ;
200
+ const timeString = await getPickerTime ( driver , 12 ) ;
252
201
await clickOkBtn ( driver ) ;
202
+ const timeSelected = await driver . findElementByText ( timeString , SearchOptions . contains ) ;
203
+ expect ( timeSelected ) . to . exist ;
204
+ } ) ;
205
+
206
+ it ( "Should open 12h time format and verify wheelers values" , async ( ) => {
207
+ const twelveHourFormat = await driver . findElementByText ( "4:00 PM" , SearchOptions . contains ) ;
208
+ await twelveHourFormat . click ( ) ;
209
+ const timeString = await getPickerTime ( driver , 12 ) ;
210
+ await clickOkBtn ( driver ) ;
211
+ expect ( timeString ) . to . equal ( "4:00 PM" ) ;
212
+ } ) ;
213
+
214
+ it ( "Should open 24h format and verify wheeler value" , async ( ) => {
215
+ const twentyFourFormat = await scrollToElement ( driver , "16:00" , Direction . down ) ;
216
+ await twentyFourFormat . click ( ) ;
217
+ const timeString = await getPickerTime ( driver , 24 ) ;
218
+ await clickOkBtn ( driver ) ;
219
+ expect ( timeString ) . to . equal ( "16:00" ) ;
220
+ } ) ;
221
+
222
+ it ( "Should verify modified texts field for time picker" , async ( ) => {
223
+ await scrollToElement ( driver , "tap to choose" , Direction . down ) ;
224
+ const datePicker = await driver . findElementByText ( "tap to choose" ) ;
225
+ await datePicker . click ( ) ;
226
+ const time = await getPickerTime ( driver , 12 ) ;
227
+ const approveBtn = await driver . findElementByText ( "Approve" , SearchOptions . contains ) ;
228
+ const rejectBtn = await driver . findElementByText ( "Reject" , SearchOptions . contains ) ;
229
+ const title = await driver . findElementByText ( "Confirm predefined time selection" , SearchOptions . contains ) ;
230
+ expect ( approveBtn ) . to . exist ;
231
+ expect ( rejectBtn ) . to . exist ;
232
+ expect ( title ) . to . exist ;
233
+ await approveBtn . click ( ) ;
234
+ const dateString = await driver . findElementByText ( time ) ;
235
+ expect ( dateString ) . to . exist ;
236
+ } ) ;
237
+
238
+ it ( "Should select time from de_DE locale picker and verify format" , async ( ) => {
239
+ await scrollToElement ( driver , "zeit wählen" , Direction . down ) ;
240
+ const timePicker = await driver . findElementByText ( "zeit wählen" , SearchOptions . contains ) ;
241
+ await timePicker . click ( ) ;
242
+ const time = await getPickerTime ( driver , 24 ) ;
243
+ let acceptBtn ;
244
+ let rejectBtn ;
245
+ if ( driver . isAndroid ) {
246
+ let buttons = await driver . findElementsByClassName ( "android.widget.Button" ) ;
247
+ acceptBtn = buttons [ 5 ] ;
248
+ rejectBtn = buttons [ 4 ] ;
249
+ }
250
+ else {
251
+ acceptBtn = await driver . findElementByText ( "Bestätigen" , SearchOptions . exact ) ;
252
+ rejectBtn = await driver . findElementByText ( "Stornieren" , SearchOptions . exact ) ;
253
+ }
254
+ const title = await driver . findElementByText ( "Zeit wählen" , SearchOptions . exact ) ;
255
+ expect ( acceptBtn ) . to . exist ;
256
+ expect ( rejectBtn ) . to . exist ;
257
+ expect ( title ) . to . exist ;
258
+ await acceptBtn . click ( ) ;
259
+ const dateField = await driver . findElementByText ( time ) ;
260
+ expect ( time ) . to . exist ;
261
+ } ) ;
262
+
263
+ it ( "Should scroll to custom format and verify values" , async ( ) => {
264
+ await scrollToElement ( driver , "binding" , Direction . down ) ;
265
+ const customFromatLabel = await driver . findElementByText ( "custom format" ) ;
266
+ expect ( customFromatLabel ) . to . exist ;
267
+ const customFormatTime = await driver . findElementByText ( "time: 01:00" , SearchOptions . exact ) ;
268
+ expect ( customFormatTime ) . to . exist ;
253
269
} ) ;
254
270
255
271
it ( "Should scroll to css styled TimePicker and verify picker style" , async ( ) => {
@@ -260,7 +276,15 @@ describe("DateTimePicker", () => {
260
276
await clickOkBtn ( driver ) ;
261
277
} ) ;
262
278
279
+ it ( "Should expand custom buttons examples" , async ( ) => {
280
+ await scrollToElement ( driver , "Custom Buttons" , Direction . down ) ;
281
+ const customButtonsTitle = await driver . findElementByText ( "Custom Buttons" , SearchOptions . contains ) ;
282
+ expect ( customButtonsTitle ) . to . exist ;
283
+ await customButtonsTitle . click ( ) ;
284
+ } ) ;
285
+
263
286
it ( "Should tap button to select date and verify button text" , async ( ) => {
287
+ await scrollToElement ( driver , "tap to select date and time" , Direction . down ) ;
264
288
let dateButton = await driver . findElementByText ( "tap to select date" , SearchOptions . contains ) ;
265
289
await dateButton . click ( ) ;
266
290
const date = await getPickerDate ( driver ) ;
0 commit comments