Browse Source

fix: groupBy hidden & select field playwright test case fail issue

pull/7348/head
Ramesh Mane 11 months ago
parent
commit
dbec256cb0
  1. 7
      tests/playwright/pages/Dashboard/Grid/Column/UserOptionColumn.ts
  2. 1
      tests/playwright/pages/Dashboard/Grid/Group.ts
  3. 17
      tests/playwright/pages/Dashboard/common/Cell/SelectOptionCell.ts
  4. 11
      tests/playwright/pages/Dashboard/common/Cell/UserOptionCell.ts

7
tests/playwright/pages/Dashboard/Grid/Column/UserOptionColumn.ts

@ -51,6 +51,8 @@ export class UserOptionColumnPageObject extends BasePage {
const selector = this.column.get().locator('.nc-user-select >> .ant-select-selector'); const selector = this.column.get().locator('.nc-user-select >> .ant-select-selector');
await selector.click(); await selector.click();
await this.rootPage.locator('.nc-dropdown-user-select-cell').waitFor({ state: 'visible' });
if (multiSelect) { if (multiSelect) {
const optionsToSelect = Array.isArray(option) ? option : [option]; const optionsToSelect = Array.isArray(option) ? option : [option];
@ -60,11 +62,12 @@ export class UserOptionColumnPageObject extends BasePage {
// Press `Escape` to close the dropdown // Press `Escape` to close the dropdown
await this.rootPage.keyboard.press('Escape'); await this.rootPage.keyboard.press('Escape');
await this.rootPage.locator('.nc-dropdown-user-select-cell').waitFor({ state: 'hidden' });
} else if (!Array.isArray(option)) { } else if (!Array.isArray(option)) {
await this.selectOption({ option }); await this.selectOption({ option });
} }
await this.rootPage.locator('.nc-dropdown-user-select-cell').waitFor({ state: 'hidden' });
await this.column.save({ isUpdated: true }); await this.column.save({ isUpdated: true });
} }
@ -91,6 +94,8 @@ export class UserOptionColumnPageObject extends BasePage {
await this.column.get().locator('.nc-cell-user > .nc-user-select').click(); await this.column.get().locator('.nc-cell-user > .nc-user-select').click();
await this.rootPage.locator('.nc-dropdown-user-select-cell').waitFor({ state: 'visible' });
expect(await this.rootPage.getByTestId(`select-option-${columnTitle}-undefined`).count()).toEqual(totalCount); expect(await this.rootPage.getByTestId(`select-option-${columnTitle}-undefined`).count()).toEqual(totalCount);
await this.column.get().locator('.nc-cell-user').click(); await this.column.get().locator('.nc-cell-user').click();

1
tests/playwright/pages/Dashboard/Grid/Group.ts

@ -74,6 +74,7 @@ export class GroupPageObject extends BasePage {
value: string; value: string;
}) { }) {
const gridWrapper = this.get({ indexMap }); const gridWrapper = this.get({ indexMap });
await gridWrapper.scrollIntoViewIfNeeded();
await gridWrapper await gridWrapper
.locator(`.nc-group-table .nc-grid-row:nth-child(${rowIndex + 1}) [data-title="${columnHeader}"]`) .locator(`.nc-group-table .nc-grid-row:nth-child(${rowIndex + 1}) [data-title="${columnHeader}"]`)
.scrollIntoViewIfNeeded(); .scrollIntoViewIfNeeded();

17
tests/playwright/pages/Dashboard/common/Cell/SelectOptionCell.ts

@ -39,24 +39,29 @@ export class SelectOptionCellPageObject extends BasePage {
await selectCell.click(); await selectCell.click();
if (multiSelect) {
await this.rootPage.locator('.nc-dropdown-multi-select-cell').waitFor({ state: 'visible' });
} else {
await this.rootPage.locator('.nc-dropdown-single-select-cell').waitFor({ state: 'visible' });
}
if (index === -1) { if (index === -1) {
const selectOption = this.rootPage.getByTestId(`select-option-${columnHeader}-undefined`).getByText(option); const selectOption = this.rootPage.getByTestId(`select-option-${columnHeader}-undefined`).getByText(option);
await selectOption.waitFor({ state: 'visible' }); await selectOption.scrollIntoViewIfNeeded();
await selectOption.click(); await selectOption.click();
} else { } else {
const selectOption = this.rootPage.getByTestId(`select-option-${columnHeader}-${index}`).getByText(option); const selectOption = this.rootPage.getByTestId(`select-option-${columnHeader}-${index}`).getByText(option);
await selectOption.waitFor({ state: 'visible' }); await selectOption.scrollIntoViewIfNeeded();
await selectOption.click(); await selectOption.click();
} }
if (multiSelect) { if (multiSelect) {
// Press `Escape` to close the dropdown // Press `Escape` to close the dropdown
await this.rootPage.keyboard.press('Escape'); await this.rootPage.keyboard.press('Escape');
await this.rootPage.locator('.nc-dropdown-multi-select-cell').waitFor({ state: 'hidden' });
} else {
await this.rootPage.locator('.nc-dropdown-single-select-cell').waitFor({ state: 'hidden' });
} }
await this.rootPage
.getByTestId(`select-option-${columnHeader}-${index}`)
.getByText(option)
.waitFor({ state: 'hidden' });
} }
async clear({ index, columnHeader, multiSelect }: { index: number; columnHeader: string; multiSelect?: boolean }) { async clear({ index, columnHeader, multiSelect }: { index: number; columnHeader: string; multiSelect?: boolean }) {

11
tests/playwright/pages/Dashboard/common/Cell/UserOptionCell.ts

@ -37,13 +37,15 @@ export class UserOptionCellPageObject extends BasePage {
await selectCell.click(); await selectCell.click();
await this.rootPage.locator('.nc-dropdown-user-select-cell').waitFor({ state: 'visible' });
if (index === -1) { if (index === -1) {
const selectOption = this.rootPage.getByTestId(`select-option-${columnHeader}-undefined`).getByText(option); const selectOption = this.rootPage.getByTestId(`select-option-${columnHeader}-undefined`).getByText(option);
await selectOption.waitFor({ state: 'visible' }); await selectOption.scrollIntoViewIfNeeded();
await selectOption.click(); await selectOption.click();
} else { } else {
const selectOption = this.rootPage.getByTestId(`select-option-${columnHeader}-${index}`).getByText(option); const selectOption = this.rootPage.getByTestId(`select-option-${columnHeader}-${index}`).getByText(option);
await selectOption.waitFor({ state: 'visible' }); await selectOption.scrollIntoViewIfNeeded();
await selectOption.click(); await selectOption.click();
} }
@ -52,10 +54,7 @@ export class UserOptionCellPageObject extends BasePage {
await this.rootPage.keyboard.press('Escape'); await this.rootPage.keyboard.press('Escape');
} }
await this.rootPage await this.rootPage.locator('.nc-dropdown-user-select-cell').waitFor({ state: 'hidden' });
.getByTestId(`select-option-${columnHeader}-${index}`)
.getByText(option)
.waitFor({ state: 'hidden' });
} }
async clear({ index, columnHeader, multiSelect }: { index: number; columnHeader: string; multiSelect?: boolean }) { async clear({ index, columnHeader, multiSelect }: { index: number; columnHeader: string; multiSelect?: boolean }) {

Loading…
Cancel
Save