Browse Source

test: updates as per new UI

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/5116/head
Raju Udava 2 years ago
parent
commit
645bc79eea
  1. 22
      tests/playwright/pages/Dashboard/ExpandedForm/index.ts
  2. 4
      tests/playwright/tests/expandedFormUrl.spec.ts

22
tests/playwright/pages/Dashboard/ExpandedForm/index.ts

@ -7,7 +7,8 @@ export class ExpandedFormPage extends BasePage {
readonly addNewTableButton: Locator;
readonly copyUrlButton: Locator;
readonly toggleCommentsButton: Locator;
readonly moreOptionsButton: Locator;
readonly duplicateRowButton: Locator;
readonly deleteRowButton: Locator;
constructor(dashboard: DashboardPage) {
super(dashboard.rootPage);
@ -15,7 +16,8 @@ export class ExpandedFormPage extends BasePage {
this.addNewTableButton = this.dashboard.get().locator('.nc-add-new-table');
this.copyUrlButton = this.dashboard.get().locator('.nc-copy-row-url:visible');
this.toggleCommentsButton = this.dashboard.get().locator('.nc-toggle-comments:visible');
this.moreOptionsButton = this.dashboard.get().locator('.nc-actions-menu-btn:visible').last();
this.duplicateRowButton = this.dashboard.get().locator('.nc-duplicate-row:visible');
this.deleteRowButton = this.dashboard.get().locator('.nc-delete-row:visible');
}
get() {
@ -23,10 +25,7 @@ export class ExpandedFormPage extends BasePage {
}
async clickDuplicateRow() {
await this.moreOptionsButton.click();
// wait for the menu to appear
await this.rootPage.waitForTimeout(1000);
await this.rootPage.locator('.nc-menu-item:has-text("Duplicate Row")').click();
await this.duplicateRowButton.click();
// wait for loader to disappear
// await this.dashboard.waitForLoaderToDisappear();
@ -34,22 +33,17 @@ export class ExpandedFormPage extends BasePage {
}
async clickDeleteRow() {
await this.moreOptionsButton.click();
// wait for the menu to appear
await this.rootPage.waitForTimeout(1000);
await this.rootPage.locator('.nc-menu-item:has-text("Delete Row")').click();
await this.deleteRowButton.click();
await this.rootPage.locator('.ant-btn-primary:has-text("OK")').click();
}
async isDisabledDuplicateRow() {
await this.moreOptionsButton.click();
const isDisabled = await this.rootPage.locator('.nc-menu-item.disabled:has-text("Duplicate Row")');
const isDisabled = await this.duplicateRowButton;
return await isDisabled.count();
}
async isDisabledDeleteRow() {
await this.moreOptionsButton.click();
const isDisabled = await this.rootPage.locator('.nc-menu-item.disabled:has-text("Delete Row")');
const isDisabled = await this.deleteRowButton;
return await isDisabled.count();
}

4
tests/playwright/tests/expandedFormUrl.spec.ts

@ -174,7 +174,7 @@ test.describe('Expanded record duplicate & delete options', () => {
// expand row, duplicate & verify menu
await dashboard.grid.openExpandedRow({ index: 0 });
await dashboard.expandedForm.clickDuplicateRow();
expect(await dashboard.expandedForm.isDisabledDeleteRow()).toBe(1);
expect(await dashboard.expandedForm.isDisabledDuplicateRow()).toBe(1);
expect(await dashboard.expandedForm.isDisabledDeleteRow()).toBe(0);
expect(await dashboard.expandedForm.isDisabledDuplicateRow()).toBe(0);
});
});

Loading…
Cancel
Save