mirror of
https://github.com/nocodb/nocodb.git
synced 2026-04-30 11:36:34 +00:00
feat(testing): Added quicktest(not complete)
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import { expect } from "@playwright/test";
|
||||
import { CellPageObject } from ".";
|
||||
import BasePage from "../../../Base";
|
||||
|
||||
export class CheckboxCellPageObject extends BasePage {
|
||||
readonly cell: CellPageObject;
|
||||
|
||||
constructor(cell: CellPageObject) {
|
||||
super(cell.rootPage);
|
||||
this.cell = cell;
|
||||
}
|
||||
|
||||
get({index, columnHeader}: {index?: number, columnHeader: string}) {
|
||||
return this.cell.get({index, columnHeader});
|
||||
}
|
||||
|
||||
async click({ index, columnHeader }: { index?: number, columnHeader: string }) {
|
||||
return this.get({index, columnHeader}).locator('.nc-cell').click();
|
||||
}
|
||||
|
||||
async isChecked({ index, columnHeader }: { index?: number, columnHeader: string }) {
|
||||
return this.get({index, columnHeader}).locator('.nc-cell-hover-show').isVisible();
|
||||
}
|
||||
|
||||
async verifyChecked({ index, columnHeader }: { index?: number, columnHeader: string }) {
|
||||
expect(await this.get({index, columnHeader}).locator('.nc-cell-hover-show').isVisible()).toBe(false);
|
||||
}
|
||||
|
||||
async verifyUnchecked({ index, columnHeader }: { index?: number, columnHeader: string }) {
|
||||
expect(await this.get({index, columnHeader}).locator('.nc-cell-hover-show').isVisible()).toBe(true);
|
||||
}
|
||||
}
|
||||
21
scripts/playwright/pages/Dashboard/common/Cell/RatingCell.ts
Normal file
21
scripts/playwright/pages/Dashboard/common/Cell/RatingCell.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { expect } from "@playwright/test";
|
||||
import { CellPageObject } from ".";
|
||||
import BasePage from "../../../Base";
|
||||
|
||||
export class RatingCellPageObject extends BasePage {
|
||||
readonly cell: CellPageObject;
|
||||
|
||||
constructor(cell: CellPageObject) {
|
||||
super(cell.rootPage);
|
||||
this.cell = cell;
|
||||
}
|
||||
|
||||
get({index, columnHeader}: {index?: number, columnHeader: string}) {
|
||||
return this.cell.get({index, columnHeader});
|
||||
}
|
||||
|
||||
async verify({index, columnHeader, rating}: {index?: number, columnHeader: string, rating: number}) {
|
||||
expect(await this.get({index, columnHeader}).locator(`div[role="radio"][aria-checked="true"]`).count()).toBe(rating);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,17 +4,22 @@ import BasePage from "../../../Base";
|
||||
import { AttachmentCellPageObject } from "./AttachmentCell";
|
||||
import { SelectOptionCellPageObject } from "./SelectOptionCell";
|
||||
import { SharedFormPage } from "../../../SharedForm";
|
||||
import { CheckboxCellPageObject } from "./CheckboxCell";
|
||||
import { RatingCellPageObject } from "./RatingCell";
|
||||
|
||||
export class CellPageObject extends BasePage {
|
||||
readonly parent: GridPage | SharedFormPage;
|
||||
readonly selectOption: SelectOptionCellPageObject;
|
||||
readonly attachment: AttachmentCellPageObject;
|
||||
|
||||
readonly checkbox: CheckboxCellPageObject;
|
||||
readonly rating: RatingCellPageObject;
|
||||
constructor(parent: GridPage | SharedFormPage) {
|
||||
super(parent.rootPage);
|
||||
this.parent = parent;
|
||||
this.selectOption = new SelectOptionCellPageObject(this);
|
||||
this.attachment = new AttachmentCellPageObject(this);
|
||||
this.checkbox = new CheckboxCellPageObject(this);
|
||||
this.rating = new RatingCellPageObject(this);
|
||||
}
|
||||
|
||||
get({
|
||||
@@ -127,6 +132,7 @@ export class CellPageObject extends BasePage {
|
||||
}
|
||||
}
|
||||
|
||||
// todo: Improve param names (i.e value => values)
|
||||
// verifyVirtualCell
|
||||
// : virtual relational cell- HM, BT, MM
|
||||
// : verify link count & cell value
|
||||
@@ -139,7 +145,7 @@ export class CellPageObject extends BasePage {
|
||||
}: {
|
||||
index: number;
|
||||
columnHeader: string;
|
||||
count: number;
|
||||
count?: number;
|
||||
value: string[];
|
||||
}) {
|
||||
// const count = value.length;
|
||||
@@ -148,7 +154,7 @@ export class CellPageObject extends BasePage {
|
||||
const chipCount = await chips.count();
|
||||
|
||||
// verify chip count & contents
|
||||
expect(chipCount).toEqual(count);
|
||||
if(count) expect(chipCount).toEqual(count);
|
||||
|
||||
// verify only the elements that are passed in
|
||||
for (let i = 0; i < value.length; ++i) {
|
||||
|
||||
Reference in New Issue
Block a user