@@ -118,10 +118,8 @@ Future testButton(Future<Null> ensureBodyContains(String text),
118
118
Future testMaxCharInput (WebDriver driver) async {
119
119
print ("Testing input." );
120
120
121
- Stream <WebElement > inputs =
122
- await driver.findElements (const By .tagName ("input" ));
123
121
WebElement maxCharInput;
124
- await for (var input in inputs ) {
122
+ await for (var input in driver. findElements ( const By . tagName ( "input" )) ) {
125
123
if (await input.attributes["aria-label" ] == "Max 5 chars" ) {
126
124
maxCharInput = input;
127
125
break ;
@@ -174,18 +172,20 @@ Future testDialog(
174
172
175
173
var dialogText = "Lorem ipsum dolor sit amet" ;
176
174
177
- var buttons = await driver.findElements (const By .tagName ("material-button" ));
175
+ var buttons =
176
+ await driver.findElements (const By .tagName ("material-button" )).toList ();
178
177
179
178
await ensureBodyDoesNotContain (dialogText);
180
- for (var button in await buttons. toList () ) {
179
+ for (var button in buttons) {
181
180
if ((await button.text) == "OPEN BASIC" ) {
182
181
await button.click ();
183
182
break ;
184
183
}
185
184
}
186
185
await ensureBodyContains (dialogText);
187
- buttons = await driver.findElements (const By .tagName ("material-button" ));
188
- for (var button in await buttons.toList ()) {
186
+ buttons =
187
+ await driver.findElements (const By .tagName ("material-button" )).toList ();
188
+ for (var button in buttons) {
189
189
if ((await button.text) == "CLOSE" ) {
190
190
await button.click ();
191
191
break ;
@@ -202,10 +202,11 @@ Future testPopup(
202
202
203
203
var popupText = "Hello, I am a pop up!" ;
204
204
205
- var buttons = await driver.findElements (const By .tagName ("material-button" ));
205
+ var buttons =
206
+ await driver.findElements (const By .tagName ("material-button" )).toList ();
206
207
207
208
await ensureBodyDoesNotContain (popupText);
208
- for (var button in await buttons. toList () ) {
209
+ for (var button in buttons) {
209
210
if ((await button.text) == "OPEN POPUP" ) {
210
211
await button.click ();
211
212
break ;
@@ -235,10 +236,11 @@ Future testTooltip(
235
236
236
237
var tooltipText = "Saves the document" ;
237
238
238
- var buttons = await driver.findElements (const By .tagName ("material-button" ));
239
+ var buttons =
240
+ await driver.findElements (const By .tagName ("material-button" )).toList ();
239
241
240
242
await ensureBodyDoesNotContain (tooltipText);
241
- for (var button in await buttons. toList () ) {
243
+ for (var button in buttons) {
242
244
if ((await button.text) == "SAVE" ) {
243
245
await driver.mouse.moveTo (element: button);
244
246
break ;
@@ -272,9 +274,10 @@ Future testList(
272
274
await driver.findElements (const By .className ("colorchanger" )).first;
273
275
await ensureElementColor (colorText, colorInitial);
274
276
275
- var listItems =
276
- await driver.findElements (const By .tagName ("material-list-item" ));
277
- for (var listItem in await listItems.toList ()) {
277
+ var listItems = await driver
278
+ .findElements (const By .tagName ("material-list-item" ))
279
+ .toList ();
280
+ for (var listItem in listItems) {
278
281
if ((await listItem.text).contains ("Green" )) {
279
282
await listItem.click ();
280
283
break ;
@@ -292,14 +295,18 @@ Future testSelect(
292
295
var expectedSelection = "Selected Protocol: HTTPS" ;
293
296
await ensureBodyDoesNotContain (expectedSelection);
294
297
295
- var selectOptions =
296
- await driver.findElements (const By .tagName ("material-select-item" ));
297
- for (var selectOption in await selectOptions.toList ()) {
298
+ var selectOptions = await driver
299
+ .findElements (const By .tagName ("material-select-item" ))
300
+ .toList ();
301
+ for (var selectOption in selectOptions) {
298
302
if ((await selectOption.text).contains ("HTTPS" )) {
299
303
await selectOption.click ();
300
304
break ;
301
305
}
302
306
}
307
+
308
+ await new Future .delayed (const Duration (milliseconds: 500 ));
309
+
303
310
await ensureBodyContains (expectedSelection);
304
311
}
305
312
@@ -312,18 +319,20 @@ Future testTree(
312
319
var expectedSelection = "Selected Value: Lady and the Tramp" ;
313
320
await ensureBodyDoesNotContain (expectedSelection);
314
321
315
- var treeItems =
316
- await driver.findElements (const By .className ("material-tree-item" ));
317
- for (var treeItem in await treeItems.toList ()) {
322
+ var treeItems = await driver
323
+ .findElements (const By .className ("material-tree-item" ))
324
+ .toList ();
325
+ for (var treeItem in treeItems) {
318
326
if ((await treeItem.text).contains ("Animated Feature Films" )) {
319
327
await treeItem.click ();
320
328
break ;
321
329
}
322
330
}
323
331
324
- treeItems =
325
- await driver.findElements (const By .className ("material-tree-item" ));
326
- for (var treeItem in await treeItems.toList ()) {
332
+ treeItems = await driver
333
+ .findElements (const By .className ("material-tree-item" ))
334
+ .toList ();
335
+ for (var treeItem in treeItems) {
327
336
if ((await treeItem.text).contains ("Lady and the Tramp" )) {
328
337
await treeItem.click ();
329
338
break ;
0 commit comments