mirror of https://github.com/nocodb/nocodb
Ramesh Mane
11 months ago
committed by
mertmit
4 changed files with 106 additions and 1 deletions
@ -0,0 +1,47 @@
|
||||
import { ColumnPageObject } from '.'; |
||||
import BasePage from '../../../Base'; |
||||
import { expect } from '@playwright/test'; |
||||
|
||||
export class UserOptionColumnPageObject extends BasePage { |
||||
readonly column: ColumnPageObject; |
||||
|
||||
constructor(column: ColumnPageObject) { |
||||
super(column.rootPage); |
||||
this.column = column; |
||||
} |
||||
|
||||
get() { |
||||
return this.column.get(); |
||||
} |
||||
|
||||
async allowMultipleUser({ columnTitle, allowMultiple = false }: { columnTitle: string; allowMultiple?: boolean }) { |
||||
await this.column.openEdit({ title: columnTitle }); |
||||
const checkbox = this.get().locator('[data-testid="user-column-allow-multiple"]'); |
||||
const isChecked = await checkbox.isChecked(); |
||||
|
||||
if ((isChecked && !allowMultiple) || (!isChecked && allowMultiple)) { |
||||
await checkbox.click(); |
||||
} |
||||
await this.rootPage.waitForTimeout(5000); |
||||
await this.column.save({ isUpdated: true }); |
||||
} |
||||
|
||||
async verifyDefaultValueOptions({ columnTitle, totalCount }: { columnTitle: string; totalCount: number }) { |
||||
await this.column.openEdit({ title: columnTitle }); |
||||
|
||||
await this.column.get().locator('.nc-cell-user').click(); |
||||
|
||||
const userDropdown = this.get().locator('[data-testid="select-option-User-undefined"]'); |
||||
await userDropdown.waitFor({ state: 'visible' }); |
||||
console.log('userDropdown::::', userDropdown); |
||||
|
||||
await expect(userDropdown).toHaveCount(totalCount); |
||||
await this.column.get().locator('.nc-cell-user').click(); |
||||
await this.column.save({ isUpdated: true }); |
||||
} |
||||
async clearDefaultValueOptions({ columnTitle }: { columnTitle: string }) { |
||||
await this.column.openEdit({ title: columnTitle }); |
||||
|
||||
await this.column.get().locator('.nc-cell-user + svg').click(); |
||||
} |
||||
} |
@ -0,0 +1,47 @@
|
||||
import { test } from '@playwright/test'; |
||||
import { DashboardPage } from '../../../pages/Dashboard'; |
||||
import { GridPage } from '../../../pages/Dashboard/Grid'; |
||||
import setup, { unsetup } from '../../../setup'; |
||||
import { TopbarPage } from '../../../pages/Dashboard/common/Topbar'; |
||||
|
||||
test.describe('User single select', () => { |
||||
let dashboard: DashboardPage, grid: GridPage, topbar: TopbarPage; |
||||
let context: any; |
||||
|
||||
test.beforeEach(async ({ page }) => { |
||||
context = await setup({ page, isEmptyProject: false }); |
||||
dashboard = new DashboardPage(page, context.base); |
||||
grid = dashboard.grid; |
||||
topbar = dashboard.grid.topbar; |
||||
|
||||
await dashboard.treeView.createTable({ title: 'sheet1', baseTitle: context.base.title }); |
||||
|
||||
await grid.column.create({ title: 'User', type: 'User' }); |
||||
|
||||
await grid.addNewRow({ index: 0, value: 'Row 0' }); |
||||
}); |
||||
|
||||
test.afterEach(async () => { |
||||
await unsetup(context); |
||||
}); |
||||
|
||||
// test('Verify default value options count and select default value', async () => {
|
||||
// // await dashboard.grid.column.userOption.verifyDefaultValueOptions({ columnTitle: 'User', totalCount: 5 });
|
||||
// await dashboard.grid.column.userOption.allowMultipleUser({ columnTitle: 'User', allowMultiple: true });
|
||||
// });
|
||||
|
||||
test('Rename column title and delete the column', async () => { |
||||
// Update column title, refresh and verify
|
||||
await dashboard.grid.column.openEdit({ title: 'User' }); |
||||
await dashboard.grid.column.fillTitle({ title: 'UserField' }); |
||||
await dashboard.grid.column.save({ |
||||
isUpdated: true, |
||||
}); |
||||
await topbar.clickRefresh(); |
||||
await grid.column.verify({ title: 'UserField', isVisible: true }); |
||||
|
||||
// delete column and verify
|
||||
await grid.column.delete({ title: 'UserField' }); |
||||
await grid.column.verify({ title: 'UserField', isVisible: false }); |
||||
}); |
||||
}); |
Loading…
Reference in new issue