|
|
@ -3,15 +3,19 @@ import { DashboardPage } from '../../../pages/Dashboard'; |
|
|
|
import { GridPage } from '../../../pages/Dashboard/Grid'; |
|
|
|
import { GridPage } from '../../../pages/Dashboard/Grid'; |
|
|
|
import setup, { unsetup } from '../../../setup'; |
|
|
|
import setup, { unsetup } from '../../../setup'; |
|
|
|
import { ToolbarPage } from '../../../pages/Dashboard/common/Toolbar'; |
|
|
|
import { ToolbarPage } from '../../../pages/Dashboard/common/Toolbar'; |
|
|
|
|
|
|
|
import { Api } from 'nocodb-sdk'; |
|
|
|
|
|
|
|
|
|
|
|
test.describe('Single select', () => { |
|
|
|
test.describe('Single select', () => { |
|
|
|
let dashboard: DashboardPage, grid: GridPage; |
|
|
|
let dashboard: DashboardPage, grid: GridPage; |
|
|
|
let context: any; |
|
|
|
let context: any; |
|
|
|
|
|
|
|
let api: Api<any>; |
|
|
|
|
|
|
|
let tableId: string; |
|
|
|
|
|
|
|
|
|
|
|
test.beforeEach(async ({ page }) => { |
|
|
|
test.beforeEach(async ({ page }) => { |
|
|
|
context = await setup({ page, isEmptyProject: true }); |
|
|
|
context = await setup({ page, isEmptyProject: true }); |
|
|
|
dashboard = new DashboardPage(page, context.base); |
|
|
|
dashboard = new DashboardPage(page, context.base); |
|
|
|
grid = dashboard.grid; |
|
|
|
grid = dashboard.grid; |
|
|
|
|
|
|
|
api = context.api; |
|
|
|
|
|
|
|
|
|
|
|
await dashboard.treeView.createTable({ title: 'sheet1', baseTitle: context.base.title }); |
|
|
|
await dashboard.treeView.createTable({ title: 'sheet1', baseTitle: context.base.title }); |
|
|
|
|
|
|
|
|
|
|
@ -20,7 +24,11 @@ test.describe('Single select', () => { |
|
|
|
columnTitle: 'SingleSelect', |
|
|
|
columnTitle: 'SingleSelect', |
|
|
|
options: ['Option 1', 'Option 2'], |
|
|
|
options: ['Option 1', 'Option 2'], |
|
|
|
}); |
|
|
|
}); |
|
|
|
await grid.addNewRow({ index: 0, value: 'Row 0' }); |
|
|
|
|
|
|
|
|
|
|
|
const tables = await api.dbTable.list(context.base.id); |
|
|
|
|
|
|
|
tableId = tables.list.find((table: any) => table.title === 'sheet1').id; |
|
|
|
|
|
|
|
await api.dbTableRow.bulkCreate('noco', context.base.id, tableId, [{ Id: 1, Title: `Row 0` }]); |
|
|
|
|
|
|
|
await page.reload(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
test.afterEach(async () => { |
|
|
|
test.afterEach(async () => { |
|
|
@ -120,12 +128,15 @@ test.describe('Single select - filter & sort', () => { |
|
|
|
|
|
|
|
|
|
|
|
let dashboard: DashboardPage, grid: GridPage, toolbar: ToolbarPage; |
|
|
|
let dashboard: DashboardPage, grid: GridPage, toolbar: ToolbarPage; |
|
|
|
let context: any; |
|
|
|
let context: any; |
|
|
|
|
|
|
|
let api: Api<any>; |
|
|
|
|
|
|
|
let tableId: string; |
|
|
|
|
|
|
|
|
|
|
|
test.beforeEach(async ({ page }) => { |
|
|
|
test.beforeEach(async ({ page }) => { |
|
|
|
context = await setup({ page }); |
|
|
|
context = await setup({ page }); |
|
|
|
dashboard = new DashboardPage(page, context.base); |
|
|
|
dashboard = new DashboardPage(page, context.base); |
|
|
|
toolbar = dashboard.grid.toolbar; |
|
|
|
toolbar = dashboard.grid.toolbar; |
|
|
|
grid = dashboard.grid; |
|
|
|
grid = dashboard.grid; |
|
|
|
|
|
|
|
api = context.api; |
|
|
|
|
|
|
|
|
|
|
|
await dashboard.treeView.createTable({ title: 'sheet1', baseTitle: context.base.title }); |
|
|
|
await dashboard.treeView.createTable({ title: 'sheet1', baseTitle: context.base.title }); |
|
|
|
|
|
|
|
|
|
|
@ -134,10 +145,21 @@ test.describe('Single select - filter & sort', () => { |
|
|
|
columnTitle: 'SingleSelect', |
|
|
|
columnTitle: 'SingleSelect', |
|
|
|
options: ['foo', 'bar', 'baz'], |
|
|
|
options: ['foo', 'bar', 'baz'], |
|
|
|
}); |
|
|
|
}); |
|
|
|
await grid.addNewRow({ index: 0, value: '1' }); |
|
|
|
|
|
|
|
await grid.addNewRow({ index: 1, value: '2' }); |
|
|
|
const tables = await api.dbTable.list(context.base.id); |
|
|
|
await grid.addNewRow({ index: 2, value: '3' }); |
|
|
|
tableId = tables.list.find((table: any) => table.title === 'sheet1').id; |
|
|
|
await grid.addNewRow({ index: 3, value: '4' }); |
|
|
|
await api.dbTableRow.bulkCreate('noco', context.base.id, tableId, [ |
|
|
|
|
|
|
|
{ Id: 1, Title: '1' }, |
|
|
|
|
|
|
|
{ Id: 2, Title: '2' }, |
|
|
|
|
|
|
|
{ Id: 3, Title: '3' }, |
|
|
|
|
|
|
|
{ Id: 4, Title: '4' }, |
|
|
|
|
|
|
|
]); |
|
|
|
|
|
|
|
await page.reload(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// await grid.addNewRow({ index: 0, value: '1' });
|
|
|
|
|
|
|
|
// await grid.addNewRow({ index: 1, value: '2' });
|
|
|
|
|
|
|
|
// await grid.addNewRow({ index: 2, value: '3' });
|
|
|
|
|
|
|
|
// await grid.addNewRow({ index: 3, value: '4' });
|
|
|
|
|
|
|
|
|
|
|
|
await grid.cell.selectOption.select({ index: 1, columnHeader: 'SingleSelect', option: 'foo', multiSelect: false }); |
|
|
|
await grid.cell.selectOption.select({ index: 1, columnHeader: 'SingleSelect', option: 'foo', multiSelect: false }); |
|
|
|
await grid.cell.selectOption.select({ index: 2, columnHeader: 'SingleSelect', option: 'bar', multiSelect: false }); |
|
|
|
await grid.cell.selectOption.select({ index: 2, columnHeader: 'SingleSelect', option: 'bar', multiSelect: false }); |
|
|
|