OLD | NEW |
1 library webdriver_test; | 1 library webdriver_test; |
| 2 import 'dart:async' show getAttachedStackTrace; |
2 import 'package:webdriver/webdriver.dart'; | 3 import 'package:webdriver/webdriver.dart'; |
3 import 'package:unittest/unittest.dart'; | 4 import 'package:unittest/unittest.dart'; |
4 import 'package:unittest/vm_config.dart'; | 5 import 'package:unittest/vm_config.dart'; |
5 | 6 |
6 WebDriver web_driver; | 7 WebDriver web_driver; |
7 | 8 |
8 /** | 9 /** |
9 * These tests are not expected to be run as part of normal automated testing, | 10 * These tests are not expected to be run as part of normal automated testing, |
10 * as they are slow and they have external dependencies. | 11 * as they are slow and they have external dependencies. |
11 */ | 12 */ |
12 main() { | 13 main() { |
13 useVMConfiguration(); | 14 useVMConfiguration(); |
14 | 15 |
15 var web_driver = new WebDriver('localhost', 4444, '/wd/hub'); | 16 var web_driver = new WebDriver('localhost', 4444, '/wd/hub'); |
16 var session = null; | 17 var session = null; |
17 | 18 |
18 var exceptionHandler = (e) { | 19 var exceptionHandler = (error) { |
19 if (e.error is TestFailure) { | 20 var trace = getAttachedStackTrace(error); |
20 currentTestCase.fail(e.error.message, e.stackTrace.toString()); | 21 String traceString = trace == null ? "" : trace.toString(); |
| 22 if (error is TestFailure) { |
| 23 currentTestCase.fail(error.message, traceString); |
21 } else { | 24 } else { |
22 currentTestCase.error("Unexpected error: ${e.error}", | 25 currentTestCase.error("Unexpected error: ${error}", traceString); |
23 e.stackTrace.toString()); | |
24 } | 26 } |
25 if (session != null) { | 27 if (session != null) { |
26 var s = session; | 28 var s = session; |
27 session = null; | 29 session = null; |
28 s.close(); | 30 s.close(); |
29 } | 31 } |
30 }; | 32 }; |
31 | 33 |
32 group('Sessionless tests', () { | 34 group('Sessionless tests', () { |
33 test('Get status', () { | 35 test('Get status', () { |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 web_driver = null; | 457 web_driver = null; |
456 if (session != null) { | 458 if (session != null) { |
457 var s = session; | 459 var s = session; |
458 session = null; | 460 session = null; |
459 s.close(); | 461 s.close(); |
460 } | 462 } |
461 }); | 463 }); |
462 }); | 464 }); |
463 } | 465 } |
464 | 466 |
OLD | NEW |