Browse Source

feat(testing): Improved column page object

pull/3848/head
Muhammed Mustafa 2 years ago
parent
commit
232519bf2f
  1. 33
      scripts/playwright/pages/Column/index.ts

33
scripts/playwright/pages/Column/index.ts

@ -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,9 +38,21 @@ export class ColumnPageObject {
break;
}
await this.save();
}
async fillTitle({title}: {title: string}) {
await this.page.locator('.nc-column-name-input').fill(title);
}
await this.save();
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}) {

Loading…
Cancel
Save