|
|
@ -41,21 +41,32 @@ export class GridPage extends BasePage { |
|
|
|
|
|
|
|
|
|
|
|
async addNewRow({ |
|
|
|
async addNewRow({ |
|
|
|
index = 0, |
|
|
|
index = 0, |
|
|
|
title, |
|
|
|
title = "Title", |
|
|
|
}: { index?: number; title?: string } = {}) { |
|
|
|
value, |
|
|
|
|
|
|
|
}: { index?: number; title?: 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(); |
|
|
|
|
|
|
|
|
|
|
|
expect.poll(async () => await this.get().locator(".nc-grid-row").count()).toBe(rowCount + 1) |
|
|
|
expect |
|
|
|
|
|
|
|
.poll(async () => await this.get().locator(".nc-grid-row").count()) |
|
|
|
|
|
|
|
.toBe(rowCount + 1); |
|
|
|
|
|
|
|
|
|
|
|
const cell = this.cell.get({ index, columnHeader: "Title" }); |
|
|
|
const cell = this.cell.get({ index, columnHeader: title }); |
|
|
|
await this.cell.dblclick({ |
|
|
|
await this.cell.dblclick({ |
|
|
|
index, |
|
|
|
index, |
|
|
|
columnHeader: "Title", |
|
|
|
columnHeader: title, |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
await cell.locator("input").fill(title ?? `Row ${index}`); |
|
|
|
if (value) { |
|
|
|
await this.cell.grid.get().locator('[data-title="Title"]').locator('span[title="Title"]').click(); |
|
|
|
await cell.locator("input").fill(value); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
await cell.locator("input").fill(title ?? `Row ${index}`); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
await this.cell.grid |
|
|
|
|
|
|
|
.get() |
|
|
|
|
|
|
|
.locator(`[data-title="${title}"]`) |
|
|
|
|
|
|
|
.locator(`span[title="${title}"]`) |
|
|
|
|
|
|
|
.click(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async verifyRow({ index }: { index: number }) { |
|
|
|
async verifyRow({ index }: { index: number }) { |
|
|
@ -107,6 +118,10 @@ export class GridPage extends BasePage { |
|
|
|
|
|
|
|
|
|
|
|
async selectAll() { |
|
|
|
async selectAll() { |
|
|
|
await this.get().locator('[pw-data="nc-check-all"]').hover(); |
|
|
|
await this.get().locator('[pw-data="nc-check-all"]').hover(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// fix me! without this, elements are getting de-checked after select-all
|
|
|
|
|
|
|
|
await this.rootPage.waitForTimeout(1000); |
|
|
|
|
|
|
|
|
|
|
|
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"]') |
|
|
@ -115,12 +130,9 @@ export class GridPage extends BasePage { |
|
|
|
|
|
|
|
|
|
|
|
async deleteAll() { |
|
|
|
async deleteAll() { |
|
|
|
await this.selectAll(); |
|
|
|
await this.selectAll(); |
|
|
|
await this.get() |
|
|
|
await this.get().locator('[pw-data="nc-check-all"]').nth(0).click({ |
|
|
|
.locator('[pw-data="nc-check-all"]') |
|
|
|
button: "right", |
|
|
|
.locator('input[type="checkbox"]') |
|
|
|
}); |
|
|
|
.click({ |
|
|
|
|
|
|
|
button: "right", |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
await this.rootPage.locator("text=Delete Selected Rows").click(); |
|
|
|
await this.rootPage.locator("text=Delete Selected Rows").click(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -149,7 +161,8 @@ export class GridPage extends BasePage { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async waitLoading() { |
|
|
|
async waitLoading() { |
|
|
|
await this.dashboard.get() |
|
|
|
await this.dashboard |
|
|
|
|
|
|
|
.get() |
|
|
|
.locator('[pw-data="grid-load-spinner"]') |
|
|
|
.locator('[pw-data="grid-load-spinner"]') |
|
|
|
.waitFor({ state: "hidden" }); |
|
|
|
.waitFor({ state: "hidden" }); |
|
|
|
} |
|
|
|
} |
|
|
|