1 | library benchpress.src.webdriver.async_webdriver_adapter_dart;
|
2 |
|
3 | import 'dart:async';
|
4 | import 'package:webdriver/webdriver.dart' show WebDriver, LogEntry;
|
5 | import '../web_driver_adapter.dart' show WebDriverAdapter;
|
6 |
|
7 | class AsyncWebDriverAdapter extends WebDriverAdapter {
|
8 | WebDriver _driver;
|
9 | AsyncWebDriverAdapter(this._driver);
|
10 |
|
11 | Future waitFor(Function callback) {
|
12 | return callback();
|
13 | }
|
14 |
|
15 | Future executeScript(String script) {
|
16 | return _driver.execute(script, const []);
|
17 | }
|
18 |
|
19 | Future executeAsyncScript(String script) {
|
20 | return _driver.executeAsync(script, const []);
|
21 | }
|
22 |
|
23 | Future<Map> capabilities() {
|
24 | return new Future.value(_driver.capabilities);
|
25 | }
|
26 |
|
27 | Future<List<Map>> logs(String type) {
|
28 | return _driver.logs
|
29 | .get(type)
|
30 | .map((LogEntry entry) => {'message': entry.message})
|
31 | .fold(<Map>[], (log, Map entry) {
|
32 | return log..add(entry);
|
33 | });
|
34 | }
|
35 | }
|