|
|
@ -32,7 +32,7 @@ export class GridPage extends BasePage { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async rowCount() { |
|
|
|
async rowCount() { |
|
|
|
await this.get().locator(".nc-grid-row").count(); |
|
|
|
return await this.get().locator(".nc-grid-row").count(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async verifyRowCount({ count }: { count: number }) { |
|
|
|
async verifyRowCount({ count }: { count: number }) { |
|
|
@ -41,9 +41,9 @@ export class GridPage extends BasePage { |
|
|
|
|
|
|
|
|
|
|
|
async addNewRow({ |
|
|
|
async addNewRow({ |
|
|
|
index = 0, |
|
|
|
index = 0, |
|
|
|
title = "Title", |
|
|
|
columnHeader = "Title", |
|
|
|
value, |
|
|
|
value, |
|
|
|
}: { index?: number; title?: string; value?: string } = {}) { |
|
|
|
}: { index?: number; columnHeader?: string; value?: string } = {}) { |
|
|
|
const rowCount = await this.get().locator(".nc-grid-row").count(); |
|
|
|
const rowCount = await this.get().locator(".nc-grid-row").count(); |
|
|
|
await this.get().locator(".nc-grid-add-new-cell").click(); |
|
|
|
await this.get().locator(".nc-grid-add-new-cell").click(); |
|
|
|
|
|
|
|
|
|
|
@ -51,22 +51,24 @@ export class GridPage extends BasePage { |
|
|
|
.poll(async () => await this.get().locator(".nc-grid-row").count()) |
|
|
|
.poll(async () => await this.get().locator(".nc-grid-row").count()) |
|
|
|
.toBe(rowCount + 1); |
|
|
|
.toBe(rowCount + 1); |
|
|
|
|
|
|
|
|
|
|
|
const cell = this.cell.get({ index, columnHeader: title }); |
|
|
|
const cell = this.cell.get({ index, columnHeader }); |
|
|
|
await this.cell.dblclick({ |
|
|
|
await this.cell.dblclick({ |
|
|
|
index, |
|
|
|
index, |
|
|
|
columnHeader: title, |
|
|
|
columnHeader, |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
if (value) { |
|
|
|
|
|
|
|
await cell.locator("input").fill(value); |
|
|
|
await cell.locator("input").fill(value ?? `Row ${index}`); |
|
|
|
} else { |
|
|
|
|
|
|
|
await cell.locator("input").fill(title ?? `Row ${index}`); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
await this.cell.grid |
|
|
|
await this.cell.grid |
|
|
|
.get() |
|
|
|
.get() |
|
|
|
.locator(`[data-title="${title}"]`) |
|
|
|
.locator(`[data-title="${columnHeader}"]`) |
|
|
|
.locator(`span[title="${title}"]`) |
|
|
|
.locator(`span[title="${columnHeader}"]`) |
|
|
|
.click(); |
|
|
|
.click(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await this.rootPage.waitForResponse(async (res) => { |
|
|
|
|
|
|
|
return (await res.json())[columnHeader] === value; |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async verifyRow({ index }: { index: number }) { |
|
|
|
async verifyRow({ index }: { index: number }) { |
|
|
@ -114,6 +116,7 @@ export class GridPage extends BasePage { |
|
|
|
async openExpandedRow({ index }: { index: number }) { |
|
|
|
async openExpandedRow({ index }: { index: number }) { |
|
|
|
await this.row(index).locator(`td[pw-data="cell-id-${index}"]`).hover(); |
|
|
|
await this.row(index).locator(`td[pw-data="cell-id-${index}"]`).hover(); |
|
|
|
await this.row(index).locator(`div[pw-data="nc-expand-${index}"]`).click(); |
|
|
|
await this.row(index).locator(`div[pw-data="nc-expand-${index}"]`).click(); |
|
|
|
|
|
|
|
await (await this.rootPage.locator('.ant-drawer-body').elementHandle())?.waitForElementState('stable'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async selectAll() { |
|
|
|
async selectAll() { |
|
|
@ -125,7 +128,15 @@ export class GridPage extends BasePage { |
|
|
|
await this.get() |
|
|
|
await this.get() |
|
|
|
.locator('[pw-data="nc-check-all"]') |
|
|
|
.locator('[pw-data="nc-check-all"]') |
|
|
|
.locator('input[type="checkbox"]') |
|
|
|
.locator('input[type="checkbox"]') |
|
|
|
.click(); |
|
|
|
.check({ |
|
|
|
|
|
|
|
force: true, |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const rowCount = await this.rowCount(); |
|
|
|
|
|
|
|
for(let i = 0; i < rowCount; i++) { |
|
|
|
|
|
|
|
await expect.poll(async () => await this.row(i).locator(`[pw-data="cell-id-${i}"]`).locator('span.ant-checkbox-checked').count()).toBe(1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
await this.rootPage.waitForTimeout(300); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async deleteAll() { |
|
|
|
async deleteAll() { |
|
|
|