mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-23 17:17:46 +01:00
fix_skipped_tests
Signed-off-by: Yogi_Wang <yawang@vmware.com>
This commit is contained in:
parent
4ee5ebe442
commit
60aecf2a1a
@ -177,7 +177,7 @@ describe('RecentLogComponent (inline template)', () => {
|
||||
});
|
||||
}));
|
||||
|
||||
xit('should support refreshing', async(() => {
|
||||
it('should support refreshing', async(() => {
|
||||
fixture.detectChanges();
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
|
@ -23,7 +23,7 @@ import { PUSH_IMAGE_BUTTON_DIRECTIVES } from '../push-image/index';
|
||||
import { INLINE_ALERT_DIRECTIVES } from '../inline-alert/index';
|
||||
import { LabelPieceComponent } from "../label-piece/label-piece.component";
|
||||
import { OperationService } from "../operation/operation.service";
|
||||
import {ProjectDefaultService, ProjectService, RetagDefaultService, RetagService} from "../service";
|
||||
import { ProjectDefaultService, ProjectService, RetagDefaultService, RetagService } from "../service";
|
||||
import { UserPermissionService, UserPermissionDefaultService } from "../service/permission.service";
|
||||
import { USERSTATICPERMISSION } from "../service/permission-static";
|
||||
import { of } from "rxjs";
|
||||
@ -70,11 +70,26 @@ describe('RepositoryComponentGridview (inline template)', () => {
|
||||
"tags_count": 1
|
||||
}
|
||||
];
|
||||
let mockRepoNginxData: RepositoryItem[] = [
|
||||
{
|
||||
"id": 2,
|
||||
"name": "library/nginx",
|
||||
"project_id": 1,
|
||||
"description": "asdf",
|
||||
"pull_count": 0,
|
||||
"star_count": 0,
|
||||
"tags_count": 1
|
||||
}
|
||||
];
|
||||
|
||||
let mockRepo: Repository = {
|
||||
metadata: {xTotalCount: 2},
|
||||
metadata: { xTotalCount: 2 },
|
||||
data: mockRepoData
|
||||
};
|
||||
let mockNginxRepo: Repository = {
|
||||
metadata: { xTotalCount: 2 },
|
||||
data: mockRepoNginxData
|
||||
};
|
||||
let mockHasCreateRepositoryPermission: boolean = true;
|
||||
let mockHasDeleteRepositoryPermission: boolean = true;
|
||||
// let mockTagData: Tag[] = [
|
||||
@ -130,37 +145,52 @@ describe('RepositoryComponentGridview (inline template)', () => {
|
||||
});
|
||||
}));
|
||||
|
||||
beforeEach(async() => {
|
||||
beforeEach(async () => {
|
||||
fixtureRepo = TestBed.createComponent(RepositoryGridviewComponent);
|
||||
compRepo = fixtureRepo.componentInstance;
|
||||
compRepo.projectId = 1;
|
||||
compRepo.mode = '';
|
||||
compRepo.hasProjectAdminRole = true;
|
||||
|
||||
repositoryService = fixtureRepo.debugElement.injector.get(RepositoryService);
|
||||
systemInfoService = fixtureRepo.debugElement.injector.get(SystemInfoService);
|
||||
|
||||
spyRepos = spyOn(repositoryService, 'getRepositories').and.returnValues(Promise.resolve(mockRepo));
|
||||
spySystemInfo = spyOn(systemInfoService, 'getSystemInfo').and.returnValues(Promise.resolve(mockSystemInfo));
|
||||
|
||||
|
||||
spyRepos = spyOn(repositoryService, 'getRepositories')
|
||||
.and.callFake(function (projectId: number, name: string) {
|
||||
if (name === 'nginx') {
|
||||
return Promise.resolve(mockNginxRepo);
|
||||
}
|
||||
return Promise.resolve(mockRepo);
|
||||
});
|
||||
userPermissionService = fixtureRepo.debugElement.injector.get(UserPermissionService);
|
||||
spyOn(userPermissionService, "getPermission")
|
||||
.withArgs(compRepo.projectId,
|
||||
USERSTATICPERMISSION.REPOSITORY.KEY, USERSTATICPERMISSION.REPOSITORY.VALUE.CREATE )
|
||||
.and.returnValue(of(mockHasCreateRepositoryPermission))
|
||||
.withArgs(compRepo.projectId, USERSTATICPERMISSION.REPOSITORY.KEY, USERSTATICPERMISSION.REPOSITORY.VALUE.DELETE )
|
||||
.and.returnValue(of(mockHasDeleteRepositoryPermission));
|
||||
.withArgs(compRepo.projectId,
|
||||
USERSTATICPERMISSION.REPOSITORY.KEY, USERSTATICPERMISSION.REPOSITORY.VALUE.CREATE)
|
||||
.and.returnValue(of(mockHasCreateRepositoryPermission))
|
||||
.withArgs(compRepo.projectId, USERSTATICPERMISSION.REPOSITORY.KEY, USERSTATICPERMISSION.REPOSITORY.VALUE.DELETE)
|
||||
.and.returnValue(of(mockHasDeleteRepositoryPermission));
|
||||
fixtureRepo.detectChanges();
|
||||
});
|
||||
it('should create', () => {
|
||||
expect(compRepo).toBeTruthy();
|
||||
let originalTimeout;
|
||||
|
||||
beforeEach(function () {
|
||||
originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
|
||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;
|
||||
});
|
||||
|
||||
// Will fail after upgrade to angular 6. todo: need to fix it.
|
||||
xit('should load and render data', async(() => {
|
||||
afterEach(function () {
|
||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
|
||||
});
|
||||
|
||||
it('should create', async(() => {
|
||||
expect(compRepo).toBeTruthy();
|
||||
}));
|
||||
|
||||
it('should load and render data', async(() => {
|
||||
fixtureRepo.whenStable().then(() => {
|
||||
fixtureRepo.detectChanges();
|
||||
let deRepo: DebugElement = fixtureRepo.debugElement.query(By.css('.datagrid-cell'));
|
||||
let deRepo: DebugElement = fixtureRepo.debugElement.query(del => del.classes['datagrid-cell']);
|
||||
expect(deRepo).toBeTruthy();
|
||||
let elRepo: HTMLElement = deRepo.nativeElement;
|
||||
expect(elRepo).toBeTruthy();
|
||||
@ -173,13 +203,17 @@ describe('RepositoryComponentGridview (inline template)', () => {
|
||||
fixtureRepo.detectChanges();
|
||||
|
||||
compRepo.doSearchRepoNames('nginx');
|
||||
fixtureRepo.detectChanges();
|
||||
let de: DebugElement[] = fixtureRepo.debugElement.queryAll(By.css('.datagrid-cell'));
|
||||
expect(de).toBeTruthy();
|
||||
expect(de.length).toEqual(1);
|
||||
let el: HTMLElement = de[0].nativeElement;
|
||||
expect(el).toBeTruthy();
|
||||
expect(el.textContent).toEqual('library/nginx');
|
||||
fixtureRepo.whenStable().then(() => {
|
||||
|
||||
fixtureRepo.detectChanges();
|
||||
let de: DebugElement[] = fixtureRepo.debugElement.queryAll(By.css('.datagrid-cell'));
|
||||
expect(de).toBeTruthy();
|
||||
expect(compRepo.repositories.length).toEqual(1);
|
||||
expect(de.length).toEqual(1);
|
||||
let el: HTMLElement = de[0].nativeElement;
|
||||
expect(el).toBeTruthy();
|
||||
expect(el.textContent).toEqual('library/nginx');
|
||||
});
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
@ -391,6 +391,9 @@ export class RepositoryGridviewComponent implements OnChanges, OnInit {
|
||||
}
|
||||
|
||||
clrLoad(state: State): void {
|
||||
if (!state || !state.page) {
|
||||
return;
|
||||
}
|
||||
this.selectedRow = [];
|
||||
// Keep it for future filtering and sorting
|
||||
this.currentState = state;
|
||||
@ -509,8 +512,8 @@ export class RepositoryGridviewComponent implements OnChanges, OnInit {
|
||||
let hasDeleteRepositoryPermission = this.userPermissionService.getPermission(this.projectId,
|
||||
USERSTATICPERMISSION.REPOSITORY.KEY, USERSTATICPERMISSION.REPOSITORY.VALUE.DELETE);
|
||||
forkJoin(hasCreateRepositoryPermission, hasDeleteRepositoryPermission).subscribe(permissions => {
|
||||
this.hasCreateRepositoryPermission = permissions[0] as boolean;
|
||||
this.hasDeleteRepositoryPermission = permissions[1] as boolean;
|
||||
this.hasCreateRepositoryPermission = permissions[0] as boolean;
|
||||
this.hasDeleteRepositoryPermission = permissions[1] as boolean;
|
||||
}, error => this.errorHandler.error(error));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ import { SharedModule } from '../shared/shared.module';
|
||||
import { ConfirmationDialogComponent } from '../confirmation-dialog/confirmation-dialog.component';
|
||||
import { ImageNameInputComponent } from "../image-name-input/image-name-input.component";
|
||||
import { RepositoryComponent } from './repository.component';
|
||||
import { RepositoryGridviewComponent } from '../repository-gridview/repository-gridview.component';
|
||||
import { GridViewComponent } from '../gridview/grid-view.component';
|
||||
import { FilterComponent } from '../filter/filter.component';
|
||||
import { TagComponent } from '../tag/tag.component';
|
||||
@ -166,7 +165,6 @@ describe('RepositoryComponent (inline template)', () => {
|
||||
declarations: [
|
||||
RepositoryComponent,
|
||||
GridViewComponent,
|
||||
RepositoryGridviewComponent,
|
||||
ConfirmationDialogComponent,
|
||||
ImageNameInputComponent,
|
||||
FilterComponent,
|
||||
@ -224,22 +222,30 @@ describe('RepositoryComponent (inline template)', () => {
|
||||
.and.returnValue(of(mockHasScanImagePermission));
|
||||
fixture.detectChanges();
|
||||
});
|
||||
let originalTimeout;
|
||||
|
||||
beforeEach(function () {
|
||||
originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
|
||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
|
||||
});
|
||||
it('should create', () => {
|
||||
expect(compRepo).toBeTruthy();
|
||||
});
|
||||
|
||||
// fail after upgrade to angular 6.
|
||||
xit('should load and render data', async(() => {
|
||||
it('should load and render data', async(() => {
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
let de: DebugElement = fixture.debugElement.query(By.css('datagrid-cell'));
|
||||
let de: DebugElement = fixture.debugElement.query(del => del.classes['datagrid-cell']);
|
||||
fixture.detectChanges();
|
||||
expect(de).toBeTruthy();
|
||||
let el: HTMLElement = de.nativeElement;
|
||||
expect(el).toBeTruthy();
|
||||
expect(el.textContent).toEqual('library/busybox');
|
||||
expect(el.textContent).toEqual('1.11.5');
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user