fix(build): Use Angular's testability API to wait for end of e2e tests
Closes #3911
This commit is contained in:
@ -63,6 +63,10 @@ class PublicTestability implements _JsObjectProxyable {
|
||||
this._testability = testability;
|
||||
}
|
||||
|
||||
bool isStable() {
|
||||
return this._testability.isStable();
|
||||
}
|
||||
|
||||
whenStable(Function callback) {
|
||||
return this._testability.whenStable(callback);
|
||||
}
|
||||
@ -75,7 +79,8 @@ class PublicTestability implements _JsObjectProxyable {
|
||||
return _jsify({
|
||||
'findBindings': (bindingString, [exactMatch, allowNonElementNodes]) =>
|
||||
findBindings(bindingString, exactMatch, allowNonElementNodes),
|
||||
'whenStable': (callback) => whenStable(() => callback.apply([])),
|
||||
'isStable': () => isStable(),
|
||||
'whenStable': (callback) => whenStable(() => callback.apply([]))
|
||||
})..['_dart_'] = this;
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,8 @@ class PublicTestability {
|
||||
|
||||
constructor(testability: Testability) { this._testability = testability; }
|
||||
|
||||
isStable(): boolean { return this._testability.isStable(); }
|
||||
|
||||
whenStable(callback: Function) { this._testability.whenStable(callback); }
|
||||
|
||||
findBindings(using: any, binding: string, exactMatch: boolean): any[] {
|
||||
|
@ -42,8 +42,10 @@ export class Testability {
|
||||
return this._pendingCount;
|
||||
}
|
||||
|
||||
isStable(): boolean { return this._pendingCount == 0 && !this._isAngularEventPending; }
|
||||
|
||||
_runCallbacksIfReady(): void {
|
||||
if (this._pendingCount != 0 || this._isAngularEventPending) {
|
||||
if (!this.isStable()) {
|
||||
return; // Not ready
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,9 @@ export function runBenchmark(config) {
|
||||
});
|
||||
}
|
||||
var url = encodeURI(config.url + '?' + urlParams.join('&'));
|
||||
return browser.get(url).then(function() {
|
||||
var getter = config.waitForAngular2 !== false ? browser.get(url) :
|
||||
browser.driver.get(browser.baseUrl + url);
|
||||
return getter.then(function() {
|
||||
return global['benchpressRunner'].sample({
|
||||
id: config.id,
|
||||
execute: config.work,
|
||||
|
Reference in New Issue
Block a user