mirror of
https://github.com/nocodb/nocodb.git
synced 2026-04-25 03:05:47 +00:00
feat(testing): Improved column page object
This commit is contained in:
@@ -13,21 +13,22 @@ export class ColumnPageObject {
|
||||
this.basePage = new BasePage(this.page);
|
||||
}
|
||||
|
||||
async create({title, type}: {title: string, type: string}) {
|
||||
get() {
|
||||
return this.page.locator('[data-pw="add-or-edit-column"]');
|
||||
}
|
||||
|
||||
async create({title, type = "SingleLineText"}: {title: string, type?: string}) {
|
||||
await this.page.locator('.nc-column-add').click();
|
||||
|
||||
await this.page.locator('form[data-pw="add-or-edit-column"]').waitFor();
|
||||
|
||||
// Click span:has-text("SingleLineText") >> nth=1
|
||||
await this.page.locator('span:has-text("SingleLineText")').click();
|
||||
|
||||
// Fill text=Column Type SingleLineText >> input[role="combobox"]
|
||||
await this.page.locator('text=Column Type SingleLineText >> input[role="combobox"]').fill(type);
|
||||
|
||||
// Select column type
|
||||
await this.page.locator(`text=${type}`).nth(1).click();
|
||||
await this.fillTitle({title});
|
||||
|
||||
await this.selectType({type});
|
||||
|
||||
switch (type) {
|
||||
case "SingleTextLine":
|
||||
break;
|
||||
case 'SingleSelect':
|
||||
case 'MultiSelect':
|
||||
await this.selectOption.addOption({index: 0, option: 'Option 1', skipColumnModal: true});
|
||||
@@ -37,11 +38,23 @@ export class ColumnPageObject {
|
||||
break;
|
||||
}
|
||||
|
||||
await this.page.locator('.nc-column-name-input').fill(title);
|
||||
|
||||
await this.save();
|
||||
}
|
||||
|
||||
async fillTitle({title}: {title: string}) {
|
||||
await this.page.locator('.nc-column-name-input').fill(title);
|
||||
}
|
||||
|
||||
async selectType({type}: {type: string}) {
|
||||
await this.get().locator('.ant-select-selector > .ant-select-selection-item').click();
|
||||
|
||||
await this.get().locator('.ant-select-selection-search-input[aria-expanded="true"]').waitFor();
|
||||
await this.get().locator('.ant-select-selection-search-input[aria-expanded="true"]').fill(type);
|
||||
|
||||
// Select column type
|
||||
await this.page.locator(`text=${type}`).nth(1).click();
|
||||
}
|
||||
|
||||
async delete({title}: {title: string}) {
|
||||
await this.page.locator(`text=#Title${title} >> svg >> nth=3`).click();
|
||||
await this.page.locator('li[role="menuitem"]:has-text("Delete")').waitFor()
|
||||
|
||||
Reference in New Issue
Block a user