Browse Source

test: update audit tab opening steps

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/8510/head
Pranav C 6 months ago
parent
commit
f7d3fd72dd
  1. 1
      packages/nc-gui/components/dashboard/TreeView/TableNode.vue
  2. 4
      packages/nc-gui/components/dashboard/settings/DataSources.vue
  3. 9
      tests/playwright/pages/Dashboard/Settings/DataSources.ts
  4. 2
      tests/playwright/pages/Dashboard/TreeView.ts
  5. 6
      tests/playwright/tests/db/general/tableOperations.spec.ts

1
packages/nc-gui/components/dashboard/TreeView/TableNode.vue

@ -331,6 +331,7 @@ const deleteTable = () => {
<NcMenuItem
v-if="isUIAllowed('tableRename', { roles: baseRole })"
:data-testid="`sidebar-table-rename-${table.title}`"
class="nc-table-rename"
@click="openRenameTableDialog(table, base.sources[sourceIndex].id)"
>
<div v-e="['c:table:rename']" class="flex gap-2 items-center">

4
packages/nc-gui/components/dashboard/settings/DataSources.vue

@ -297,7 +297,7 @@ const openedTab = ref('erd')
<LazyDashboardSettingsErd class="h-full overflow-auto" :source-id="activeSource.id" :show-all-columns="false" />
</div>
</a-tab-pane>
<a-tab-pane v-if="activeSource.is_meta || activeSource.is_local" key="audit">
<a-tab-pane v-if="sources && activeSource === sources[0]" key="audit">
<template #tab>
<div class="tab" data-testid="nc-audit-tab">
<div>{{ $t('title.auditLogs') }}</div>
@ -334,7 +334,7 @@ const openedTab = ref('erd')
<LazyDashboardSettingsUIAcl :source-id="activeSource.id" />
</div>
</a-tab-pane>
<a-tab-pane key="meta-sync">
<a-tab-pane v-if="!activeSource.is_meta && !activeSource.is_local" key="meta-sync">
<template #tab>
<div class="tab" data-testid="nc-meta-sync-tab">
<div>{{ $t('labels.metaSync') }}</div>

9
tests/playwright/pages/Dashboard/Settings/DataSources.ts

@ -30,6 +30,15 @@ export class DataSourcesPage extends BasePage {
await row.click();
await this.get().getByTestId('nc-erd-tab').click();
}
async openAudit({ rowIndex }: { rowIndex: number }) {
const row = this.get()
.locator('.ds-table-row')
.nth(rowIndex + 1);
await row.click();
await this.get().getByTestId('nc-audit-tab').click();
}
async openAcl({ dataSourceName = defaultBaseName }: { dataSourceName?: string } = {}) {
await this.get().locator('.ds-table-row', { hasText: dataSourceName }).locator('button:has-text("UI ACL")').click();
}

2
tests/playwright/pages/Dashboard/TreeView.ts

@ -205,7 +205,7 @@ export class TreeViewPage extends BasePage {
await this.waitForTableOptions({ title });
await this.get().locator(`.nc-base-tree-tbl-${tableTitle}`).locator('.nc-tbl-context-menu').click();
await this.rootPage.locator('.ant-dropdown').locator('.nc-menu-item:has-text("Rename")').click();
await this.rootPage.locator('.ant-dropdown').locator('.nc-table-rename.nc-menu-item:has-text("Rename")').click();
await this.dashboard.get().locator('[placeholder="Enter table name"]').fill(newTitle);
await this.dashboard.get().locator('button:has-text("Rename Table")').click();

6
tests/playwright/tests/db/general/tableOperations.spec.ts

@ -32,8 +32,10 @@ test.describe('Table Operations', () => {
// Audit logs in clickhouse; locally wont be accessible
await dashboard.treeView.openProject({ title: context.base.title, context });
await dashboard.baseView.tab_dataSources.click();
await dashboard.baseView.dataSources.openAudit({ rowIndex: 0 });
await dashboard.treeView.baseSettings({ title: context.base.title });
await dashboard.settings.selectTab({ tab: 'dataSources' });
await dashboard.settings.dataSources.openAudit({ rowIndex: 0 });
await audit.verifyRow({
index: 0,

Loading…
Cancel
Save