Browse Source

test: duration test correction

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/3848/head
Raju Udava 2 years ago committed by Muhammed Mustafa
parent
commit
8495d03f65
  1. 42
      scripts/playwright/pages/Dashboard/Grid/index.ts
  2. 14
      scripts/playwright/tests/columnDuration.spec.ts

42
scripts/playwright/pages/Dashboard/Grid/index.ts

@ -64,7 +64,13 @@ export class GridPage extends BasePage {
index = 0,
columnHeader = "Title",
value,
}: { index?: number; columnHeader?: string; value?: string } = {}) {
networkValidation = true,
}: {
index?: number;
columnHeader?: string;
value?: string;
networkValidation?: boolean;
} = {}) {
const rowValue = value ?? `Row ${index}`;
const rowCount = await this.get().locator(".nc-grid-row").count();
await this.get().locator(".nc-grid-add-new-cell").click();
@ -80,22 +86,28 @@ export class GridPage extends BasePage {
.locator(`span[title="${columnHeader}"]`)
.click();
await this.waitForResponse({
uiAction: clickOnColumnHeaderToSave,
requestUrlPathToMatch: "api/v1/db/data/noco",
httpMethodsToMatch: ["POST"],
responseJsonMatcher: (resJson) => resJson?.[columnHeader] === value,
});
if (networkValidation) {
await this.waitForResponse({
uiAction: clickOnColumnHeaderToSave,
requestUrlPathToMatch: "api/v1/db/data/noco",
httpMethodsToMatch: ["POST"],
responseJsonMatcher: (resJson) => resJson?.[columnHeader] === value,
});
} else {
await this.rootPage.waitForTimeout(300);
}
}
async editRow({
index = 0,
columnHeader = "Title",
value,
networkValidation = true,
}: {
index?: number;
columnHeader?: string;
value: string;
networkValidation?: boolean;
}) {
await this._fillRow({ index, columnHeader, value });
@ -104,12 +116,16 @@ export class GridPage extends BasePage {
.locator(`span[title="${columnHeader}"]`)
.click();
await this.waitForResponse({
uiAction: clickOnColumnHeaderToSave,
requestUrlPathToMatch: "api/v1/db/data/noco",
httpMethodsToMatch: ["PATCH"],
responseJsonMatcher: (resJson) => resJson?.[columnHeader] === value,
});
if (networkValidation) {
await this.waitForResponse({
uiAction: clickOnColumnHeaderToSave,
requestUrlPathToMatch: "api/v1/db/data/noco",
httpMethodsToMatch: ["PATCH"],
responseJsonMatcher: (resJson) => resJson?.[columnHeader] === value,
});
} else {
await this.rootPage.waitForTimeout(300);
}
}
async verifyRow({ index }: { index: number }) {

14
scripts/playwright/tests/columnDuration.spec.ts

@ -122,6 +122,7 @@ test.describe.skip("Duration column", () => {
index: i,
columnHeader: "NC_DURATION_0",
value: i.toString(),
networkValidation: false,
});
}
@ -133,18 +134,19 @@ test.describe.skip("Duration column", () => {
format: durationData[i].format,
});
await dashboard.grid.column.save({ isUpdated: true });
for (let i = 0; i < durationData[i].input.length; i++) {
for (let j = 0; j < durationData[i].input.length; j++) {
await dashboard.grid.editRow({
index: i,
index: j,
columnHeader: "NC_DURATION_0",
value: durationData[i].input[i],
value: durationData[i].input[j],
networkValidation: false,
});
}
for (let i = 0; i < durationData[i].output.length; i++) {
for (let j = 0; j < durationData[i].output.length; j++) {
await dashboard.grid.cell.verify({
index: i,
index: j,
columnHeader: "NC_DURATION_0",
value: durationData[i].output[i],
value: durationData[i].output[j],
});
}
}

Loading…
Cancel
Save