From 557d309377683fd5c37f05178054bb08e8ac1e97 Mon Sep 17 00:00:00 2001 From: Marc Laval Date: Wed, 26 Aug 2015 16:45:03 +0200 Subject: [PATCH] chore(build): improve reliability of the saucelabs job Closes #3848 --- .../angular2/test/core/zone/ng_zone_spec.ts | 28 ++++++------- .../router/integration/lifecycle_hook_spec.ts | 26 ++++++------- .../integration/router_integration_spec.ts | 39 ++++++++++--------- .../router/integration/router_link_spec.ts | 4 +- modules/angular2/test/router/location_spec.ts | 2 +- .../web_workers/shared/message_bus_spec.ts | 2 +- 6 files changed, 51 insertions(+), 50 deletions(-) diff --git a/modules/angular2/test/core/zone/ng_zone_spec.ts b/modules/angular2/test/core/zone/ng_zone_spec.ts index e8df5c541f..250bfba080 100644 --- a/modules/angular2/test/core/zone/ng_zone_spec.ts +++ b/modules/angular2/test/core/zone/ng_zone_spec.ts @@ -208,8 +208,8 @@ function commonTests() { macroTask(() => { expect(_log.result()).toEqual('run; onTurnDone; onEventDone'); async.done(); - }, 80); - })); + }, 150); + }), 200); it('should run async tasks scheduled inside onEventDone outside Angular zone', inject([AsyncTestCompleter], (async) => { @@ -230,7 +230,7 @@ function commonTests() { TimerWrapper.setTimeout(() => { expect(_log.result()).toEqual('run; onTurnDone; onEventDone; asyncTask'); async.done(); - }, 10); + }, 20); }); })); @@ -402,8 +402,8 @@ function commonTests() { // Second VM Turn => microtask enqueued from onTurnDone 'onTurnStart; executedMicrotask; onTurnDone(begin); onTurnDone(end)'); async.done(); - }, 80); - })); + }, 150); + }), 200); it('should call onTurnStart and onTurnDone for a scheduleMicrotask in onTurnDone triggered by ' + 'a scheduleMicrotask in run', @@ -437,8 +437,8 @@ function commonTests() { // Second VM Turn => the microtask enqueued from onTurnDone 'onTurnStart; onTurnDone(executeMicrotask); onTurnDone(begin); onTurnDone(end)'); async.done(); - }, 80); - })); + }, 150); + }), 200); it('should execute promises scheduled in onTurnStart before promises scheduled in run', inject([AsyncTestCompleter], (async) => { @@ -492,8 +492,8 @@ function commonTests() { // Second VM turn: execute the microtask from onTurnEnd 'onTurnStart(begin); onTurnStart(end); onTurnDone(executePromise); onTurnDone(begin); onTurnDone(end)'); async.done(); - }, 80); - })); + }, 150); + }), 200); it('should call onTurnStart and onTurnDone before and after each turn, respectively', inject([AsyncTestCompleter], (async) => { @@ -513,7 +513,7 @@ function commonTests() { macroTask(() => { _zone.run(() => { completerA.resolve(null); }); }, 20); - macroTask(() => { _zone.run(() => { completerB.resolve(null); }); }, 100); + macroTask(() => { _zone.run(() => { completerB.resolve(null); }); }, 120); macroTask(() => { expect(_log.result()) @@ -545,8 +545,8 @@ function commonTests() { expect(_log.result()) .toEqual('onTurnStart; run start; run end; async1; async2; onTurnDone'); async.done(); - }, 80); - })); + }, 150); + }), 200); it('should call onTurnStart and onTurnDone for promises created outside of run body', inject([AsyncTestCompleter], (async) => { @@ -567,8 +567,8 @@ function commonTests() { expect(_log.result()) .toEqual('onTurnStart; zone run; onTurnDone; onTurnStart; promise then; onTurnDone'); async.done(); - }, 80); - })); + }, 150); + }), 200); }); describe('exceptions', () => { diff --git a/modules/angular2/test/router/integration/lifecycle_hook_spec.ts b/modules/angular2/test/router/integration/lifecycle_hook_spec.ts index dc50e00f82..311de3b928 100644 --- a/modules/angular2/test/router/integration/lifecycle_hook_spec.ts +++ b/modules/angular2/test/router/integration/lifecycle_hook_spec.ts @@ -100,7 +100,7 @@ export function main() { expect(log).toEqual(['activate: null -> /on-activate']); async.done(); }); - })); + }), 2000); it('should wait for a parent component\'s onActivate hook to resolve before calling its child\'s', inject([AsyncTestCompleter], (async) => { @@ -123,7 +123,7 @@ export function main() { async.done(); }); }); - })); + }), 2000); it('should call the onDeactivate hook', inject([AsyncTestCompleter], (async) => { compile() @@ -136,7 +136,7 @@ export function main() { expect(log).toEqual(['deactivate: /on-deactivate -> /a']); async.done(); }); - })); + }), 2000); it('should wait for a child component\'s onDeactivate hook to resolve before calling its parent\'s', inject([AsyncTestCompleter], (async) => { @@ -161,7 +161,7 @@ export function main() { async.done(); }); }); - })); + }), 2000); it('should reuse a component when the canReuse hook returns true', inject([AsyncTestCompleter], (async) => { @@ -182,7 +182,7 @@ export function main() { expect(cmpInstanceCount).toBe(1); async.done(); }); - })); + }), 2000); it('should not reuse a component when the canReuse hook returns false', @@ -204,7 +204,7 @@ export function main() { expect(cmpInstanceCount).toBe(2); async.done(); }); - })); + }), 2000); it('should navigate when canActivate returns true', inject([AsyncTestCompleter], (async) => { @@ -224,7 +224,7 @@ export function main() { async.done(); }); }); - })); + }), 2000); it('should not navigate when canActivate returns false', inject([AsyncTestCompleter], (async) => { @@ -244,7 +244,7 @@ export function main() { async.done(); }); }); - })); + }), 2000); it('should navigate away when canDeactivate returns true', inject([AsyncTestCompleter], (async) => { @@ -269,7 +269,7 @@ export function main() { async.done(); }); }); - })); + }), 2000); it('should not navigate away when canDeactivate returns false', inject([AsyncTestCompleter], (async) => { @@ -294,7 +294,7 @@ export function main() { async.done(); }); }); - })); + }), 2000); it('should run activation and deactivation hooks in the correct order', @@ -322,7 +322,7 @@ export function main() { ]); async.done(); }); - })); + }), 2000); it('should only run reuse hooks when reusing', inject([AsyncTestCompleter], (async) => { compile() @@ -349,7 +349,7 @@ export function main() { ]); async.done(); }); - })); + }), 2000); it('should not run reuse hooks when not reusing', inject([AsyncTestCompleter], (async) => { compile() @@ -378,7 +378,7 @@ export function main() { ]); async.done(); }); - })); + }), 2000); }); } diff --git a/modules/angular2/test/router/integration/router_integration_spec.ts b/modules/angular2/test/router/integration/router_integration_spec.ts index f4c8b7dcba..ff66ddb718 100644 --- a/modules/angular2/test/router/integration/router_integration_spec.ts +++ b/modules/angular2/test/router/integration/router_integration_spec.ts @@ -62,7 +62,7 @@ export function main() { async.done(); }); }); - })); + }), 1000); }); describe('broken app', () => { @@ -78,7 +78,7 @@ export function main() { async.done(); }); }); - })); + }), 1000); }); describe('back button app', () => { @@ -148,26 +148,27 @@ export function main() { }); router.navigate('/parent/child'); }); - })); + }), 1000); describe('custom app base ref', () => { beforeEachBindings(() => { return [bind(APP_BASE_HREF).toValue('/my/app')]; }); - it('should bootstrap', inject([AsyncTestCompleter, TestComponentBuilder], - (async, tcb: TestComponentBuilder) => { + it('should bootstrap', + inject([AsyncTestCompleter, TestComponentBuilder], + (async, tcb: TestComponentBuilder) => { - tcb.createAsync(HierarchyAppCmp) - .then((rootTC) => { - var router = rootTC.componentInstance.router; - router.subscribe((_) => { - expect(rootTC.nativeElement) - .toHaveText('root { parent { hello } }'); - expect(rootTC.componentInstance.location.path()) - .toEqual('/my/app/parent/child'); - async.done(); - }); - router.navigate('/parent/child'); - }); - })); + tcb.createAsync(HierarchyAppCmp) + .then((rootTC) => { + var router = rootTC.componentInstance.router; + router.subscribe((_) => { + expect(rootTC.nativeElement).toHaveText('root { parent { hello } }'); + expect(rootTC.componentInstance.location.path()) + .toEqual('/my/app/parent/child'); + async.done(); + }); + router.navigate('/parent/child'); + }); + }), + 1000); }); }); // TODO: add a test in which the child component has bindings @@ -192,7 +193,7 @@ export function main() { router.navigate('/qs?q=search-for-something'); rootTC.detectChanges(); }); - })); + }), 1000); }); }); } diff --git a/modules/angular2/test/router/integration/router_link_spec.ts b/modules/angular2/test/router/integration/router_link_spec.ts index e16200cf83..dbbe117612 100644 --- a/modules/angular2/test/router/integration/router_link_spec.ts +++ b/modules/angular2/test/router/integration/router_link_spec.ts @@ -179,7 +179,7 @@ export function main() { async.done(); }); }); - })); + }), 1000); it('should navigate to link hrefs in presence of base href', inject([AsyncTestCompleter], (async) => { @@ -200,7 +200,7 @@ export function main() { async.done(); }); }); - })); + }), 1000); }); }); } diff --git a/modules/angular2/test/router/location_spec.ts b/modules/angular2/test/router/location_spec.ts index 51e8048edc..51f91d1733 100644 --- a/modules/angular2/test/router/location_spec.ts +++ b/modules/angular2/test/router/location_spec.ts @@ -63,7 +63,7 @@ export function main() { expect(ev['url']).toEqual('/user/btford'); async.done(); }) - }), 1000); + }), 2000); it('should normalize location path', () => { locationStrategy.internalPath = '/my/app/user/btford'; diff --git a/modules/angular2/test/web_workers/shared/message_bus_spec.ts b/modules/angular2/test/web_workers/shared/message_bus_spec.ts index 916b197d88..efcb1ff219 100644 --- a/modules/angular2/test/web_workers/shared/message_bus_spec.ts +++ b/modules/angular2/test/web_workers/shared/message_bus_spec.ts @@ -35,7 +35,7 @@ export function main() { }); var toEmitter = bus.to(CHANNEL); ObservableWrapper.callNext(toEmitter, MESSAGE); - })); + }), 1000); it("should broadcast", inject([AsyncTestCompleter], (async) => { const CHANNEL = "CHANNEL 1";