Browse Source

feat(testing): Megred reorder tables test with Create table test

pull/3848/head
Muhammed Mustafa 2 years ago
parent
commit
1a908b0449
  1. 10
      scripts/playwright/pages/TreeView.ts
  2. 19
      scripts/playwright/tests/tableOperations.spec.ts

10
scripts/playwright/pages/TreeView.ts

@ -16,6 +16,10 @@ export class TreeViewPage {
return this.page.locator(".nc-treeview-container");;
}
async focusTable({ title }: { title: string }) {
await this.get().locator(`.nc-project-tree-tbl-${title}`).focus();
}
async openTable({ title }: { title: string }) {
await this.get().locator(`.nc-project-tree-tbl-${title}`).click();
}
@ -36,10 +40,14 @@ export class TreeViewPage {
.waitFor({ state: "hidden" });
}
async verifyTableExists({ title }: { title: string }) {
async verifyTable({ title, index }: { title: string; index?: number }) {
await expect(
this.get().locator(`.nc-project-tree-tbl-${title}`)
).toBeVisible();
if(index) {
expect(await this.get().locator('.nc-tbl-title').nth(index)).toHaveText(title);
}
}
async verifyTableDoesNotExist({ title }: { title: string }) {

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

@ -14,9 +14,9 @@ test.describe('Table Operations', () => {
settings = new SettingsPage(page);
})
test('Create, and delete table, verify in audit tab, and rename City table', async () => {
test('Create, and delete table, verify in audit tab, rename City table and reorder tables', async () => {
await dashboard.treeView.createTable({title: "tablex"});
await dashboard.treeView.verifyTableExists({title: "tablex"});
await dashboard.treeView.verifyTable({title: "tablex"});
await dashboard.treeView.deleteTable({title: "tablex"});
await dashboard.treeView.verifyTableDoesNotExist({title: "tablex"});
@ -28,14 +28,15 @@ test.describe('Table Operations', () => {
await settings.close();
await dashboard.treeView.renameTable({title: "City", newTitle: "Cityx"});
await dashboard.treeView.verifyTableExists({title: "Cityx"});
});
await dashboard.treeView.verifyTable({title: "Cityx"});
test('Table drag and drop re order', async () => {
await dashboard.treeView.focusTable({title: "Actor"});
await dashboard.treeView.verifyTable({title: "Actor", index: 0});
await dashboard.treeView.reorderTables({
sourceTable: "City",
destinationTable: "Country"
})
})
sourceTable: "Actor",
destinationTable: "Address"
});
await dashboard.treeView.verifyTable({title: "Address", index: 0});
});
});

Loading…
Cancel
Save