Use different way to parse tables for consuers

This commit is contained in:
Marcial Rosales 2025-05-27 10:47:51 +02:00
parent 8960d19492
commit 870c66734b
2 changed files with 19 additions and 1 deletions

View File

@ -186,6 +186,24 @@ module.exports = class BasePage {
return table_model
}
async getTable(tableLocator, firstNColumns, rowClass) {
const table = await this.waitForDisplayed(tableLocator)
const rows = await table.findElements(rowClass == undefined ?
By.css('tbody tr') : By.css('tbody tr.' + rowClass))
let table_model = []
for (let row of rows) {
let columns = await row.findElements(By.css('td'))
let table_row = []
for (let column of columns) {
if (firstNColumns == undefined || table_row.length < firstNColumns) {
table_row.push(await column.getText())
}
}
table_model.push(table_row)
}
return table_model
}
async getPlainTable(tableLocator, firstNColumns) {
const table = await this.waitForDisplayed(tableLocator)
let tbody = await table.findElement(By.css('tbody'))
let rows = await tbody.findElements(By.xpath("./child::*"))

View File

@ -35,7 +35,7 @@ module.exports = class QueuePage extends BasePage {
return this.click(CONSUMERS_SECTION)
}
async getConsumersTable() {
return this.getTable(CONSUMERS_TABLE)
return this.getPlainTable(CONSUMERS_TABLE)
}
async ensureDeleteQueueSectionIsVisible() {
await this.click(DELETE_SECTION)