test: add playwright test

Signed-off-by: Pranav C <pranavxc@gmail.com>
This commit is contained in:
Pranav C
2022-11-19 16:59:50 +05:30
parent ac05d8fa6c
commit b4b63e5140
5 changed files with 149 additions and 68 deletions

View File

@@ -112,4 +112,37 @@ export class SelectOptionCellPageObject extends BasePage {
await this.get({ index, columnHeader }).click();
await this.rootPage.locator(`.nc-dropdown-single-select-cell`).nth(index).waitFor({ state: 'hidden' });
}
async addNewOption({
index,
columnHeader,
option,
multiSelect,
}: {
index: number;
columnHeader: string;
option: string;
multiSelect?: boolean;
}) {
const selectCell = this.get({ index, columnHeader });
// check if cell active
if (!(await selectCell.getAttribute('class')).includes('active')) {
await selectCell.click();
}
await selectCell.locator('.ant-select-selection-search-input').type(option);
await selectCell.locator('.ant-select-selection-search-input').press('Enter');
if (multiSelect) await selectCell.locator('.ant-select-selection-search-input').press('Escape');
// await this.rootPage.getByTestId(`select-option-${columnHeader}-${index}`).getByText(option).click();
//
//
// await this.rootPage
// .getByTestId(`select-option-${columnHeader}-${index}`)
// .getByText(option)
// .waitFor({ state: 'hidden' });
}
}