test(ivy): run more router tests in CI (#27325)

PR Close #27325
This commit is contained in:
Marc Laval 2018-11-28 15:10:03 +01:00 committed by Igor Minar
parent 01fd0cd878
commit a566e52ca4
3 changed files with 560 additions and 595 deletions

View File

@ -323,7 +323,6 @@ describe('Integration', () => {
beforeEach(() => TestBed.configureTestingModule({imports: [TestModule]}));
fixmeIvy('FW-???: assertion failures') &&
it('should work',
fakeAsync(inject([Router, Location], (router: Router, location: Location) => {
const fixture = createRoot(router, RootCmp);
@ -429,7 +428,6 @@ describe('Integration', () => {
expect(fixture.nativeElement).toHaveText('it works!');
}));
fixmeIvy('FW-???: assertion failures') &&
it('should not error when no url left and no children are matching',
fakeAsync(inject([Router, Location], (router: Router, location: Location) => {
const fixture = createRoot(router, RootCmp);
@ -453,7 +451,6 @@ describe('Integration', () => {
expect(fixture.nativeElement).toHaveText('team 33 [ , right: ]');
})));
fixmeIvy('FW-???: Error: Timeout') &&
it('should work when an outlet is in an ngIf',
fakeAsync(inject([Router, Location], (router: Router, location: Location) => {
const fixture = createRoot(router, RootCmp);
@ -470,7 +467,7 @@ describe('Integration', () => {
expect(location.path()).toEqual('/child/simple');
})));
fixmeIvy('FW-???: Error: 1 timer(s) still in the queue.') &&
fixmeIvy('unknown') && // Error: 1 timer(s) still in the queue
it('should work when an outlet is added/removed', fakeAsync(() => {
@Component({
selector: 'someRoot',
@ -534,7 +531,7 @@ describe('Integration', () => {
expect(location.path()).toEqual('/record/33');
}));
fixmeIvy('FW-???: Error: ExpressionChangedAfterItHasBeenCheckedError') &&
fixmeIvy('FW-726: Pipe instructions do not support WrappedValue') &&
it('should skip location update when using NavigationExtras.skipLocationChange with navigateByUrl',
fakeAsync(inject([Router, Location], (router: Router, location: Location) => {
const fixture = TestBed.createComponent(RootCmp);
@ -556,7 +553,7 @@ describe('Integration', () => {
expect(fixture.nativeElement).toHaveText('team 33 [ , right: ]');
})));
fixmeIvy('FW-???: Error: ExpressionChangedAfterItHasBeenCheckedError') &&
fixmeIvy('FW-726: Pipe instructions do not support WrappedValue') &&
it('should skip location update when using NavigationExtras.skipLocationChange with navigate',
fakeAsync(inject([Router, Location], (router: Router, location: Location) => {
const fixture = TestBed.createComponent(RootCmp);
@ -578,7 +575,7 @@ describe('Integration', () => {
expect(fixture.nativeElement).toHaveText('team 33 [ , right: ]');
})));
fixmeIvy('FW-???: Error: ExpressionChangedAfterItHasBeenCheckedError') &&
fixmeIvy('FW-726: Pipe instructions do not support WrappedValue') &&
it('should eagerly update the URL with urlUpdateStrategy="eagar"',
fakeAsync(inject([Router, Location], (router: Router, location: Location) => {
const fixture = TestBed.createComponent(RootCmp);
@ -639,7 +636,7 @@ describe('Integration', () => {
expect(fixture.nativeElement).toHaveText('team 33 [ , right: ]');
})));
fixmeIvy('FW-???: Error: ExpressionChangedAfterItHasBeenCheckedError') &&
fixmeIvy('FW-726: Pipe instructions do not support WrappedValue') &&
it('should navigate back and forward',
fakeAsync(inject([Router, Location], (router: Router, location: Location) => {
const fixture = createRoot(router, RootCmp);
@ -682,7 +679,6 @@ describe('Integration', () => {
expect(event !.restoredState !.navigationId).toEqual(userVictorNavStart.id);
})));
fixmeIvy('FW-???: assertion failures') &&
it('should navigate to the same url when config changes',
fakeAsync(inject([Router, Location], (router: Router, location: Location) => {
const fixture = createRoot(router, RootCmp);
@ -702,7 +698,7 @@ describe('Integration', () => {
expect(fixture.nativeElement).toHaveText('route');
})));
fixmeIvy('FW-???: assertion failures') &&
fixmeIvy('FW-726: Pipe instructions do not support WrappedValue') &&
it('should navigate when locations changes',
fakeAsync(inject([Router, Location], (router: Router, location: Location) => {
const fixture = createRoot(router, RootCmp);
@ -791,7 +787,6 @@ describe('Integration', () => {
})));
});
fixmeIvy('FW-???: assertion failures') &&
it('should support secondary routes', fakeAsync(inject([Router], (router: Router) => {
const fixture = createRoot(router, RootCmp);
@ -810,7 +805,6 @@ describe('Integration', () => {
expect(fixture.nativeElement).toHaveText('team 22 [ user victor, right: simple ]');
})));
fixmeIvy('FW-???: assertion failures') &&
it('should support secondary routes in separate commands',
fakeAsync(inject([Router], (router: Router) => {
const fixture = createRoot(router, RootCmp);
@ -832,7 +826,6 @@ describe('Integration', () => {
expect(fixture.nativeElement).toHaveText('team 22 [ user victor, right: simple ]');
})));
fixmeIvy('FW-???: assertion failures') &&
it('should deactivate outlets', fakeAsync(inject([Router], (router: Router) => {
const fixture = createRoot(router, RootCmp);
@ -854,7 +847,6 @@ describe('Integration', () => {
expect(fixture.nativeElement).toHaveText('team 22 [ user victor, right: ]');
})));
fixmeIvy('FW-???: assertion failures') &&
it('should deactivate nested outlets', fakeAsync(inject([Router], (router: Router) => {
const fixture = createRoot(router, RootCmp);
@ -879,7 +871,7 @@ describe('Integration', () => {
expect(fixture.nativeElement).toHaveText('');
})));
fixmeIvy('FW-???: Error: ExpressionChangedAfterItHasBeenCheckedError') &&
fixmeIvy('FW-726: Pipe instructions do not support WrappedValue') &&
it('should set query params and fragment', fakeAsync(inject([Router], (router: Router) => {
const fixture = createRoot(router, RootCmp);
@ -917,7 +909,7 @@ describe('Integration', () => {
])).toThrowError(`The requested path contains undefined segment at index 0`);
})));
fixmeIvy('FW-???: Error: ExpressionChangedAfterItHasBeenCheckedError') &&
fixmeIvy('FW-726: Pipe instructions do not support WrappedValue') &&
it('should push params only when they change',
fakeAsync(inject([Router], (router: Router) => {
const fixture = createRoot(router, RootCmp);
@ -947,7 +939,6 @@ describe('Integration', () => {
expect(user.snapshotParams).toEqual([{name: 'victor'}, {name: 'fedor'}]);
})));
fixmeIvy('FW-???: assertion failures') &&
it('should work when navigating to /', fakeAsync(inject([Router], (router: Router) => {
const fixture = createRoot(router, RootCmp);
@ -967,7 +958,7 @@ describe('Integration', () => {
expect(fixture.nativeElement).toHaveText('simple');
})));
fixmeIvy('FW-???: Error: ExpressionChangedAfterItHasBeenCheckedError') &&
fixmeIvy('FW-726: Pipe instructions do not support WrappedValue') &&
it('should cancel in-flight navigations', fakeAsync(inject([Router], (router: Router) => {
const fixture = createRoot(router, RootCmp);
@ -1231,7 +1222,7 @@ describe('Integration', () => {
})));
fixmeIvy('FW-???: Error: ExpressionChangedAfterItHasBeenCheckedError') &&
fixmeIvy('FW-726: Pipe instructions do not support WrappedValue') &&
it('should replace state when path is equal to current path',
fakeAsync(inject([Router, Location], (router: Router, location: Location) => {
const fixture = createRoot(router, RootCmp);
@ -1258,7 +1249,7 @@ describe('Integration', () => {
expect(location.path()).toEqual('/team/33/simple');
})));
fixmeIvy('FW-???: assertion failures') &&
fixmeIvy('FW-726: Pipe instructions do not support WrappedValue') &&
it('should handle componentless paths',
fakeAsync(inject([Router, Location], (router: Router, location: Location) => {
const fixture = createRoot(router, RootCmpWithTwoOutlets);
@ -1300,7 +1291,6 @@ describe('Integration', () => {
expect(fixture.nativeElement).toHaveText('primary [simple] right [user victor]');
})));
fixmeIvy('FW-???: assertion failures') &&
it('should not deactivate aux routes when navigating from a componentless routes',
fakeAsync(inject([Router, Location], (router: Router, location: Location) => {
const fixture = createRoot(router, TwoOutletsCmp);
@ -1322,7 +1312,6 @@ describe('Integration', () => {
expect(fixture.nativeElement).toHaveText('[ simple, aux: user victor ]');
})));
fixmeIvy('FW-???: assertion failures') &&
it('should emit an event when an outlet gets activated', fakeAsync(() => {
@Component({
selector: 'container',
@ -1578,7 +1567,7 @@ describe('Integration', () => {
});
describe('router links', () => {
fixmeIvy('FW-???: Error: ExpressionChangedAfterItHasBeenCheckedError') &&
fixmeIvy('FW-726: Pipe instructions do not support WrappedValue') &&
it('should support skipping location update for anchor router links',
fakeAsync(inject([Router, Location], (router: Router, location: Location) => {
const fixture = TestBed.createComponent(RootCmp);
@ -1610,7 +1599,7 @@ describe('Integration', () => {
expect(location.path()).toEqual('/team/22');
})));
fixmeIvy('FW-???: assertion failures') &&
fixmeIvy('FW-726: Pipe instructions do not support WrappedValue') &&
it('should support string router links', fakeAsync(inject([Router], (router: Router) => {
const fixture = createRoot(router, RootCmp);
@ -1752,7 +1741,7 @@ describe('Integration', () => {
expect(native.getAttribute('href')).toEqual('/home?a=123&q=456');
}));
fixmeIvy('FW-???: assertion failures') &&
fixmeIvy('FW-726: Pipe instructions do not support WrappedValue') &&
it('should support using links on non-a tags',
fakeAsync(inject([Router], (router: Router) => {
const fixture = createRoot(router, RootCmp);
@ -1778,7 +1767,7 @@ describe('Integration', () => {
expect(fixture.nativeElement).toHaveText('team 33 [ simple, right: ]');
})));
fixmeIvy('FW-???: assertion failures') &&
fixmeIvy('FW-726: Pipe instructions do not support WrappedValue') &&
it('should support absolute router links', fakeAsync(inject([Router], (router: Router) => {
const fixture = createRoot(router, RootCmp);
@ -1803,7 +1792,6 @@ describe('Integration', () => {
expect(fixture.nativeElement).toHaveText('team 33 [ simple, right: ]');
})));
fixmeIvy('FW-???: assertion failures') &&
it('should support relative router links', fakeAsync(inject([Router], (router: Router) => {
const fixture = createRoot(router, RootCmp);
@ -1811,8 +1799,7 @@ describe('Integration', () => {
path: 'team/:id',
component: TeamCmp,
children: [
{path: 'link', component: RelativeLinkCmp},
{path: 'simple', component: SimpleCmp}
{path: 'link', component: RelativeLinkCmp}, {path: 'simple', component: SimpleCmp}
]
}]);
@ -1853,7 +1840,6 @@ describe('Integration', () => {
expect(fixture.nativeElement).toHaveText('linksimple');
})));
fixmeIvy('FW-???: assertion failures') &&
it('should support query params and fragments',
fakeAsync(inject([Router, Location], (router: Router, location: Location) => {
const fixture = createRoot(router, RootCmp);
@ -2189,9 +2175,7 @@ describe('Integration', () => {
}]
}));
fixmeIvy('FW-???: assertion failures') &&
it('works',
fakeAsync(inject([Router, Location], (router: Router, location: Location) => {
it('works', fakeAsync(inject([Router, Location], (router: Router, location: Location) => {
router.resetConfig([
{
path: '',
@ -2217,9 +2201,7 @@ describe('Integration', () => {
}]
}));
fixmeIvy('FW-???: assertion failures') &&
it('works',
fakeAsync(inject([Router, Location], (router: Router, location: Location) => {
it('works', fakeAsync(inject([Router, Location], (router: Router, location: Location) => {
const recordedEvents: any[] = [];
let cancelEvent: NavigationCancel = null !;
router.events.forEach((e: any) => {
@ -2574,7 +2556,7 @@ describe('Integration', () => {
});
describe('should not deactivate a route when CanDeactivate returns false', () => {
fixmeIvy('FW-???: Error: ExpressionChangedAfterItHasBeenCheckedError') &&
fixmeIvy('FW-726: Pipe instructions do not support WrappedValue') &&
it('works',
fakeAsync(inject([Router, Location], (router: Router, location: Location) => {
const fixture = createRoot(router, RootCmp);
@ -2600,7 +2582,7 @@ describe('Integration', () => {
expect(canceledStatus).toEqual(false);
})));
fixmeIvy('unknown') &&
fixmeIvy('unknown') && // Error: assertion error
it('works with componentless routes',
fakeAsync(inject([Router, Location], (router: Router, location: Location) => {
const fixture = createRoot(router, RootCmp);
@ -2669,7 +2651,7 @@ describe('Integration', () => {
expect(location.path()).toEqual('/two-outlets/(a)');
})));
fixmeIvy('FW-???: Error: ExpressionChangedAfterItHasBeenCheckedError') &&
fixmeIvy('FW-726: Pipe instructions do not support WrappedValue') &&
it('works with a nested route',
fakeAsync(inject([Router, Location], (router: Router, location: Location) => {
const fixture = createRoot(router, RootCmp);
@ -2811,7 +2793,7 @@ describe('Integration', () => {
});
});
fixmeIvy('FW-???: Error: ExpressionChangedAfterItHasBeenCheckedError') &&
fixmeIvy('FW-726: Pipe instructions do not support WrappedValue') &&
it('should pass next state as the 4 argument when guard is a class',
fakeAsync(inject([Router, Location], (router: Router, location: Location) => {
const fixture = createRoot(router, RootCmp);
@ -2829,7 +2811,7 @@ describe('Integration', () => {
expect(log).toEqual(['/team/22', '/team/33']);
})));
fixmeIvy('FW-???: Error: ExpressionChangedAfterItHasBeenCheckedError') &&
fixmeIvy('FW-726: Pipe instructions do not support WrappedValue') &&
it('should pass next state as the 4 argument when guard is a function',
fakeAsync(inject([Router, Location], (router: Router, location: Location) => {
const fixture = createRoot(router, RootCmp);
@ -2862,7 +2844,7 @@ describe('Integration', () => {
beforeEach(() => { TestBed.configureTestingModule({providers: [AlwaysTrue]}); });
fixmeIvy('FW-???: Error: ExpressionChangedAfterItHasBeenCheckedError') &&
fixmeIvy('FW-726: Pipe instructions do not support WrappedValue') &&
it('works',
fakeAsync(inject([Router, Location], (router: Router, location: Location) => {
const fixture = createRoot(router, RootCmp);
@ -2942,7 +2924,6 @@ describe('Integration', () => {
})));
});
fixmeIvy('unknown') &&
it('should find the guard provided in lazy loaded module',
fakeAsync(inject(
[Router, Location, NgModuleFactoryLoader],
@ -3224,7 +3205,7 @@ describe('Integration', () => {
});
});
fixmeIvy('FW-???: Error: ExpressionChangedAfterItHasBeenCheckedError') &&
fixmeIvy('FW-726: Pipe instructions do not support WrappedValue') &&
it('should call guards in the right order',
fakeAsync(inject(
[Router, Location, Logger],
@ -3255,7 +3236,7 @@ describe('Integration', () => {
]);
})));
fixmeIvy('FW-???: Error: ExpressionChangedAfterItHasBeenCheckedError') &&
fixmeIvy('FW-726: Pipe instructions do not support WrappedValue') &&
it('should call deactivate guards from bottom to top',
fakeAsync(inject(
[Router, Location, Logger],
@ -3505,7 +3486,6 @@ describe('Integration', () => {
});
describe('lazy loading', () => {
fixmeIvy('unknown') &&
it('works',
fakeAsync(inject(
[Router, Location, NgModuleFactoryLoader],
@ -3546,7 +3526,7 @@ describe('Integration', () => {
expect(fixture.nativeElement).toHaveText('lazy-loaded-parent [lazy-loaded-child]');
})));
fixmeIvy('timeout') &&
fixmeIvy('unknown') && // Error: timeout
it('should have 2 injector trees: module and element',
fakeAsync(inject(
[Router, Location, NgModuleFactoryLoader],
@ -3636,7 +3616,6 @@ describe('Integration', () => {
})));
// https://github.com/angular/angular/issues/12889
fixmeIvy('unknown') &&
it('should create a single instance of lazy-loaded modules',
fakeAsync(inject(
[Router, Location, NgModuleFactoryLoader],
@ -3675,7 +3654,7 @@ describe('Integration', () => {
})));
// https://github.com/angular/angular/issues/13870
fixmeIvy('timeout') &&
fixmeIvy('unknown') && // Error: timeout
it('should create a single instance of guards for lazy-loaded modules',
fakeAsync(inject(
[Router, Location, NgModuleFactoryLoader],
@ -3849,11 +3828,9 @@ describe('Integration', () => {
expect(location.path()).toEqual('/lazy2/loaded');
})));
fixmeIvy('unknown') &&
it('should allow lazy loaded module in named outlet',
fakeAsync(inject(
[Router, NgModuleFactoryLoader],
(router: Router, loader: SpyNgModuleFactoryLoader) => {
[Router, NgModuleFactoryLoader], (router: Router, loader: SpyNgModuleFactoryLoader) => {
@Component({selector: 'lazy', template: 'lazy-loaded'})
class LazyComponent {
@ -3888,15 +3865,12 @@ describe('Integration', () => {
router.navigateByUrl('/team/22/(user/john//right:lazy)');
advance(fixture);
expect(fixture.nativeElement)
.toHaveText('team 22 [ user john, right: lazy-loaded ]');
expect(fixture.nativeElement).toHaveText('team 22 [ user john, right: lazy-loaded ]');
})));
fixmeIvy('unknown') &&
it('should allow componentless named outlet to render children',
fakeAsync(inject(
[Router, NgModuleFactoryLoader],
(router: Router, loader: SpyNgModuleFactoryLoader) => {
[Router, NgModuleFactoryLoader], (router: Router, loader: SpyNgModuleFactoryLoader) => {
const fixture = createRoot(router, RootCmp);
@ -3905,11 +3879,7 @@ describe('Integration', () => {
component: TeamCmp,
children: [
{path: 'user/:name', component: UserCmp},
{
path: 'simple',
outlet: 'right',
children: [{path: '', component: SimpleCmp}]
},
{path: 'simple', outlet: 'right', children: [{path: '', component: SimpleCmp}]},
]
}]);
@ -3984,7 +3954,7 @@ describe('Integration', () => {
});
});
fixmeIvy('timeout') &&
fixmeIvy('unknown') && // Error: timeout
it('should use the injector of the lazily-loaded configuration',
fakeAsync(inject(
[Router, Location, NgModuleFactoryLoader],
@ -4205,7 +4175,6 @@ describe('Integration', () => {
{providers: [{provide: UrlHandlingStrategy, useClass: CustomUrlHandlingStrategy}]});
});
fixmeIvy('unknown') &&
it('should work',
fakeAsync(inject([Router, Location], (router: Router, location: Location) => {
const fixture = createRoot(router, RootCmp);
@ -4214,8 +4183,7 @@ describe('Integration', () => {
path: 'include',
component: TeamCmp,
children: [
{path: 'user/:name', component: UserCmp},
{path: 'simple', component: SimpleCmp}
{path: 'user/:name', component: UserCmp}, {path: 'simple', component: SimpleCmp}
]
}]);
@ -4410,7 +4378,6 @@ describe('Integration', () => {
}
}
fixmeIvy('FW-???: assertion failures') &&
it('should support attaching & detaching fragments',
fakeAsync(inject([Router, Location], (router: Router, location: Location) => {
const fixture = createRoot(router, RootCmp);
@ -4453,7 +4420,6 @@ describe('Integration', () => {
expect(teamCmp.route.firstChild.snapshot.params).toEqual({p: '2'});
})));
fixmeIvy('FW-???: assertion failures') &&
it('should support shorter lifecycles',
fakeAsync(inject([Router, Location], (router: Router, location: Location) => {
const fixture = createRoot(router, RootCmp);
@ -4473,7 +4439,7 @@ describe('Integration', () => {
expect(simpleCmp1).not.toBe(simpleCmp2);
})));
fixmeIvy('FW-???: Error: Cannot match any routes. URL Segment: \'a\'') &&
fixmeIvy('unknown') && // Error: 1 timer(s) still in the queue
it('should not mount the component of the previously reused route when the outlet was not instantiated at the time of route activation',
fakeAsync(() => {
@Component({

View File

@ -9,7 +9,6 @@
import {CommonModule} from '@angular/common';
import {Component, ContentChild, NgModule, TemplateRef, Type, ViewChild, ViewContainerRef} from '@angular/core';
import {ComponentFixture, TestBed, fakeAsync, tick} from '@angular/core/testing';
import {fixmeIvy} from '@angular/private/testing';
import {Router} from '@angular/router';
import {RouterTestingModule} from '@angular/router/testing';

View File

@ -61,7 +61,7 @@ describe('RouterPreloader', () => {
});
fixmeIvy('unknown') &&
fixmeIvy('unknown') && // Error: NgModuleRef._parent is undefined
it('should work',
fakeAsync(inject(
[NgModuleFactoryLoader, RouterPreloader, Router, NgModuleRef],
@ -129,7 +129,7 @@ describe('RouterPreloader', () => {
});
});
fixmeIvy('FW-???: Cannot read property \'declarations\' of undefined') &&
fixmeIvy('unknown') && // Error: NgModuleRef._parent is undefined
it('should work',
fakeAsync(inject(
[NgModuleFactoryLoader, RouterPreloader, Router, NgModuleRef, Compiler],