fix(benchpress): Fix promise chain in chrome_driver_extension. (#23458)

Occasionally the promise to clear the chrome buffer resolves after the subsequent call to start the
timer. This problem causes flakiness in our tests that rely on benchpress, usually manifesting
itself as a "Tried too often to get the ending mark: 21" error thrown by this line:

https://github.com/angular/angular/blob/master/packages/benchpress/src/metric/perflog_metric.ts#L162

PR Close #23458
This commit is contained in:
Omar Griffin 2018-04-19 14:26:48 -07:00 committed by Alex Rickabaugh
parent 66b2d78305
commit d4b6c41a5f
1 changed files with 2 additions and 2 deletions

View File

@ -51,12 +51,12 @@ export class ChromeDriverExtension extends WebDriverExtension {
gc() { return this._driver.executeScript('window.gc()'); }
timeBegin(name: string): Promise<any> {
async timeBegin(name: string): Promise<any> {
if (this._firstRun) {
this._firstRun = false;
// Before the first run, read out the existing performance logs
// so that the chrome buffer does not fill up.
this._driver.logs('performance');
await this._driver.logs('performance');
}
return this._driver.executeScript(`console.time('${name}');`);
}