mirror of https://github.com/nocodb/nocodb
8 changed files with 165 additions and 4 deletions
@ -0,0 +1,45 @@
|
||||
// playwright-dev-page.ts
|
||||
import { Page, expect } from '@playwright/test'; |
||||
import { SettingsPage } from '.'; |
||||
|
||||
export class AuditSettingsPage { |
||||
private readonly settings: SettingsPage; |
||||
|
||||
constructor(settings: SettingsPage) { |
||||
this.settings = settings; |
||||
} |
||||
|
||||
async verifyRow( |
||||
{index, opType, opSubtype, description, user, created}:
|
||||
{index: number,opType?: string, opSubtype?: string, description?: string, user?: string, created?: string} |
||||
) { |
||||
const table = await this.settings.get().locator(`div[data-pw="audit-tab-table"]`); |
||||
const row = table.locator(`tr.ant-table-row`).nth(index); |
||||
|
||||
if(opType) { |
||||
await row.locator(`td.ant-table-cell`).nth(0).textContent() |
||||
.then((text) => expect(text).toContain(opType)); |
||||
} |
||||
|
||||
if(opSubtype) { |
||||
await row.locator(`td.ant-table-cell`).nth(1).textContent() |
||||
.then((text) => expect(text).toContain(opSubtype)); |
||||
} |
||||
|
||||
if(description) { |
||||
await row.locator(`td.ant-table-cell`).nth(2).textContent() |
||||
.then((text) => expect(text).toContain(description)); |
||||
} |
||||
|
||||
if(user) { |
||||
await row.locator(`td.ant-table-cell`).nth(3).textContent() |
||||
.then((text) => expect(text).toContain(user)); |
||||
} |
||||
|
||||
if(created) { |
||||
await row.locator(`td.ant-table-cell`).nth(4).textContent() |
||||
.then((text) => expect(text).toContain(created)); |
||||
} |
||||
|
||||
} |
||||
} |
@ -0,0 +1,33 @@
|
||||
// playwright-dev-page.ts
|
||||
import { Page } from '@playwright/test'; |
||||
import { AuditSettingsPage } from './Audit'; |
||||
|
||||
const tabInfo = { |
||||
'Team & Auth': 'teamAndAuth', |
||||
'App Store': 'appStore', |
||||
'Project Metadata': 'projMetaData', |
||||
'Audit': 'audit', |
||||
} |
||||
|
||||
|
||||
export class SettingsPage { |
||||
private readonly page: Page; |
||||
readonly audit: AuditSettingsPage; |
||||
|
||||
constructor(page: Page) { |
||||
this.page = page; |
||||
this.audit = new AuditSettingsPage(this); |
||||
} |
||||
|
||||
get() { |
||||
return this.page.locator('.nc-modal-settings'); |
||||
} |
||||
|
||||
async selectTab({title}: {title: string}) { |
||||
await this.page.locator(`li[data-menu-id="${tabInfo[title]}"]`).click(); |
||||
} |
||||
|
||||
async close() { |
||||
await this.page.locator('[pw-data="settings-modal-close-button"]').click(); |
||||
} |
||||
} |
@ -0,0 +1,34 @@
|
||||
import { test } from '@playwright/test'; |
||||
import { DashboardPage } from '../pages/Dashboard'; |
||||
import { SettingsPage } from '../pages/Settings'; |
||||
import setup from '../setup'; |
||||
|
||||
|
||||
test.describe('Table Operations', () => { |
||||
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, and rename City table', async () => { |
||||
await dashboard.createTable({title: "tablex"}); |
||||
await dashboard.verifyTableExistsInSidebar({title: "tablex"}); |
||||
|
||||
await dashboard.deleteTable({title: "tablex"}); |
||||
await dashboard.verifyTableDoesNotExistInSidebar({title: "tablex"}); |
||||
|
||||
await dashboard.gotoSettings(); |
||||
await settings.selectTab({title: 'Audit'}); |
||||
await settings.audit.verifyRow({index: 0, opType: 'TABLE', opSubtype: 'DELETED', user: 'user@nocodb.com'}); |
||||
await settings.audit.verifyRow({index: 1, opType: 'TABLE', opSubtype: 'CREATED', user: 'user@nocodb.com'}); |
||||
await settings.close(); |
||||
|
||||
await dashboard.renameTable({title: "City", newTitle: "Cityx"}); |
||||
await dashboard.verifyTableExistsInSidebar({title: "Cityx"}); |
||||
}); |
||||
|
||||
}); |
Loading…
Reference in new issue