Browse Source

feat(testing): Refactored Page object model

pull/3848/head
Muhammed Mustafa 2 years ago
parent
commit
677ddde403
  1. 0
      scripts/playwright/pages/Dashboard/Grid/Cell/SelectOptionCell.ts
  2. 0
      scripts/playwright/pages/Dashboard/Grid/Cell/index.ts
  3. 0
      scripts/playwright/pages/Dashboard/Grid/Column/SelectOptionColumn.ts
  4. 2
      scripts/playwright/pages/Dashboard/Grid/Column/index.ts
  5. 10
      scripts/playwright/pages/Dashboard/Grid/ExpandedForm/index.ts
  6. 0
      scripts/playwright/pages/Dashboard/Grid/index.ts
  7. 2
      scripts/playwright/pages/Dashboard/Settings/Audit.ts
  8. 0
      scripts/playwright/pages/Dashboard/Settings/index.ts
  9. 2
      scripts/playwright/pages/Dashboard/TreeView.ts
  10. 11
      scripts/playwright/pages/Dashboard/index.ts
  11. 7
      scripts/playwright/tests/multiSelect.spec.ts
  12. 7
      scripts/playwright/tests/singleSelect.spec.ts
  13. 2
      scripts/playwright/tests/tableColumnOperation.spec.ts
  14. 2
      scripts/playwright/tests/tableOperations.spec.ts
  15. 20
      scripts/playwright/tests/views.spec.ts

0
scripts/playwright/pages/Cell/SelectOptionCell.ts → scripts/playwright/pages/Dashboard/Grid/Cell/SelectOptionCell.ts

0
scripts/playwright/pages/Cell/index.ts → scripts/playwright/pages/Dashboard/Grid/Cell/index.ts

0
scripts/playwright/pages/Column/SelectOptionColumn.ts → scripts/playwright/pages/Dashboard/Grid/Column/SelectOptionColumn.ts

2
scripts/playwright/pages/Column/index.ts → scripts/playwright/pages/Dashboard/Grid/Column/index.ts

@ -1,5 +1,5 @@
import { Page, expect } from "@playwright/test";
import { BasePage } from "../Base";
import { BasePage } from "../../../Base";
import {SelectOptionColumnPageObject} from "./SelectOptionColumn";
export class ColumnPageObject {

10
scripts/playwright/pages/ExpandedForm/index.ts → scripts/playwright/pages/Dashboard/Grid/ExpandedForm/index.ts

@ -1,21 +1,15 @@
// playwright-dev-page.ts
import { Locator, Page, expect } from '@playwright/test';
import { BasePage } from '../Base';
import { CellPageObject } from '../Cell';
import { ColumnPageObject } from '../Column';
import { Locator, Page } from '@playwright/test';
import { BasePage } from '../../../Base';
export class ExpandedFormPage {
readonly page: Page;
readonly addNewTableButton: Locator;
readonly column: ColumnPageObject;
readonly cell: CellPageObject;
readonly base: BasePage;
constructor(page: Page) {
this.page = page;
this.addNewTableButton = page.locator('.nc-add-new-table');
this.column = new ColumnPageObject(page);
this.cell = new CellPageObject(page);
this.base = new BasePage(page);
}

0
scripts/playwright/pages/Grid.ts → scripts/playwright/pages/Dashboard/Grid/index.ts

2
scripts/playwright/pages/Settings/Audit.ts → scripts/playwright/pages/Dashboard/Settings/Audit.ts

@ -1,5 +1,5 @@
// playwright-dev-page.ts
import { Page, expect } from '@playwright/test';
import { expect } from '@playwright/test';
import { SettingsPage } from '.';
export class AuditSettingsPage {

0
scripts/playwright/pages/Settings/index.ts → scripts/playwright/pages/Dashboard/Settings/index.ts

2
scripts/playwright/pages/TreeView.ts → scripts/playwright/pages/Dashboard/TreeView.ts

@ -1,5 +1,5 @@
import { expect, Page } from "@playwright/test";
import { BasePage } from "./Base";
import { BasePage } from "../Base";
export class TreeViewPage {
readonly page: Page;

11
scripts/playwright/pages/Dashboard.ts → scripts/playwright/pages/Dashboard/index.ts

@ -1,7 +1,8 @@
// playwright-dev-page.ts
import { Locator, Page, expect } from "@playwright/test";
import { BasePage } from "./Base";
import { ExpandedFormPage } from "./ExpandedForm";
import { BasePage } from "../Base";
import { GridPage } from "./Grid";
import { ExpandedFormPage } from "./Grid/ExpandedForm";
import { TreeViewPage } from "./TreeView";
export class DashboardPage {
@ -10,8 +11,9 @@ export class DashboardPage {
readonly tablesSideBar: Locator;
readonly tabBar: Locator;
readonly base: BasePage;
readonly expandedForm: ExpandedFormPage;
readonly treeView: TreeViewPage;
readonly grid: GridPage;
readonly expandedForm: ExpandedFormPage;
constructor(page: Page, project: any) {
this.page = page;
@ -19,8 +21,9 @@ export class DashboardPage {
this.project = project;
this.tablesSideBar = page.locator(".nc-treeview-container");
this.tabBar = page.locator(".nc-tab-bar");
this.expandedForm = new ExpandedFormPage(page);
this.treeView = new TreeViewPage(page, project);
this.grid = new GridPage(page);
this.expandedForm = new ExpandedFormPage(page);
}
async goto() {

7
scripts/playwright/tests/multiSelect.spec.ts

@ -1,6 +1,6 @@
import { Page, test } from '@playwright/test';
import { test } from '@playwright/test';
import { DashboardPage } from '../pages/Dashboard';
import { GridPage } from '../pages/Grid';
import { GridPage } from '../pages/Dashboard/Grid'
import setup from '../setup';
@ -11,9 +11,10 @@ test.describe('Multi select', () => {
test.beforeEach(async ({page}) => {
context = await setup({ page });
dashboard = new DashboardPage(page, context.project);
grid = dashboard.grid;
await dashboard.treeView.createTable({ title: 'sheet1' });
grid = new GridPage(page);
await grid.column.create({ title: 'MultiSelect', type: 'MultiSelect' });
await grid.addNewRow({index: 0, title: "Row 0"});
})

7
scripts/playwright/tests/singleSelect.spec.ts

@ -1,6 +1,6 @@
import { Page, test } from '@playwright/test';
import { test } from '@playwright/test';
import { DashboardPage } from '../pages/Dashboard';
import { GridPage } from '../pages/Grid';
import { GridPage } from '../pages/Dashboard/Grid';
import setup from '../setup';
@ -11,9 +11,10 @@ test.describe('Single select', () => {
test.beforeEach(async ({page}) => {
context = await setup({ page });
dashboard = new DashboardPage(page, context.project);
grid = dashboard.grid;
await dashboard.treeView.createTable({ title: 'sheet1' });
grid = new GridPage(page);
await grid.column.create({ title: 'SingleSelect', type: 'SingleSelect' });
await grid.addNewRow({index: 0, title: "Row 0"});
})

2
scripts/playwright/tests/tableColumnOperation.spec.ts

@ -1,6 +1,6 @@
import { test } from '@playwright/test';
import { DashboardPage } from '../pages/Dashboard';
import { GridPage } from '../pages/Grid';
import { GridPage } from '../pages/Dashboard/Grid';
import setup from '../setup';

2
scripts/playwright/tests/tableOperations.spec.ts

@ -1,6 +1,6 @@
import { test } from '@playwright/test';
import { DashboardPage } from '../pages/Dashboard';
import { SettingsPage } from '../pages/Settings';
import { SettingsPage } from '../pages/Dashboard/Settings';
import setup from '../setup';

20
scripts/playwright/tests/views.spec.ts

@ -0,0 +1,20 @@
import { test } from '@playwright/test';
import { DashboardPage } from '../pages/Dashboard';
import { SettingsPage } from '../pages/Dashboard/Settings';
import setup from '../setup';
test.describe.skip('Views', () => {
let dashboard: DashboardPage, settings: SettingsPage;
let context: any;
test.beforeEach(async ({page}) => {
context = await setup({ page });
dashboard = new DashboardPage(page, context.project);
settings = new SettingsPage(page);
})
test('Create, and delete table, verify in audit tab, rename City table and reorder tables', async () => {
});
});
Loading…
Cancel
Save