2015-02-20 20:44:23 -05:00
|
|
|
import 'dart:async';
|
|
|
|
import 'dart:io' show Platform;
|
2016-02-10 19:54:32 -05:00
|
|
|
import 'package:guinness2/guinness2.dart';
|
2015-02-20 20:44:23 -05:00
|
|
|
import 'package:benchpress/benchpress.dart';
|
2015-05-08 22:51:19 -04:00
|
|
|
import 'package:webdriver/webdriver.dart'
|
|
|
|
show WebDriver, Capabilities, LogType, LogLevel, By;
|
2015-02-20 20:44:23 -05:00
|
|
|
|
|
|
|
main() {
|
|
|
|
describe('benchpress', () {
|
|
|
|
WebDriver driver;
|
|
|
|
Runner runner;
|
|
|
|
|
|
|
|
beforeEach(() async {
|
|
|
|
driver = await createTestDriver();
|
2015-05-08 22:51:19 -04:00
|
|
|
await driver
|
2015-10-09 18:25:17 -04:00
|
|
|
.get('http://localhost:8002/playground/src/benchpress/index.html');
|
2015-02-20 20:44:23 -05:00
|
|
|
|
|
|
|
var bindings = [
|
2015-08-04 15:05:30 -04:00
|
|
|
bind(WebDriverAdapter)
|
|
|
|
.toFactory(() => new AsyncWebDriverAdapter(driver), [])
|
2015-02-20 20:44:23 -05:00
|
|
|
];
|
|
|
|
runner = new Runner(bindings);
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() async {
|
|
|
|
await driver.close();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should work', () {
|
2015-05-08 22:51:19 -04:00
|
|
|
return runner.sample(id: 'benchpress smoke test', execute: () async {
|
|
|
|
var button = await driver.findElement(const By.tagName('button'));
|
|
|
|
await button.click();
|
|
|
|
var logText = await (await driver.findElement(const By.id('log'))).text;
|
|
|
|
expect(logText, 'hi');
|
|
|
|
});
|
2015-02-20 20:44:23 -05:00
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
Future<WebDriver> createTestDriver() {
|
|
|
|
Map env = Platform.environment;
|
2015-08-04 15:05:30 -04:00
|
|
|
return WebDriver.createDriver(desiredCapabilities: {
|
2015-02-20 20:44:23 -05:00
|
|
|
'name': 'Dartium',
|
|
|
|
'browserName': 'chrome',
|
|
|
|
'chromeOptions': {
|
|
|
|
'binary': env['DARTIUM_BIN'],
|
|
|
|
'args': ['--js-flags=--expose-gc'],
|
|
|
|
'perfLoggingPrefs': {
|
2015-05-08 22:51:19 -04:00
|
|
|
'traceCategories':
|
|
|
|
'v8,blink.console,disabled-by-default-devtools.timeline'
|
2015-02-20 20:44:23 -05:00
|
|
|
},
|
|
|
|
},
|
2015-05-08 22:51:19 -04:00
|
|
|
'loggingPrefs': {'performance': 'ALL', 'browser': 'ALL',}
|
2015-02-20 20:44:23 -05:00
|
|
|
});
|
|
|
|
}
|