}
checkExist(hostname: string, exist: boolean) {
- this.getTableCell(this.columnIndex.hostname, hostname).should(($elements) => {
- const hosts = $elements.map((_, el) => el.textContent).get();
- if (exist) {
- expect(hosts).to.include(hostname);
- } else {
- expect(hosts).to.not.include(hostname);
- }
- });
+ this.getTableCell(this.columnIndex.hostname, hostname, true)
+ .parent()
+ .find(`datatable-body-cell:nth-child(${this.columnIndex.hostname}) span`)
+ .should(($elements) => {
+ const hosts = $elements.toArray().map((v) => v.innerText);
+ if (exist) {
+ expect(hosts).to.include(hostname);
+ } else {
+ expect(hosts).to.not.include(hostname);
+ }
+ });
}
remove(hostname: string) {
// Add or remove labels on a host, then verify labels in the table
editLabels(hostname: string, labels: string[], add: boolean) {
- this.getTableCell(this.columnIndex.hostname, hostname).click();
+ this.getTableCell(this.columnIndex.hostname, hostname, true).click();
this.clickActionButton('edit');
// add or remove label badges
checkLabelExists(hostname: string, labels: string[], add: boolean) {
// Verify labels are added or removed from Labels column
// First find row with hostname, then find labels in the row
- this.getTableCell(this.columnIndex.hostname, hostname)
+ this.getTableCell(this.columnIndex.hostname, hostname, true)
.click()
.parent()
.find(`datatable-body-cell:nth-child(${this.columnIndex.labels}) .badge`)
maintenance(hostname: string, exit = false, force = false) {
this.clearTableSearchInput();
if (force) {
- this.getTableCell(this.columnIndex.hostname, hostname).click();
+ this.getTableCell(this.columnIndex.hostname, hostname, true).click();
this.clickActionButton('enter-maintenance');
cy.get('cd-modal').within(() => {
cy.contains('button', 'Continue').click();
});
- this.getTableCell(this.columnIndex.hostname, hostname)
+ this.getTableCell(this.columnIndex.hostname, hostname, true)
.parent()
.find(`datatable-body-cell:nth-child(${this.columnIndex.status}) .badge`)
.should(($ele) => {
});
}
if (exit) {
- this.getTableCell(this.columnIndex.hostname, hostname)
+ this.getTableCell(this.columnIndex.hostname, hostname, true)
.click()
.parent()
.find(`datatable-body-cell:nth-child(${this.columnIndex.status})`)
}
});
- this.getTableCell(this.columnIndex.hostname, hostname)
+ this.getTableCell(this.columnIndex.hostname, hostname, true)
.parent()
.find(`datatable-body-cell:nth-child(${this.columnIndex.status})`)
.should(($ele) => {
expect(status).to.not.include('maintenance');
});
} else {
- this.getTableCell(this.columnIndex.hostname, hostname).click();
+ this.getTableCell(this.columnIndex.hostname, hostname, true).click();
this.clickActionButton('enter-maintenance');
- this.getTableCell(this.columnIndex.hostname, hostname)
+ this.getTableCell(this.columnIndex.hostname, hostname, true)
.parent()
.find(`datatable-body-cell:nth-child(${this.columnIndex.status}) .badge`)
.should(($ele) => {
@PageHelper.restrictTo(pages.index.url)
drain(hostname: string) {
- this.getTableCell(this.columnIndex.hostname, hostname).click();
+ this.getTableCell(this.columnIndex.hostname, hostname, true).click();
this.clickActionButton('start-drain');
this.checkLabelExists(hostname, ['_no_schedule'], true);
}
checkServiceInstancesExist(hostname: string, instances: string[]) {
- this.getTableCell(this.columnIndex.hostname, hostname)
+ this.getTableCell(this.columnIndex.hostname, hostname, true)
.parent()
.find(`datatable-body-cell:nth-child(${this.columnIndex.services}) .badge`)
.should(($ele) => {