Browse Source

test(refactor): class name correction

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/3848/head
Raju Udava 2 years ago committed by Muhammed Mustafa
parent
commit
50e88aa594
  1. 2
      packages/nc-gui/components/smartsheet/toolbar/ColumnFilterMenu.vue
  2. 4
      packages/nc-gui/components/smartsheet/toolbar/FieldsMenu.vue
  3. 2
      packages/nc-gui/components/smartsheet/toolbar/SortListMenu.vue
  4. 2
      scripts/playwright/pages/Dashboard/Gallery/index.ts
  5. 6
      scripts/playwright/pages/Dashboard/Grid/index.ts
  6. 19
      scripts/playwright/pages/Dashboard/Toolbar/Fields.ts
  7. 10
      scripts/playwright/pages/Dashboard/Toolbar/Filter.ts
  8. 4
      scripts/playwright/pages/Dashboard/Toolbar/ShareView.ts
  9. 10
      scripts/playwright/pages/Dashboard/Toolbar/Sort.ts
  10. 6
      scripts/playwright/pages/Dashboard/Toolbar/ViewMenu.ts
  11. 22
      scripts/playwright/pages/Dashboard/Toolbar/index.ts
  12. 3
      scripts/playwright/pages/Dashboard/index.ts
  13. 2
      scripts/playwright/tests/linkToAnotherRecord.spec.ts
  14. 215
      scripts/playwright/tests/metaSync.spec.ts
  15. 7
      scripts/playwright/tests/toolbarOperations.spec.ts
  16. 10
      scripts/playwright/tests/viewGridLocked.spec.ts
  17. 20
      scripts/playwright/tests/viewGridShare.spec.ts

2
packages/nc-gui/components/smartsheet/toolbar/ColumnFilterMenu.vue

@ -82,7 +82,7 @@ const filterAutoSaveLoc = computed({
ref="filterComp" ref="filterComp"
class="nc-table-toolbar-menu shadow-lg" class="nc-table-toolbar-menu shadow-lg"
:auto-save="filterAutoSave" :auto-save="filterAutoSave"
pw-data="grid-filter-menu" pw-data="nc-filter-menu"
@update:filters-length="filtersLength = $event" @update:filters-length="filtersLength = $event"
> >
<div v-if="!isPublic" class="flex items-end mt-2 min-h-[30px]" @click.stop> <div v-if="!isPublic" class="flex items-end mt-2 min-h-[30px]" @click.stop>

4
packages/nc-gui/components/smartsheet/toolbar/FieldsMenu.vue

@ -139,7 +139,7 @@ const getIcon = (c: ColumnType) =>
<template #overlay> <template #overlay>
<div <div
class="p-3 min-w-[280px] bg-gray-50 shadow-lg nc-table-toolbar-menu max-h-[max(80vh,500px)] overflow-auto !border" class="p-3 min-w-[280px] bg-gray-50 shadow-lg nc-table-toolbar-menu max-h-[max(80vh,500px)] overflow-auto !border"
pw-data="grid-fields-menu" pw-data="nc-fields-menu"
@click.stop @click.stop
> >
<a-card <a-card
@ -167,7 +167,7 @@ const getIcon = (c: ColumnType) =>
v-show="filteredFieldList.includes(field)" v-show="filteredFieldList.includes(field)"
:key="field.id" :key="field.id"
class="px-2 py-1 flex items-center" class="px-2 py-1 flex items-center"
:pw-data="`grid-fields-menu-${field.title}`" :pw-data="`nc-fields-menu-${field.title}`"
@click.stop @click.stop
> >
<a-checkbox <a-checkbox

2
packages/nc-gui/components/smartsheet/toolbar/SortListMenu.vue

@ -55,7 +55,7 @@ watch(
<template #overlay> <template #overlay>
<div <div
class="bg-gray-50 p-6 shadow-lg menu-filter-dropdown min-w-[400px] max-h-[max(80vh,500px)] overflow-auto !border" class="bg-gray-50 p-6 shadow-lg menu-filter-dropdown min-w-[400px] max-h-[max(80vh,500px)] overflow-auto !border"
pw-data="grid-sorts-menu" pw-data="nc-sorts-menu"
> >
<div v-if="sorts?.length" class="sort-grid mb-2" @click.stop> <div v-if="sorts?.length" class="sort-grid mb-2" @click.stop>
<template v-for="(sort, i) in sorts || []" :key="i"> <template v-for="(sort, i) in sorts || []" :key="i">

2
scripts/playwright/pages/Dashboard/Gallery/index.ts

@ -36,7 +36,7 @@ export class GalleryPage extends BasePage {
await this.rootPage.locator(`.nc-fields-menu-btn`).click(); await this.rootPage.locator(`.nc-fields-menu-btn`).click();
await this.rootPage.waitForTimeout(1000); await this.rootPage.waitForTimeout(1000);
await this.rootPage await this.rootPage
.locator(`[pw-data="grid-fields-menu-${title}"]`) .locator(`[pw-data="nc-fields-menu-${title}"]`)
.locator('input[type="checkbox"]') .locator('input[type="checkbox"]')
.click(); .click();
await this.rootPage.waitForTimeout(1000); await this.rootPage.waitForTimeout(1000);

6
scripts/playwright/pages/Dashboard/Grid/index.ts

@ -4,7 +4,7 @@ import { DashboardPage } from "..";
import BasePage from "../../Base"; import BasePage from "../../Base";
import { CellPageObject } from "./Cell"; import { CellPageObject } from "./Cell";
import { ColumnPageObject } from "./Column"; import { ColumnPageObject } from "./Column";
import { ToolbarPage } from "./Toolbar"; import { ToolbarPage } from "../Toolbar";
export class GridPage extends BasePage { export class GridPage extends BasePage {
readonly dashboard: DashboardPage; readonly dashboard: DashboardPage;
@ -20,7 +20,7 @@ export class GridPage extends BasePage {
this.addNewTableButton = dashboardPage.get().locator(".nc-add-new-table"); this.addNewTableButton = dashboardPage.get().locator(".nc-add-new-table");
this.column = new ColumnPageObject(this); this.column = new ColumnPageObject(this);
this.cell = new CellPageObject(this); this.cell = new CellPageObject(this);
this.toolbar = new ToolbarPage(this); this.toolbar = dashboardPage.toolbar;
} }
get() { get() {
@ -263,7 +263,7 @@ export class GridPage extends BasePage {
expect( expect(
await this.cell await this.cell
.get({ index: 0, columnHeader: "City List" }) .get({ index: 0, columnHeader: "City List" })
.locator(".nc-action-icon >> nth=0") .locator(".nc-action-icon.nc-arrow-expand")
).toBeVisible(); ).toBeVisible();
} }
} }

19
scripts/playwright/pages/Dashboard/Grid/Toolbar/Fields.ts → scripts/playwright/pages/Dashboard/Toolbar/Fields.ts

@ -1,5 +1,5 @@
import BasePage from "../../../Base"; import BasePage from "../../Base";
import { ToolbarPage } from "."; import { ToolbarPage } from "./index";
export class ToolbarFieldsPage extends BasePage { export class ToolbarFieldsPage extends BasePage {
readonly toolbar: ToolbarPage; readonly toolbar: ToolbarPage;
@ -10,20 +10,23 @@ export class ToolbarFieldsPage extends BasePage {
} }
get() { get() {
return this.rootPage.locator(`[pw-data="grid-fields-menu"]`); return this.rootPage.locator(`[pw-data="nc-fields-menu"]`);
} }
async toggle({ title }: { title: string }) { async toggle({ title }: { title: string }) {
await this.toolbar.clickFields(); await this.toolbar.clickFields();
await this.get() await this.get()
.locator(`[pw-data="grid-fields-menu-${title}"]`) .locator(`[pw-data="nc-fields-menu-${title}"]`)
.locator('input[type="checkbox"]') .locator('input[type="checkbox"]')
.click(); .click();
await this.toolbar.clickFields(); await this.toolbar.clickFields();
} }
async click({ title}: { title: string }) { async click({ title }: { title: string }) {
await this.get().locator(`[pw-data="grid-fields-menu-${title}"]`).locator('input[type="checkbox"]').click(); await this.get()
await this.toolbar.grid.waitLoading(); .locator(`[pw-data="nc-fields-menu-${title}"]`)
.locator('input[type="checkbox"]')
.click();
await this.toolbar.waitLoading();
} }
} }

10
scripts/playwright/pages/Dashboard/Grid/Toolbar/Filter.ts → scripts/playwright/pages/Dashboard/Toolbar/Filter.ts

@ -1,5 +1,5 @@
import BasePage from "../../../Base"; import BasePage from "../../Base";
import { ToolbarPage } from "."; import { ToolbarPage } from "./index";
export class ToolbarFilterPage extends BasePage { export class ToolbarFilterPage extends BasePage {
readonly toolbar: ToolbarPage; readonly toolbar: ToolbarPage;
@ -10,7 +10,7 @@ export class ToolbarFilterPage extends BasePage {
} }
get() { get() {
return this.rootPage.locator(`[pw-data="grid-filter-menu"]`); return this.rootPage.locator(`[pw-data="nc-filter-menu"]`);
} }
async addNew({ async addNew({
@ -41,12 +41,12 @@ export class ToolbarFilterPage extends BasePage {
await this.rootPage.locator(".nc-filter-value-select").last().fill(value); await this.rootPage.locator(".nc-filter-value-select").last().fill(value);
await this.toolbar.clickFilter(); await this.toolbar.clickFilter();
await this.toolbar.grid.waitLoading(); await this.toolbar.waitLoading();
} }
click({ title }: { title: string }) { click({ title }: { title: string }) {
return this.get() return this.get()
.locator(`[pw-data="grid-fields-menu-${title}"]`) .locator(`[pw-data="nc-fields-menu-${title}"]`)
.locator('input[type="checkbox"]') .locator('input[type="checkbox"]')
.click(); .click();
} }

4
scripts/playwright/pages/Dashboard/Grid/Toolbar/ShareView.ts → scripts/playwright/pages/Dashboard/Toolbar/ShareView.ts

@ -1,5 +1,5 @@
import BasePage from "../../../Base"; import BasePage from "../../Base";
import { ToolbarPage } from "."; import { ToolbarPage } from "./index";
export class ToolbarShareViewPage extends BasePage { export class ToolbarShareViewPage extends BasePage {
readonly toolbar: ToolbarPage; readonly toolbar: ToolbarPage;

10
scripts/playwright/pages/Dashboard/Grid/Toolbar/Sort.ts → scripts/playwright/pages/Dashboard/Toolbar/Sort.ts

@ -1,5 +1,5 @@
import BasePage from "../../../Base"; import BasePage from "../../Base";
import { ToolbarPage } from "."; import { ToolbarPage } from "./index";
export class ToolbarSortPage extends BasePage { export class ToolbarSortPage extends BasePage {
readonly toolbar: ToolbarPage; readonly toolbar: ToolbarPage;
@ -10,7 +10,7 @@ export class ToolbarSortPage extends BasePage {
} }
get() { get() {
return this.rootPage.locator(`[pw-data="grid-sorts-menu"]`); return this.rootPage.locator(`[pw-data="nc-sorts-menu"]`);
} }
async addSort({ async addSort({
@ -41,7 +41,7 @@ export class ToolbarSortPage extends BasePage {
// close sort menu // close sort menu
await this.toolbar.clickSort(); await this.toolbar.clickSort();
await this.toolbar.grid.waitLoading(); await this.toolbar.waitLoading();
} }
async resetSort() { async resetSort() {
@ -56,7 +56,7 @@ export class ToolbarSortPage extends BasePage {
click({ title }: { title: string }) { click({ title }: { title: string }) {
return this.get() return this.get()
.locator(`[pw-data="grid-fields-menu-${title}"]`) .locator(`[pw-data="nc-fields-menu-${title}"]`)
.locator('input[type="checkbox"]') .locator('input[type="checkbox"]')
.click(); .click();
} }

6
scripts/playwright/pages/Dashboard/Grid/Toolbar/ViewMenu.ts → scripts/playwright/pages/Dashboard/Toolbar/ViewMenu.ts

@ -1,6 +1,6 @@
import { Locator, expect } from "@playwright/test"; import { Locator, expect } from "@playwright/test";
import BasePage from "../../../Base"; import BasePage from "../../Base";
import { ToolbarPage } from "."; import { ToolbarPage } from "./index";
export class ToolbarViewMenuPage extends BasePage { export class ToolbarViewMenuPage extends BasePage {
readonly toolbar: ToolbarPage; readonly toolbar: ToolbarPage;
@ -55,7 +55,7 @@ export class ToolbarViewMenuPage extends BasePage {
break; break;
} }
} }
await this.toolbar.grid.waitLoading(); await this.toolbar.waitLoading();
} }
async verifyLockMode() { async verifyLockMode() {

22
scripts/playwright/pages/Dashboard/Grid/Toolbar/index.ts → scripts/playwright/pages/Dashboard/Toolbar/index.ts

@ -1,29 +1,32 @@
import { expect } from "@playwright/test"; import { expect } from "@playwright/test";
import BasePage from "../../../Base"; import BasePage from "../../Base";
import { GridPage } from "..";
import { ToolbarFieldsPage } from "./Fields"; import { ToolbarFieldsPage } from "./Fields";
import { ToolbarSortPage } from "./Sort"; import { ToolbarSortPage } from "./Sort";
import { ToolbarFilterPage } from "./Filter"; import { ToolbarFilterPage } from "./Filter";
import { ToolbarShareViewPage } from "./ShareView"; import { ToolbarShareViewPage } from "./ShareView";
import { ToolbarViewMenuPage } from "./ViewMenu"; import { ToolbarViewMenuPage } from "./ViewMenu";
import * as fs from "fs"; import * as fs from "fs";
import { DashboardPage } from "..";
import { GridPage } from "../Grid";
export class ToolbarPage extends BasePage { export class ToolbarPage extends BasePage {
readonly grid: GridPage; readonly dashboard: DashboardPage;
readonly fields: ToolbarFieldsPage; readonly fields: ToolbarFieldsPage;
readonly sort: ToolbarSortPage; readonly sort: ToolbarSortPage;
readonly filter: ToolbarFilterPage; readonly filter: ToolbarFilterPage;
readonly shareView: ToolbarShareViewPage; readonly shareView: ToolbarShareViewPage;
readonly viewsMenu: ToolbarViewMenuPage; readonly viewsMenu: ToolbarViewMenuPage;
readonly grid: GridPage;
constructor(grid: GridPage) { constructor(dashboard: DashboardPage) {
super(grid.rootPage); super(dashboard.rootPage);
this.grid = grid; this.dashboard = dashboard;
this.fields = new ToolbarFieldsPage(this); this.fields = new ToolbarFieldsPage(this);
this.sort = new ToolbarSortPage(this); this.sort = new ToolbarSortPage(this);
this.filter = new ToolbarFilterPage(this); this.filter = new ToolbarFilterPage(this);
this.shareView = new ToolbarShareViewPage(this); this.shareView = new ToolbarShareViewPage(this);
this.viewsMenu = new ToolbarViewMenuPage(this); this.viewsMenu = new ToolbarViewMenuPage(this);
this.grid = dashboard.grid;
} }
get() { get() {
@ -96,4 +99,11 @@ export class ToolbarPage extends BasePage {
.locator(`.nc-toolbar-btn.nc-actions-menu-btn`) .locator(`.nc-toolbar-btn.nc-actions-menu-btn`)
.waitFor({ state: "hidden" }); .waitFor({ state: "hidden" });
} }
async waitLoading() {
await this.dashboard
.get()
.locator('[pw-data="grid-load-spinner"]')
.waitFor({ state: "hidden" });
}
} }

3
scripts/playwright/pages/Dashboard/index.ts

@ -10,6 +10,7 @@ import { TreeViewPage } from "./TreeView";
import { SettingsPage } from "./Settings"; import { SettingsPage } from "./Settings";
import { ViewSidebarPage } from "./ViewSidebar"; import { ViewSidebarPage } from "./ViewSidebar";
import { GalleryPage } from "./Gallery"; import { GalleryPage } from "./Gallery";
import { ToolbarPage } from "./Toolbar";
export class DashboardPage extends BasePage { export class DashboardPage extends BasePage {
readonly project: any; readonly project: any;
@ -24,6 +25,7 @@ export class DashboardPage extends BasePage {
readonly linkRecord: LinkRecord; readonly linkRecord: LinkRecord;
readonly settings: SettingsPage; readonly settings: SettingsPage;
readonly viewSidebar: ViewSidebarPage; readonly viewSidebar: ViewSidebarPage;
readonly toolbar: ToolbarPage;
constructor(rootPage: Page, project: any) { constructor(rootPage: Page, project: any) {
super(rootPage); super(rootPage);
@ -39,6 +41,7 @@ export class DashboardPage extends BasePage {
this.linkRecord = new LinkRecord(this); this.linkRecord = new LinkRecord(this);
this.settings = new SettingsPage(this); this.settings = new SettingsPage(this);
this.viewSidebar = new ViewSidebarPage(this); this.viewSidebar = new ViewSidebarPage(this);
this.toolbar = new ToolbarPage(this);
} }
get() { get() {

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

@ -53,7 +53,7 @@ test.describe("LTAR create & update", () => {
// Expanded form insert // Expanded form insert
await dashboard.grid.toolbar.clickAddNewRow(); await dashboard.toolbar.clickAddNewRow();
await dashboard.expandedForm.fillField({ await dashboard.expandedForm.fillField({
columnTitle: "Title", columnTitle: "Title",
value: "2a", value: "2a",

215
scripts/playwright/tests/metaSync.spec.ts

@ -1,71 +1,111 @@
import { test } from '@playwright/test'; import { test } from "@playwright/test";
import { DashboardPage } from '../pages/Dashboard'; import { DashboardPage } from "../pages/Dashboard";
import { SettingsPage } from '../pages/Dashboard/Settings'; import { SettingsPage } from "../pages/Dashboard/Settings";
import setup, { NcContext } from '../setup'; import setup, { NcContext } from "../setup";
import { isSqlite, mysqlExec, sqliteExec } from '../setup/db'; import { isSqlite, mysqlExec, sqliteExec } from "../setup/db";
// todo: Enable when view bug is fixed // todo: Enable when view bug is fixed
test.describe('Meta sync', () => { test.describe("Meta sync", () => {
let dashboard: DashboardPage; let dashboard: DashboardPage;
let settings: SettingsPage; let settings: SettingsPage;
let context: NcContext; let context: NcContext;
let dbExec; let dbExec;
let projectPrefix; let projectPrefix;
test.beforeEach(async ({page}) => { test.beforeEach(async ({ page }) => {
context = await setup({ page }); context = await setup({ page });
dashboard = new DashboardPage(page, context.project); dashboard = new DashboardPage(page, context.project);
settings = dashboard.settings; settings = dashboard.settings;
switch (context.dbType) { switch (context.dbType) {
case 'sqlite': case "sqlite":
dbExec = sqliteExec; dbExec = sqliteExec;
break; break;
case 'mysql': case "mysql":
dbExec = mysqlExec; dbExec = mysqlExec;
break; break;
} }
projectPrefix = isSqlite(context) ? context.project.prefix: ''; projectPrefix = isSqlite(context) ? context.project.prefix : "";
}) });
test('Meta sync', async () => { test("Meta sync", async () => {
test.setTimeout(process.env.CI ? 100000 : 70000); test.setTimeout(process.env.CI ? 100000 : 70000);
await dashboard.gotoSettings(); await dashboard.gotoSettings();
await settings.selectTab({title: 'Project Metadata'}); await settings.selectTab({ title: "Project Metadata" });
await dbExec(`CREATE TABLE ${projectPrefix}table1 (id INT NOT NULL, col1 INT NULL, PRIMARY KEY (id))`); await dbExec(
await dbExec(`CREATE TABLE ${projectPrefix}table2 (id INT NOT NULL, col1 INT NULL, PRIMARY KEY (id))`); `CREATE TABLE ${projectPrefix}table1 (id INT NOT NULL, col1 INT NULL, PRIMARY KEY (id))`
);
await dbExec(
`CREATE TABLE ${projectPrefix}table2 (id INT NOT NULL, col1 INT NULL, PRIMARY KEY (id))`
);
await settings.metaData.clickReload(); await settings.metaData.clickReload();
await settings.metaData.verifyRow({index: 16, model: `${projectPrefix}table1`, state: 'New table'}); await settings.metaData.verifyRow({
await settings.metaData.verifyRow({index: 17, model: `${projectPrefix}table2`, state: 'New table'}); index: 16,
model: `${projectPrefix}table1`,
state: "New table",
});
await settings.metaData.verifyRow({
index: 17,
model: `${projectPrefix}table2`,
state: "New table",
});
await settings.metaData.sync(); await settings.metaData.sync();
await settings.metaData.verifyRow({index: 16, model: 'Table1', state: 'No change identified'}); await settings.metaData.verifyRow({
await settings.metaData.verifyRow({index: 17, model: 'Table2', state: 'No change identified'}); index: 16,
model: "Table1",
if(!isSqlite(context)) { state: "No change identified",
});
await settings.metaData.verifyRow({
index: 17,
model: "Table2",
state: "No change identified",
});
if (!isSqlite(context)) {
// Add relation // Add relation
await dbExec(`ALTER TABLE ${projectPrefix}table1 ADD INDEX fk1_idx (col1 ASC) VISIBLE`); await dbExec(
await dbExec(`ALTER TABLE ${projectPrefix}table1 ADD CONSTRAINT fk1 FOREIGN KEY (col1) REFERENCES ${projectPrefix}table2 (id) ON DELETE NO ACTION ON UPDATE NO ACTION`); `ALTER TABLE ${projectPrefix}table1 ADD INDEX fk1_idx (col1 ASC) VISIBLE`
);
await dbExec(
`ALTER TABLE ${projectPrefix}table1 ADD CONSTRAINT fk1 FOREIGN KEY (col1) REFERENCES ${projectPrefix}table2 (id) ON DELETE NO ACTION ON UPDATE NO ACTION`
);
await settings.metaData.clickReload(); await settings.metaData.clickReload();
await settings.metaData.verifyRow({index: 16, model: 'Table1', state: 'New relation added'}); await settings.metaData.verifyRow({
index: 16,
model: "Table1",
state: "New relation added",
});
//verify after sync //verify after sync
await settings.metaData.sync(); await settings.metaData.sync();
await settings.metaData.verifyRow({index: 16, model: 'Table1', state: 'No change identified'}); await settings.metaData.verifyRow({
index: 16,
model: "Table1",
state: "No change identified",
});
// Remove relation // Remove relation
await dbExec(`ALTER TABLE ${projectPrefix}table1 DROP FOREIGN KEY fk1`); await dbExec(`ALTER TABLE ${projectPrefix}table1 DROP FOREIGN KEY fk1`);
await dbExec(`ALTER TABLE ${projectPrefix}table1 DROP INDEX fk1_idx`); await dbExec(`ALTER TABLE ${projectPrefix}table1 DROP INDEX fk1_idx`);
await settings.metaData.clickReload(); await settings.metaData.clickReload();
await settings.metaData.verifyRow({index: 16, model: 'Table1', state: "Relation removed"}); await settings.metaData.verifyRow({
index: 16,
model: "Table1",
state: "Relation removed",
});
//verify after sync //verify after sync
await settings.metaData.sync(); await settings.metaData.sync();
await settings.metaData.verifyRow({index: 16, model: 'Table1', state: 'No change identified'}); await settings.metaData.verifyRow({
index: 16,
model: "Table1",
state: "No change identified",
});
} }
// Add column // Add column
@ -73,81 +113,138 @@ test.describe('Meta sync', () => {
isSqlite(context) isSqlite(context)
? `ALTER TABLE ${projectPrefix}table1 ADD COLUMN newCol TEXT NULL` ? `ALTER TABLE ${projectPrefix}table1 ADD COLUMN newCol TEXT NULL`
: `ALTER TABLE ${projectPrefix}table1 ADD COLUMN newCol VARCHAR(45) NULL AFTER id` : `ALTER TABLE ${projectPrefix}table1 ADD COLUMN newCol VARCHAR(45) NULL AFTER id`
); );
await settings.metaData.clickReload(); await settings.metaData.clickReload();
await settings.metaData.verifyRow({index: 16, model: `Table1`, state: 'New column(newCol)'}); await settings.metaData.verifyRow({
index: 16,
model: `Table1`,
state: "New column(newCol)",
});
//verify after sync //verify after sync
await settings.metaData.sync(); await settings.metaData.sync();
await settings.metaData.verifyRow({index: 16, model: 'Table1', state: 'No change identified'}); await settings.metaData.verifyRow({
index: 16,
model: "Table1",
state: "No change identified",
});
// Edit column // Edit column
await dbExec( await dbExec(
isSqlite(context) isSqlite(context)
? `ALTER TABLE ${projectPrefix}table1 RENAME COLUMN newCol TO newColName` ? `ALTER TABLE ${projectPrefix}table1 RENAME COLUMN newCol TO newColName`
: `ALTER TABLE ${projectPrefix}table1 CHANGE COLUMN newCol newColName VARCHAR(45) NULL DEFAULT NULL` : `ALTER TABLE ${projectPrefix}table1 CHANGE COLUMN newCol newColName VARCHAR(45) NULL DEFAULT NULL`
); );
await settings.metaData.clickReload(); await settings.metaData.clickReload();
await settings.metaData.verifyRow({index: 16, model: `Table1`, state: 'New column(newColName), Column removed(newCol)'}); await settings.metaData.verifyRow({
index: 16,
model: `Table1`,
state: "New column(newColName), Column removed(newCol)",
});
//verify after sync //verify after sync
await settings.metaData.sync(); await settings.metaData.sync();
await settings.metaData.verifyRow({index: 16, model: 'Table1', state: 'No change identified'}); await settings.metaData.verifyRow({
index: 16,
model: "Table1",
state: "No change identified",
});
// Delete column // Delete column
// todo: Add for sqlite // todo: Add for sqlite
if(!isSqlite(context)) { if (!isSqlite(context)) {
await dbExec(`ALTER TABLE ${projectPrefix}table1 DROP COLUMN newColName`); await dbExec(`ALTER TABLE ${projectPrefix}table1 DROP COLUMN newColName`);
await settings.metaData.clickReload(); await settings.metaData.clickReload();
await settings.metaData.verifyRow({index: 16, model: `Table1`, state: 'Column removed(newColName)'}); await settings.metaData.verifyRow({
index: 16,
model: `Table1`,
state: "Column removed(newColName)",
});
//verify after sync //verify after sync
await settings.metaData.sync(); await settings.metaData.sync();
await settings.metaData.verifyRow({index: 16, model: 'Table1', state: 'No change identified'}); await settings.metaData.verifyRow({
index: 16,
model: "Table1",
state: "No change identified",
});
} }
// Delete table // Delete table
await dbExec(`DROP TABLE ${projectPrefix}table1`); await dbExec(`DROP TABLE ${projectPrefix}table1`);
await dbExec(`DROP TABLE ${projectPrefix}table2`); await dbExec(`DROP TABLE ${projectPrefix}table2`);
await settings.metaData.clickReload(); await settings.metaData.clickReload();
await settings.metaData.verifyRow({index: 16, model: `${projectPrefix}table1`, state: "Table removed"}); await settings.metaData.verifyRow({
await settings.metaData.verifyRow({index: 17, model: `${projectPrefix}table2`, state: "Table removed"}); index: 16,
model: `${projectPrefix}table1`,
state: "Table removed",
});
await settings.metaData.verifyRow({
index: 17,
model: `${projectPrefix}table2`,
state: "Table removed",
});
//verify after sync //verify after sync
await settings.metaData.sync(); await settings.metaData.sync();
if(isSqlite(context)) { if (isSqlite(context)) {
await settings.metaData.verifyRow({index: 16, model: 'CustomerList', state: 'No change identified'}); await settings.metaData.verifyRow({
await settings.metaData.verifyRow({index: 17, model: 'FilmList', state: 'No change identified'}); index: 16,
model: "CustomerList",
state: "No change identified",
});
await settings.metaData.verifyRow({
index: 17,
model: "FilmList",
state: "No change identified",
});
} else { } else {
await settings.metaData.verifyRow({index: 16, model: 'ActorInfo', state: 'No change identified'}); await settings.metaData.verifyRow({
await settings.metaData.verifyRow({index: 17, model: 'CustomerList', state: 'No change identified'}); index: 16,
model: "ActorInfo",
state: "No change identified",
});
await settings.metaData.verifyRow({
index: 17,
model: "CustomerList",
state: "No change identified",
});
} }
}); });
test('Hide, filter, sort', async() => { test("Hide, filter, sort", async () => {
await dbExec(`CREATE TABLE ${projectPrefix}table1 (id INT NOT NULL, col1 INT NULL, col2 INT NULL, col3 INT NULL, col4 INT NULL, PRIMARY KEY (id))`); await dbExec(
await dbExec(`INSERT INTO ${projectPrefix}table1 (id, col1, col2, col3, col4) VALUES (1,1,1,1,1), (2,2,2,2,2), (3,3,3,3,3), (4,4,4,4,4), (5,5,5,5,5), (6,6,6,6,6), (7,7,7,7,7), (8,8,8,8,8), (9,9,9,9,9);`); `CREATE TABLE ${projectPrefix}table1 (id INT NOT NULL, col1 INT NULL, col2 INT NULL, col3 INT NULL, col4 INT NULL, PRIMARY KEY (id))`
);
await dbExec(
`INSERT INTO ${projectPrefix}table1 (id, col1, col2, col3, col4) VALUES (1,1,1,1,1), (2,2,2,2,2), (3,3,3,3,3), (4,4,4,4,4), (5,5,5,5,5), (6,6,6,6,6), (7,7,7,7,7), (8,8,8,8,8), (9,9,9,9,9);`
);
await dashboard.gotoSettings(); await dashboard.gotoSettings();
await settings.selectTab({title: 'Project Metadata'}); await settings.selectTab({ title: "Project Metadata" });
await settings.metaData.clickReload(); await settings.metaData.clickReload();
await settings.metaData.sync(); await settings.metaData.sync();
await settings.close(); await settings.close();
await dashboard.treeView.openTable({title: 'Table1'}); await dashboard.treeView.openTable({ title: "Table1" });
await dashboard.grid.toolbar.clickFields();
await dashboard.grid.toolbar.fields.click({title: 'Col1'});
await dashboard.grid.toolbar.clickFields();
await dashboard.grid.toolbar.sort.addSort({columnTitle: 'Col1', isAscending: false}); await dashboard.toolbar.clickFields();
await dashboard.toolbar.fields.click({ title: "Col1" });
await dashboard.toolbar.clickFields();
await dashboard.grid.toolbar.filter.addNew({columnTitle: 'Col1', opType: '>=', value: '5'}); await dashboard.toolbar.sort.addSort({
columnTitle: "Col1",
isAscending: false,
});
await dashboard.grid.verifyRowCount({count: 5}); await dashboard.toolbar.filter.addNew({
}) columnTitle: "Col1",
opType: ">=",
value: "5",
});
await dashboard.grid.verifyRowCount({ count: 5 });
});
}); });

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

@ -1,9 +1,10 @@
import { test } from "@playwright/test"; import { test } from "@playwright/test";
import { DashboardPage } from "../pages/Dashboard"; import { DashboardPage } from "../pages/Dashboard";
import setup from "../setup"; import setup from "../setup";
import { ToolbarPage } from "../pages/Dashboard/Toolbar";
test.describe.only("Toolbar operations (GRID)", () => { test.describe("Toolbar operations (GRID)", () => {
let dashboard: DashboardPage; let dashboard: DashboardPage, toolbar: ToolbarPage;
let context: any; let context: any;
async function validateFirstRow(value: string) { async function validateFirstRow(value: string) {
@ -17,6 +18,7 @@ test.describe.only("Toolbar operations (GRID)", () => {
test.beforeEach(async ({ page }) => { test.beforeEach(async ({ page }) => {
context = await setup({ page }); context = await setup({ page });
dashboard = new DashboardPage(page, context.project); dashboard = new DashboardPage(page, context.project);
toolbar = dashboard.toolbar;
}); });
test("Hide, Sort, Filter", async () => { test("Hide, Sort, Filter", async () => {
@ -24,7 +26,6 @@ test.describe.only("Toolbar operations (GRID)", () => {
await dashboard.closeTab({ title: "Team & Auth" }); await dashboard.closeTab({ title: "Team & Auth" });
await dashboard.treeView.openTable({ title: "Country" }); await dashboard.treeView.openTable({ title: "Country" });
const toolbar = dashboard.grid.toolbar;
await dashboard.grid.column.verify({ await dashboard.grid.column.verify({
title: "LastUpdate", title: "LastUpdate",

10
scripts/playwright/tests/viewGridLocked.spec.ts

@ -16,23 +16,23 @@ test.describe("Grid view locked", () => {
await dashboard.closeTab({ title: "Team & Auth" }); await dashboard.closeTab({ title: "Team & Auth" });
await dashboard.treeView.openTable({ title: "Country" }); await dashboard.treeView.openTable({ title: "Country" });
await dashboard.grid.toolbar.viewsMenu.verifyCollaborativeMode(); await dashboard.toolbar.viewsMenu.verifyCollaborativeMode();
// enable view lock // enable view lock
await dashboard.grid.toolbar.viewsMenu.click({ await dashboard.toolbar.viewsMenu.click({
menu: "Collaborative View", menu: "Collaborative View",
subMenu: "Locked View", subMenu: "Locked View",
}); });
// verify view lock // verify view lock
await dashboard.grid.toolbar.viewsMenu.verifyLockMode(); await dashboard.toolbar.viewsMenu.verifyLockMode();
// enable collaborative view // enable collaborative view
await dashboard.grid.toolbar.viewsMenu.click({ await dashboard.toolbar.viewsMenu.click({
menu: "Locked View", menu: "Locked View",
subMenu: "Collaborative View", subMenu: "Collaborative View",
}); });
await dashboard.grid.toolbar.viewsMenu.verifyCollaborativeMode(); await dashboard.toolbar.viewsMenu.verifyCollaborativeMode();
}); });
}); });

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

@ -31,14 +31,14 @@ test.describe("Shared view", () => {
await dashboard.treeView.openTable({ title: "Address" }); await dashboard.treeView.openTable({ title: "Address" });
// hide column // hide column
await dashboard.grid.toolbar.fields.toggle({ title: "Address2" }); await dashboard.toolbar.fields.toggle({ title: "Address2" });
// sort // sort
await dashboard.grid.toolbar.sort.addSort({ await dashboard.toolbar.sort.addSort({
columnTitle: "District", columnTitle: "District",
isAscending: false, isAscending: false,
}); });
// filter // filter
await dashboard.grid.toolbar.filter.addNew({ await dashboard.toolbar.filter.addNew({
columnTitle: "Address", columnTitle: "Address",
value: "Ab", value: "Ab",
opType: "is like", opType: "is like",
@ -47,8 +47,8 @@ test.describe("Shared view", () => {
mainPageLink = page.url(); mainPageLink = page.url();
// share with password disabled, download enabled // share with password disabled, download enabled
await dashboard.grid.toolbar.clickShareView(); await dashboard.toolbar.clickShareView();
sharedLink = await dashboard.grid.toolbar.shareView.getShareLink(); sharedLink = await dashboard.toolbar.shareView.getShareLink();
/** /**
* 2. Access shared view: verify * 2. Access shared view: verify
@ -182,13 +182,13 @@ test.describe("Shared view", () => {
await dashboard.treeView.openTable({ title: "Country" }); await dashboard.treeView.openTable({ title: "Country" });
// enable password & verify share link // enable password & verify share link
await dashboard.grid.toolbar.clickShareView(); await dashboard.toolbar.clickShareView();
await dashboard.grid.toolbar.shareView.enablePassword("p@ssword"); await dashboard.toolbar.shareView.enablePassword("p@ssword");
// disable download // disable download
await dashboard.grid.toolbar.shareView.toggleDownload(); await dashboard.toolbar.shareView.toggleDownload();
sharedLink = await dashboard.grid.toolbar.shareView.getShareLink(); sharedLink = await dashboard.toolbar.shareView.getShareLink();
await dashboard.grid.toolbar.shareView.close(); await dashboard.toolbar.shareView.close();
// add new column, record after share view creation // add new column, record after share view creation
await dashboard.grid.column.create({ await dashboard.grid.column.create({

Loading…
Cancel
Save