Skip to content

Commit ec243ba

Browse files
MarcialRosalesmergify[bot]
authored andcommitted
Test virtual hosts and select tags column
(cherry picked from commit 175abbf)
1 parent 4fd25e0 commit ec243ba

File tree

4 files changed

+19
-10
lines changed

4 files changed

+19
-10
lines changed

selenium/test/pageobjects/BasePage.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,9 @@ module.exports = class BasePage {
151151
let columns = await row.findElements(By.css('td'))
152152
let table_row = []
153153
for (let column of columns) {
154-
if (table_row.length < firstNColumns) table_row.push(await column.getText())
154+
if (firstNColumns == undefined || table_row.length < firstNColumns) {
155+
table_row.push(await column.getText())
156+
}
155157
}
156158
table_model.push(table_row)
157159
}
@@ -227,6 +229,7 @@ module.exports = class BasePage {
227229
return table_model
228230
}
229231
async selectTableColumnsById(arrayOfColumnsIds) {
232+
await this.clickOnSelectTableColumns()
230233
const table = await this.waitForDisplayed(TABLE_COLUMNS_POPUP)
231234
for (let id of arrayOfColumnsIds) {
232235
let checkbox = await table.findElement(By.css('tbody tr input#'+id))

selenium/test/pageobjects/VhostsAdminTab.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ module.exports = class VhostsAdminTab extends AdminTab {
1717
}
1818
async searchForVhosts(vhost, regex = false) {
1919
await this.sendKeys(FILTER_VHOST, vhost)
20-
await this.sendKeys(FILTER_VHOST, Key.RETURN)
20+
//await this.sendKeys(FILTER_VHOST, Key.RETURN)
2121
if (regex) {
2222
await this.click(CHECKBOX_REGEX)
2323
}
@@ -31,7 +31,7 @@ module.exports = class VhostsAdminTab extends AdminTab {
3131
const links = await vhost_rows.findElements(By.css("td a"))
3232
for (let link of links) {
3333
let text = await link.getText()
34-
if ( text === "/" ) return link.click()
34+
if ( text === vhost ) return link.click()
3535
}
3636
throw "Vhost " + vhost + " not found"
3737
}

selenium/test/utils.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,16 +135,16 @@ module.exports = {
135135
let ret
136136
do {
137137
try {
138-
console.log("Calling doCallback (attempts:" + attempts + ") ... ")
138+
//console.log("Calling doCallback (attempts:" + attempts + ") ... ")
139139
ret = await doCallback()
140-
console.log("Calling booleanCallback (attempts:" + attempts + ") with arg " + ret + " ... ")
140+
//console.log("Calling booleanCallback (attempts:" + attempts + ") with arg " + ret + " ... ")
141141
done = booleanCallback(ret)
142142
}catch(error) {
143143
console.log("Caught " + error + " on doWhile callback...")
144144

145145
}finally {
146146
if (!done) {
147-
console.log("Waiting until next attempt")
147+
//console.log("Waiting until next attempt")
148148
await module.exports.delay(delayMs)
149149
}
150150
}

selenium/test/vhosts/admin-vhosts.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,16 @@ describe('Virtual Hosts in Admin tab', function () {
4747
}
4848
assert.equal("/", await vhostTab.getName())
4949
})
50+
5051
it('vhost selectable columns', async function () {
5152
await overview.clickOnOverviewTab()
5253
await overview.clickOnAdminTab()
5354
await adminTab.clickOnVhosts()
55+
await vhostsTab.searchForVhosts("/")
5456
await doWhile(async function() { return vhostsTab.getVhostsTable() },
55-
function(table) { return table.length>1 })
57+
function(table) {
58+
return table.length>0
59+
})
5660

5761
await vhostsTab.clickOnSelectTableColumns()
5862
let table = await vhostsTab.getSelectableTableColumns()
@@ -107,16 +111,18 @@ describe('Virtual Hosts in Admin tab', function () {
107111
})
108112
it('vhost is listed with tag', async function () {
109113
log("Searching for vhost " + vhost)
110-
await doWhile(async function() { return vhostsTab.searchForVhosts(vhost) },
114+
await vhostsTab.searchForVhosts(vhost)
115+
await doWhile(async function() { return vhostsTab.getVhostsTable()},
111116
function(table) {
112-
return table.length==1 && table[1][0].localeCompare(vhost)
117+
log("table: "+ JSON.stringify(table) + " table[0][0]:" + table[0][0])
118+
return table.length==1 && table[0][0].localeCompare(vhost) == 0
113119
})
114120
log("Found vhost " + vhost)
115121
await vhostsTab.selectTableColumnsById(["checkbox-vhosts-tags"])
116122

117123
await doWhile(async function() { return vhostsTab.getVhostsTable() },
118124
function(table) {
119-
return table.length==1 && table[1][3].localeCompare("selenium-tag")
125+
return table.length==1 && table[0][3].localeCompare("selenium-tag") == 0
120126
})
121127

122128
})

0 commit comments

Comments
 (0)