mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
97 lines
3.1 KiB
97 lines
3.1 KiB
2 years ago
|
import { expect } from '@playwright/test';
|
||
2 years ago
|
import BasePage from '../../Base';
|
||
|
|
||
|
export abstract class ErdBasePage extends BasePage {
|
||
|
vueFlow() {
|
||
|
return this.get().locator('.vue-flow__viewport');
|
||
|
}
|
||
|
|
||
|
async clickShowColumnNames() {
|
||
|
await this.get().locator(`.nc-erd-showColumns-checkbox`).click();
|
||
|
(await this.vueFlow().elementHandle())?.waitForElementState('stable');
|
||
|
}
|
||
|
|
||
|
async dbClickShowColumnNames() {
|
||
|
await this.get().locator(`.nc-erd-showColumns-label`).dblclick();
|
||
|
(await this.vueFlow().elementHandle())?.waitForElementState('stable');
|
||
|
}
|
||
|
|
||
|
async clickShowPkAndFk() {
|
||
|
await this.get().locator(`.nc-erd-showPkAndFk-checkbox`).click();
|
||
|
(await this.vueFlow().elementHandle())?.waitForElementState('stable');
|
||
|
}
|
||
|
|
||
|
async clickShowSqlViews() {
|
||
|
await this.get().locator(`.nc-erd-showViews-checkbox`).click();
|
||
|
(await this.vueFlow().elementHandle())?.waitForElementState('stable');
|
||
|
}
|
||
|
|
||
|
async clickShowMMTables() {
|
||
|
await this.get().locator(`.nc-erd-showMMTables-checkbox`).click();
|
||
|
(await this.vueFlow().elementHandle())?.waitForElementState('stable');
|
||
|
}
|
||
|
|
||
|
async clickShowJunctionTableNames() {
|
||
|
await this.get().locator(`.nc-erd-showJunctionTableNames-checkbox`).click();
|
||
|
(await this.vueFlow().elementHandle())?.waitForElementState('stable');
|
||
|
}
|
||
|
|
||
|
async verifyEasterEggNotShown() {
|
||
2 years ago
|
await expect(await this.get().locator('.nc-erd-showMMTables-checkbox')).not.toBeVisible();
|
||
2 years ago
|
}
|
||
|
|
||
2 years ago
|
async verifyNode({
|
||
|
tableName,
|
||
|
columnName,
|
||
|
columnNameShouldNotExist,
|
||
|
}: {
|
||
|
tableName: string;
|
||
|
columnName?: string;
|
||
|
columnNameShouldNotExist?: string;
|
||
|
}) {
|
||
|
await this.get().locator(`.nc-erd-table-node-${tableName}`).waitFor({ state: 'visible' });
|
||
2 years ago
|
if (columnName) {
|
||
2 years ago
|
await this.get().locator(`.nc-erd-table-node-${tableName}-column-${columnName}`).waitFor({ state: 'visible' });
|
||
2 years ago
|
}
|
||
2 years ago
|
if (columnNameShouldNotExist) {
|
||
|
await this.get()
|
||
|
.locator(`.nc-erd-table-node-${tableName}-column-${columnNameShouldNotExist}`)
|
||
|
.waitFor({ state: 'hidden' });
|
||
2 years ago
|
}
|
||
|
}
|
||
|
|
||
2 years ago
|
async verifyNodeDoesNotExist({ tableName }: { tableName: string }) {
|
||
|
await this.get().locator(`.nc-erd-table-node-${tableName}`).waitFor({ state: 'hidden' });
|
||
2 years ago
|
}
|
||
|
|
||
2 years ago
|
async verifyColumns({ tableName, columns }: { tableName: string; columns: string[] }) {
|
||
2 years ago
|
for (const column of columns) {
|
||
2 years ago
|
await this.verifyNode({ tableName, columnName: column });
|
||
2 years ago
|
}
|
||
|
}
|
||
|
|
||
|
async verifyNodesCount(count: number) {
|
||
2 years ago
|
await expect(this.get().locator('.nc-erd-table-node')).toHaveCount(count);
|
||
2 years ago
|
}
|
||
|
|
||
|
async verifyEdgesCount({
|
||
|
count,
|
||
|
circleCount,
|
||
|
rectangleCount,
|
||
|
}: {
|
||
|
count: number;
|
||
|
circleCount: number;
|
||
|
rectangleCount: number;
|
||
|
}) {
|
||
2 years ago
|
await expect(this.get().locator('.vue-flow__edge')).toHaveCount(count);
|
||
|
await expect(this.get().locator('.nc-erd-edge-circle')).toHaveCount(circleCount);
|
||
|
await expect(this.get().locator('.nc-erd-edge-rect')).toHaveCount(rectangleCount);
|
||
2 years ago
|
}
|
||
|
|
||
2 years ago
|
async verifyJunctionTableLabel({ tableTitle, tableName }: { tableName: string; tableTitle: string }) {
|
||
2 years ago
|
await this.vueFlow().locator(`.nc-erd-table-label-${tableTitle}-${tableName}`).waitFor({
|
||
2 years ago
|
state: 'visible',
|
||
2 years ago
|
});
|
||
2 years ago
|
}
|
||
2 years ago
|
}
|