|
|
@ -13,33 +13,74 @@ export class CellPageObject extends BasePage { |
|
|
|
this.selectOption = new SelectOptionCellPageObject(this); |
|
|
|
this.selectOption = new SelectOptionCellPageObject(this); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
get({index, columnHeader}: {index: number, columnHeader: string}): Locator { |
|
|
|
get({ |
|
|
|
return this.grid.get().locator(`td[data-pw="cell-${columnHeader}-${index}"]`); |
|
|
|
index, |
|
|
|
|
|
|
|
columnHeader, |
|
|
|
|
|
|
|
}: { |
|
|
|
|
|
|
|
index: number; |
|
|
|
|
|
|
|
columnHeader: string; |
|
|
|
|
|
|
|
}): Locator { |
|
|
|
|
|
|
|
return this.grid |
|
|
|
|
|
|
|
.get() |
|
|
|
|
|
|
|
.locator(`td[data-pw="cell-${columnHeader}-${index}"]`); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async click({index, columnHeader}: {index: number, columnHeader: string}) { |
|
|
|
async click({ |
|
|
|
return this.get({index, columnHeader}).click(); |
|
|
|
index, |
|
|
|
|
|
|
|
columnHeader, |
|
|
|
|
|
|
|
}: { |
|
|
|
|
|
|
|
index: number; |
|
|
|
|
|
|
|
columnHeader: string; |
|
|
|
|
|
|
|
}) { |
|
|
|
|
|
|
|
return this.get({ index, columnHeader }).click(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async dblclick({index, columnHeader}: {index: number, columnHeader: string}) { |
|
|
|
async dblclick({ |
|
|
|
return this.get({index, columnHeader}).dblclick(); |
|
|
|
index, |
|
|
|
|
|
|
|
columnHeader, |
|
|
|
|
|
|
|
}: { |
|
|
|
|
|
|
|
index: number; |
|
|
|
|
|
|
|
columnHeader: string; |
|
|
|
|
|
|
|
}) { |
|
|
|
|
|
|
|
return this.get({ index, columnHeader }).dblclick(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async inCellExpand({index, columnHeader}: {index: number, columnHeader: string}) { |
|
|
|
async inCellExpand({ |
|
|
|
await this.get({index, columnHeader}).hover(); |
|
|
|
index, |
|
|
|
await this.get({index, columnHeader}).locator('.nc-action-icon >> nth=0').click(); |
|
|
|
columnHeader, |
|
|
|
|
|
|
|
}: { |
|
|
|
|
|
|
|
index: number; |
|
|
|
|
|
|
|
columnHeader: string; |
|
|
|
|
|
|
|
}) { |
|
|
|
|
|
|
|
await this.get({ index, columnHeader }).hover(); |
|
|
|
|
|
|
|
await this.get({ index, columnHeader }) |
|
|
|
|
|
|
|
.locator(".nc-action-icon >> nth=0") |
|
|
|
|
|
|
|
.click(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async verify({index, columnHeader, value}: {index: number, columnHeader: string, value: string | string[]}) { |
|
|
|
async verify({ |
|
|
|
|
|
|
|
index, |
|
|
|
|
|
|
|
columnHeader, |
|
|
|
|
|
|
|
value, |
|
|
|
|
|
|
|
}: { |
|
|
|
|
|
|
|
index: number; |
|
|
|
|
|
|
|
columnHeader: string; |
|
|
|
|
|
|
|
value: string | string[]; |
|
|
|
|
|
|
|
}) { |
|
|
|
const _verify = async (text) => { |
|
|
|
const _verify = async (text) => { |
|
|
|
await expect.poll(async () => { |
|
|
|
await expect |
|
|
|
const innerTexts = await this.get({index, columnHeader}).allInnerTexts() |
|
|
|
.poll(async () => { |
|
|
|
return typeof(innerTexts) === "string" ? [innerTexts]: innerTexts; |
|
|
|
const innerTexts = await this.get({ |
|
|
|
}).toContain(text); |
|
|
|
index, |
|
|
|
} |
|
|
|
columnHeader, |
|
|
|
|
|
|
|
}).allInnerTexts(); |
|
|
|
|
|
|
|
return typeof innerTexts === "string" ? [innerTexts] : innerTexts; |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.toContain(text); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
if(Array.isArray(value)) { |
|
|
|
if (Array.isArray(value)) { |
|
|
|
for(const text of value) { |
|
|
|
for (const text of value) { |
|
|
|
await _verify(text); |
|
|
|
await _verify(text); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -51,15 +92,27 @@ export class CellPageObject extends BasePage { |
|
|
|
// : virtual relational cell- HM, BT, MM
|
|
|
|
// : virtual relational cell- HM, BT, MM
|
|
|
|
// : verify link count & cell value
|
|
|
|
// : verify link count & cell value
|
|
|
|
//
|
|
|
|
//
|
|
|
|
async verifyVirtualCell({index, columnHeader, value}: {index: number, columnHeader: string, value: string[]}) { |
|
|
|
async verifyVirtualCell({ |
|
|
|
const count = value.length; |
|
|
|
index, |
|
|
|
const cell = this.get({index, columnHeader}); |
|
|
|
columnHeader, |
|
|
|
|
|
|
|
count, |
|
|
|
|
|
|
|
value, |
|
|
|
|
|
|
|
}: { |
|
|
|
|
|
|
|
index: number; |
|
|
|
|
|
|
|
columnHeader: string; |
|
|
|
|
|
|
|
count: number; |
|
|
|
|
|
|
|
value: string[]; |
|
|
|
|
|
|
|
}) { |
|
|
|
|
|
|
|
// const count = value.length;
|
|
|
|
|
|
|
|
const cell = this.get({ index, columnHeader }); |
|
|
|
const chips = cell.locator(".chips > .chip"); |
|
|
|
const chips = cell.locator(".chips > .chip"); |
|
|
|
const chipCount = await chips.count(); |
|
|
|
const chipCount = await chips.count(); |
|
|
|
|
|
|
|
|
|
|
|
// verify chip count & contents
|
|
|
|
// verify chip count & contents
|
|
|
|
expect(chipCount).toEqual(count); |
|
|
|
expect(chipCount).toEqual(count); |
|
|
|
for (let i = 0; i < chipCount; ++i) { |
|
|
|
|
|
|
|
|
|
|
|
// verify only the elements that are passed in
|
|
|
|
|
|
|
|
for (let i = 0; i < value.length; ++i) { |
|
|
|
expect(await chips.nth(i).textContent()).toBe(value[i]); |
|
|
|
expect(await chips.nth(i).textContent()).toBe(value[i]); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|