checkStatus(id: number, status: string[]) {
this.searchTable(id.toString());
cy.wait(5 * 1000);
- cy.get(`[cdstabledata]:nth-child(${this.columnIndex.status}) cds-tag`).should(($ele) => {
- const allStatus = $ele.toArray().map((v) => v.innerText);
- for (const s of status) {
- expect(allStatus).to.include(s);
+ cy.get(`[cdstablerow] [cdstabledata]:nth-child(${this.columnIndex.status}) cds-tag`).should(
+ ($ele) => {
+ const allStatus = $ele.toArray().map((v) => v.innerText);
+ for (const s of status) {
+ expect(allStatus).to.include(s);
+ }
}
- });
+ );
}
@PageHelper.restrictTo(pages.index.url)
Then('I should see a message {string}', () => {
cy.get('cd-create-cluster').should('contain.text', 'Welcome to Ceph Dashboard');
+ cy.contains('Welcome to Ceph Dashboard').should('be.visible');
});
Then('I should see a row with {string}', (row: string) => {
cy.get('.cds--search-input').first().clear().type(row);
- cy.contains(`[cdstablerow] [cdstabledata]`, row).should('exist');
+ cy.contains(`[cdstablerow]`, row).should('exist');
});
Then('I should not see a row with {string}', (row: string) => {
cy.get('.cds--search-input').first().clear().type(row);
- cy.contains(`[cdstablerow] [cdstabledata]`, row).should('not.exist');
+ cy.contains(`[cdstablerow]`, row).should('not.exist');
});
Then('I should see a table in the expanded row', () => {
});
it('should check if title contains Create Services', () => {
- cy.get('.title').should('contain.text', 'Create Services');
+ cy.get('.tearsheet-body .tearsheet-content h4').should('contain.text', 'Create Services');
});
describe('when Orchestrator is available', () => {
});
it('should check if title contains Create OSDs', () => {
- cy.get('.title').should('contain.text', 'Create OSDs');
+ cy.get('.tearsheet-body .tearsheet-content h4').should('contain.text', 'Create OSDs');
});
describe('when Orchestrator is available', () => {
describe('fields check', () => {
it('should check cluster resources table is present', () => {
// check for table header 'Cluster Resources'
- onboarding.getLegends().its(0).should('have.text', 'Cluster Resources');
+ onboarding.getLegends().its(0).should('contain.text', 'Cluster Resources');
// check for fields in table
onboarding.getStatusTables().should('contain.text', 'Hosts');
component.editing = true;
});
- it('should check whether edit field is correctly loaded', () => {
- const paginate_obs = new PaginateObservable<any>(of({}));
+ it('should check whether edit field is correctly loaded', (done) => {
+ const mockService = {
+ service_type: 'mds',
+ service_id: 'test',
+ unmanaged: false,
+ placement: {}
+ };
+ const paginate_obs = new PaginateObservable<any>(of([mockService]));
const cephServiceSpy = spyOn(cephServiceService, 'list').and.returnValue(paginate_obs);
component.ngOnInit();
expect(cephServiceSpy).toBeCalledTimes(2);
expect(component.action).toBe('Edit');
- const serviceType = fixture.componentInstance.serviceForm.get('service_type');
- const serviceId = fixture.componentInstance.serviceForm.get('service_id');
- expect(serviceType.disabled).toBeTruthy();
- expect(serviceId.disabled).toBeTruthy();
+
+ // Wait for async observable to complete before checking disabled state
+ setTimeout(() => {
+ const serviceType = fixture.componentInstance.serviceForm.get('service_type');
+ const serviceId = fixture.componentInstance.serviceForm.get('service_id');
+ expect(serviceType.disabled).toBeTruthy();
+ expect(serviceId.disabled).toBeTruthy();
+ done();
+ }, 0);
});
- it('should not edit groups for nvmeof service', () => {
+ it('should not edit groups for nvmeof service', (done) => {
+ const mockService = {
+ service_type: 'nvmeof',
+ service_id: 'default',
+ unmanaged: false,
+ placement: {},
+ spec: {
+ group: 'default'
+ }
+ };
+ const paginate_obs = new PaginateObservable<any>(of([mockService]));
+ spyOn(cephServiceService, 'list').and.returnValue(paginate_obs);
+
component.serviceType = 'nvmeof';
formHelper.setValue('service_type', 'nvmeof');
component.ngOnInit();
- fixture.detectChanges();
- const groupId = fixture.debugElement.query(By.css('#group')).nativeElement;
- expect(groupId.disabled).toBeTruthy();
+
+ // Wait for async observable to complete before checking disabled state
+ setTimeout(() => {
+ fixture.detectChanges();
+ const groupId = fixture.debugElement.query(By.css('#group')).nativeElement;
+ expect(groupId.disabled).toBeTruthy();
+ done();
+ }, 0);
});
it('should update nvmeof service to disable mTLS', () => {
if (this.editing) {
this.action = this.actionLabels.EDIT;
- this.disableForEditing(this.serviceType);
this.cephServiceService
.list(new HttpParams({ fromObject: { limit: -1, offset: 0 } }), this.serviceName)
.observable.subscribe((response: CephServiceSpec[]) => {
formKeys.forEach((keys) => {
this.serviceForm.get(keys).setValue(response[0][keys]);
});
+ // change is made because on editing mds service, a new service was created with mds.mds.service
+ // For non-prefixed services (mgr, mon, etc.), if service_id is empty,
+ // set it to the full service name
+ if (!response[0]['service_id'] && !this.isPrefixedNamedService) {
+ this.serviceForm.get('service_id').setValue(this.serviceName);
+ }
+
+ // Disable fields AFTER setting values to ensure the view updates properly
+ this.disableForEditing(this.serviceType);
if (response[0].certificate) {
this.currentCertificate = response[0].certificate;
}
}
break;
default:
- this.serviceForm.get('service_id').setValue(this.serviceName);
+ // No special handling needed for other service types (mds, nfs, etc.)
+ // service_id is already correctly set from API response at line 749
+ break;
}
});
}