|
|
@ -25,22 +25,15 @@ const roleDb = [ |
|
|
|
async function beforeEachInit({ page }: { page: any }) { |
|
|
|
async function beforeEachInit({ page }: { page: any }) { |
|
|
|
let workspacePage: WorkspacePage; |
|
|
|
let workspacePage: WorkspacePage; |
|
|
|
let collaborationPage: CollaborationPage; |
|
|
|
let collaborationPage: CollaborationPage; |
|
|
|
let api: Api<any>; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const context: any = await setup({ page, isEmptyProject: true }); |
|
|
|
const context: any = await setup({ page, isEmptyProject: true }); |
|
|
|
const dashboard: DashboardPage = new DashboardPage(page, context.base); |
|
|
|
const dashboard: DashboardPage = new DashboardPage(page, context.base); |
|
|
|
|
|
|
|
const api = context.api; |
|
|
|
|
|
|
|
|
|
|
|
if (isEE()) { |
|
|
|
if (isEE()) { |
|
|
|
workspacePage = new WorkspacePage(page); |
|
|
|
workspacePage = new WorkspacePage(page); |
|
|
|
collaborationPage = workspacePage.collaboration; |
|
|
|
collaborationPage = workspacePage.collaboration; |
|
|
|
|
|
|
|
|
|
|
|
api = new Api({ |
|
|
|
|
|
|
|
baseURL: `http://localhost:8080/`, |
|
|
|
|
|
|
|
headers: { |
|
|
|
|
|
|
|
'xc-auth': context.token, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < roleDb.length; i++) { |
|
|
|
for (let i = 0; i < roleDb.length; i++) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
await api.auth.signup({ |
|
|
|
await api.auth.signup({ |
|
|
@ -59,25 +52,36 @@ async function beforeEachInit({ page }: { page: any }) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return { dashboard, context }; |
|
|
|
return { dashboard, context, api }; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
test.describe('User single select', () => { |
|
|
|
test.describe('User single select', () => { |
|
|
|
let dashboard: DashboardPage, grid: GridPage, topbar: TopbarPage; |
|
|
|
let dashboard: DashboardPage, grid: GridPage, topbar: TopbarPage; |
|
|
|
let context: any; |
|
|
|
let context: any; |
|
|
|
|
|
|
|
let api: Api<any>; |
|
|
|
|
|
|
|
let tableId: string; |
|
|
|
|
|
|
|
|
|
|
|
test.beforeEach(async ({ page }) => { |
|
|
|
test.beforeEach(async ({ page }) => { |
|
|
|
const initRsp = await beforeEachInit({ page: page }); |
|
|
|
const initRsp = await beforeEachInit({ page: page }); |
|
|
|
context = initRsp.context; |
|
|
|
context = initRsp.context; |
|
|
|
dashboard = initRsp.dashboard; |
|
|
|
dashboard = initRsp.dashboard; |
|
|
|
|
|
|
|
api = initRsp.api; |
|
|
|
grid = dashboard.grid; |
|
|
|
grid = dashboard.grid; |
|
|
|
topbar = dashboard.grid.topbar; |
|
|
|
topbar = dashboard.grid.topbar; |
|
|
|
|
|
|
|
|
|
|
|
await dashboard.treeView.createTable({ title: 'Sheet1', baseTitle: context.base.title }); |
|
|
|
await dashboard.treeView.createTable({ title: 'sheet1', baseTitle: context.base.title }); |
|
|
|
|
|
|
|
|
|
|
|
await grid.column.create({ title: 'User', type: 'User' }); |
|
|
|
await grid.column.create({ title: 'User', type: 'User' }); |
|
|
|
|
|
|
|
|
|
|
|
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 () => { |
|
|
@ -102,7 +106,14 @@ test.describe('User single select', () => { |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// Add new row and verify default value is added in new cell
|
|
|
|
// Add new row and verify default value is added in new cell
|
|
|
|
await grid.addNewRow({ index: 1, value: 'Row 1' }); |
|
|
|
await api.dbTableRow.bulkCreate('noco', context.base.id, tableId, [ |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Id: 2, |
|
|
|
|
|
|
|
Title: `Row 1`, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
]); |
|
|
|
|
|
|
|
await grid.rootPage.reload(); |
|
|
|
|
|
|
|
|
|
|
|
await grid.cell.userOption.verify({ |
|
|
|
await grid.cell.userOption.verify({ |
|
|
|
index: 1, |
|
|
|
index: 1, |
|
|
|
columnHeader: 'User', |
|
|
|
columnHeader: 'User', |
|
|
@ -130,9 +141,17 @@ test.describe('User single select', () => { |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
test('Field operations - duplicate column, convert to SingleLineText', async () => { |
|
|
|
test('Field operations - duplicate column, convert to SingleLineText', async () => { |
|
|
|
|
|
|
|
await api.dbTableRow.bulkCreate('noco', context.base.id, tableId, [ |
|
|
|
|
|
|
|
{ Id: 2, Title: `Row 1` }, |
|
|
|
|
|
|
|
{ Id: 3, Title: `Row 2` }, |
|
|
|
|
|
|
|
{ Id: 4, Title: `Row 3` }, |
|
|
|
|
|
|
|
{ Id: 5, Title: `Row 4` }, |
|
|
|
|
|
|
|
{ Id: 6, Title: `Row 5` }, |
|
|
|
|
|
|
|
]); |
|
|
|
|
|
|
|
await grid.rootPage.reload(); |
|
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i <= 4; i++) { |
|
|
|
for (let i = 0; i <= 4; i++) { |
|
|
|
await grid.cell.userOption.select({ index: i, columnHeader: 'User', option: users[i], multiSelect: false }); |
|
|
|
await grid.cell.userOption.select({ index: i, columnHeader: 'User', option: users[i], multiSelect: false }); |
|
|
|
await grid.addNewRow({ index: i + 1, value: `Row ${i + 1}` }); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
await grid.column.duplicateColumn({ |
|
|
|
await grid.column.duplicateColumn({ |
|
|
@ -164,10 +183,19 @@ test.describe('User single select', () => { |
|
|
|
multiSelect: false, |
|
|
|
multiSelect: false, |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// add 5 rows
|
|
|
|
|
|
|
|
await api.dbTableRow.bulkCreate('noco', context.base.id, tableId, [ |
|
|
|
|
|
|
|
{ Id: 2, Title: `Row 1` }, |
|
|
|
|
|
|
|
{ Id: 3, Title: `Row 2` }, |
|
|
|
|
|
|
|
{ Id: 4, Title: `Row 3` }, |
|
|
|
|
|
|
|
{ Id: 5, Title: `Row 4` }, |
|
|
|
|
|
|
|
{ Id: 6, Title: `Row 5` }, |
|
|
|
|
|
|
|
]); |
|
|
|
|
|
|
|
await grid.rootPage.reload(); |
|
|
|
|
|
|
|
|
|
|
|
// Edit, refresh and verify
|
|
|
|
// Edit, refresh and verify
|
|
|
|
for (let i = 0; i <= 4; i++) { |
|
|
|
for (let i = 0; i <= 4; i++) { |
|
|
|
await grid.cell.userOption.select({ index: i, columnHeader: 'User', option: users[i], multiSelect: false }); |
|
|
|
await grid.cell.userOption.select({ index: i, columnHeader: 'User', option: users[i], multiSelect: false }); |
|
|
|
await grid.addNewRow({ index: i + 1, value: `Row ${i + 1}` }); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// refresh page
|
|
|
|
// refresh page
|
|
|
@ -275,11 +303,14 @@ test.describe('User single select - filter, sort & GroupBy', () => { |
|
|
|
|
|
|
|
|
|
|
|
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 }) => { |
|
|
|
const initRsp = await beforeEachInit({ page: page }); |
|
|
|
const initRsp = await beforeEachInit({ page: page }); |
|
|
|
context = initRsp.context; |
|
|
|
context = initRsp.context; |
|
|
|
dashboard = initRsp.dashboard; |
|
|
|
dashboard = initRsp.dashboard; |
|
|
|
|
|
|
|
api = initRsp.api; |
|
|
|
grid = dashboard.grid; |
|
|
|
grid = dashboard.grid; |
|
|
|
toolbar = dashboard.grid.toolbar; |
|
|
|
toolbar = dashboard.grid.toolbar; |
|
|
|
|
|
|
|
|
|
|
@ -287,8 +318,18 @@ test.describe('User single select - filter, sort & GroupBy', () => { |
|
|
|
|
|
|
|
|
|
|
|
await grid.column.create({ title: 'User', type: 'User' }); |
|
|
|
await grid.column.create({ title: 'User', type: 'User' }); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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: `0` }, |
|
|
|
|
|
|
|
{ Id: 2, Title: `1` }, |
|
|
|
|
|
|
|
{ Id: 3, Title: `2` }, |
|
|
|
|
|
|
|
{ Id: 4, Title: `3` }, |
|
|
|
|
|
|
|
{ Id: 5, Title: `4` }, |
|
|
|
|
|
|
|
]); |
|
|
|
|
|
|
|
await page.reload(); |
|
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i <= 4; i++) { |
|
|
|
for (let i = 0; i <= 4; i++) { |
|
|
|
await grid.addNewRow({ index: i, value: `${i}` }); |
|
|
|
|
|
|
|
await grid.cell.userOption.select({ index: i, columnHeader: 'User', option: users[i], multiSelect: false }); |
|
|
|
await grid.cell.userOption.select({ index: i, columnHeader: 'User', option: users[i], multiSelect: false }); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
@ -398,11 +439,14 @@ test.describe('User single select - filter, sort & GroupBy', () => { |
|
|
|
test.describe('User multiple select', () => { |
|
|
|
test.describe('User multiple select', () => { |
|
|
|
let dashboard: DashboardPage, grid: GridPage, topbar: TopbarPage; |
|
|
|
let dashboard: DashboardPage, grid: GridPage, topbar: TopbarPage; |
|
|
|
let context: any; |
|
|
|
let context: any; |
|
|
|
|
|
|
|
let api: Api<any>; |
|
|
|
|
|
|
|
let tableId: string; |
|
|
|
|
|
|
|
|
|
|
|
test.beforeEach(async ({ page }) => { |
|
|
|
test.beforeEach(async ({ page }) => { |
|
|
|
const initRsp = await beforeEachInit({ page: page }); |
|
|
|
const initRsp = await beforeEachInit({ page: page }); |
|
|
|
context = initRsp.context; |
|
|
|
context = initRsp.context; |
|
|
|
dashboard = initRsp.dashboard; |
|
|
|
dashboard = initRsp.dashboard; |
|
|
|
|
|
|
|
api = initRsp.api; |
|
|
|
grid = dashboard.grid; |
|
|
|
grid = dashboard.grid; |
|
|
|
topbar = dashboard.grid.topbar; |
|
|
|
topbar = dashboard.grid.topbar; |
|
|
|
|
|
|
|
|
|
|
@ -410,6 +454,9 @@ test.describe('User multiple select', () => { |
|
|
|
|
|
|
|
|
|
|
|
await grid.column.create({ title: 'User', type: 'User' }); |
|
|
|
await grid.column.create({ title: 'User', type: 'User' }); |
|
|
|
await grid.column.userOption.allowMultipleUser({ columnTitle: 'User', allowMultiple: true }); |
|
|
|
await grid.column.userOption.allowMultipleUser({ columnTitle: 'User', allowMultiple: true }); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const tables = await api.dbTable.list(context.base.id); |
|
|
|
|
|
|
|
tableId = tables.list.find((table: any) => table.title === 'Sheet1').id; |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
test.afterEach(async () => { |
|
|
|
test.afterEach(async () => { |
|
|
@ -417,7 +464,8 @@ test.describe('User multiple select', () => { |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
test('Verify the default option count, select default value and verify', async () => { |
|
|
|
test('Verify the default option count, select default value and verify', async () => { |
|
|
|
await grid.addNewRow({ index: 0, value: 'Row 0' }); |
|
|
|
await api.dbTableRow.bulkCreate('noco', context.base.id, tableId, [{ Id: 1, Title: `Row 0` }]); |
|
|
|
|
|
|
|
await grid.rootPage.reload(); |
|
|
|
|
|
|
|
|
|
|
|
if (!isEE()) { |
|
|
|
if (!isEE()) { |
|
|
|
await grid.column.userOption.verifyDefaultValueOptionCount({ columnTitle: 'User', totalCount: 5 }); |
|
|
|
await grid.column.userOption.verifyDefaultValueOptionCount({ columnTitle: 'User', totalCount: 5 }); |
|
|
@ -436,7 +484,9 @@ test.describe('User multiple select', () => { |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// Add new row and verify default value is added in new cell
|
|
|
|
// Add new row and verify default value is added in new cell
|
|
|
|
await grid.addNewRow({ index: 1, value: 'Row 1' }); |
|
|
|
await api.dbTableRow.bulkCreate('noco', context.base.id, tableId, [{ Id: 2, Title: `Row 1` }]); |
|
|
|
|
|
|
|
await grid.rootPage.reload(); |
|
|
|
|
|
|
|
|
|
|
|
await grid.cell.userOption.verify({ |
|
|
|
await grid.cell.userOption.verify({ |
|
|
|
index: 1, |
|
|
|
index: 1, |
|
|
|
columnHeader: 'User', |
|
|
|
columnHeader: 'User', |
|
|
@ -452,10 +502,17 @@ test.describe('User multiple select', () => { |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
test('Field operations - duplicate column, convert to SingleLineText', async () => { |
|
|
|
test('Field operations - duplicate column, convert to SingleLineText', async () => { |
|
|
|
|
|
|
|
await api.dbTableRow.bulkCreate('noco', context.base.id, tableId, [ |
|
|
|
|
|
|
|
{ Id: 1, Title: `Row 0` }, |
|
|
|
|
|
|
|
{ Id: 2, Title: `Row 1` }, |
|
|
|
|
|
|
|
{ Id: 3, Title: `Row 2` }, |
|
|
|
|
|
|
|
{ Id: 4, Title: `Row 3` }, |
|
|
|
|
|
|
|
{ Id: 5, Title: `Row 4` }, |
|
|
|
|
|
|
|
]); |
|
|
|
|
|
|
|
await grid.rootPage.reload(); |
|
|
|
|
|
|
|
|
|
|
|
let counter = 1; |
|
|
|
let counter = 1; |
|
|
|
for (let i = 0; i <= 4; i++) { |
|
|
|
for (let i = 0; i <= 4; i++) { |
|
|
|
await grid.addNewRow({ index: i, value: `Row ${i}` }); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await grid.cell.userOption.select({ index: i, columnHeader: 'User', option: users[i], multiSelect: true }); |
|
|
|
await grid.cell.userOption.select({ index: i, columnHeader: 'User', option: users[i], multiSelect: true }); |
|
|
|
await grid.cell.userOption.select({ index: i, columnHeader: 'User', option: users[counter], multiSelect: true }); |
|
|
|
await grid.cell.userOption.select({ index: i, columnHeader: 'User', option: users[counter], multiSelect: true }); |
|
|
|
|
|
|
|
|
|
|
@ -497,11 +554,18 @@ test.describe('User multiple select', () => { |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
test('Cell Operation - edit, copy-paste and delete', async () => { |
|
|
|
test('Cell Operation - edit, copy-paste and delete', async () => { |
|
|
|
|
|
|
|
await api.dbTableRow.bulkCreate('noco', context.base.id, tableId, [ |
|
|
|
|
|
|
|
{ Id: 1, Title: `Row 0` }, |
|
|
|
|
|
|
|
{ Id: 2, Title: `Row 1` }, |
|
|
|
|
|
|
|
{ Id: 3, Title: `Row 2` }, |
|
|
|
|
|
|
|
{ Id: 4, Title: `Row 3` }, |
|
|
|
|
|
|
|
{ Id: 5, Title: `Row 4` }, |
|
|
|
|
|
|
|
]); |
|
|
|
|
|
|
|
await grid.rootPage.reload(); |
|
|
|
|
|
|
|
|
|
|
|
// Edit, refresh and verify
|
|
|
|
// Edit, refresh and verify
|
|
|
|
let counter = 1; |
|
|
|
let counter = 1; |
|
|
|
for (let i = 0; i <= 4; i++) { |
|
|
|
for (let i = 0; i <= 4; i++) { |
|
|
|
await grid.addNewRow({ index: i, value: `Row ${i}` }); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await grid.cell.userOption.select({ |
|
|
|
await grid.cell.userOption.select({ |
|
|
|
index: i, |
|
|
|
index: i, |
|
|
|
columnHeader: 'User', |
|
|
|
columnHeader: 'User', |
|
|
@ -617,11 +681,14 @@ test.describe('User multiple select - filter, sort & GroupBy', () => { |
|
|
|
|
|
|
|
|
|
|
|
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 }) => { |
|
|
|
const initRsp = await beforeEachInit({ page: page }); |
|
|
|
const initRsp = await beforeEachInit({ page: page }); |
|
|
|
context = initRsp.context; |
|
|
|
context = initRsp.context; |
|
|
|
dashboard = initRsp.dashboard; |
|
|
|
dashboard = initRsp.dashboard; |
|
|
|
|
|
|
|
api = initRsp.api; |
|
|
|
grid = dashboard.grid; |
|
|
|
grid = dashboard.grid; |
|
|
|
toolbar = dashboard.grid.toolbar; |
|
|
|
toolbar = dashboard.grid.toolbar; |
|
|
|
|
|
|
|
|
|
|
@ -630,9 +697,20 @@ test.describe('User multiple select - filter, sort & GroupBy', () => { |
|
|
|
await grid.column.create({ title: 'User', type: 'User' }); |
|
|
|
await grid.column.create({ title: 'User', type: 'User' }); |
|
|
|
await grid.column.userOption.allowMultipleUser({ columnTitle: 'User', allowMultiple: true }); |
|
|
|
await grid.column.userOption.allowMultipleUser({ columnTitle: 'User', allowMultiple: true }); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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: `0` }, |
|
|
|
|
|
|
|
{ Id: 2, Title: `1` }, |
|
|
|
|
|
|
|
{ Id: 3, Title: `2` }, |
|
|
|
|
|
|
|
{ Id: 4, Title: `3` }, |
|
|
|
|
|
|
|
{ Id: 5, Title: `4` }, |
|
|
|
|
|
|
|
]); |
|
|
|
|
|
|
|
await grid.rootPage.reload(); |
|
|
|
|
|
|
|
|
|
|
|
let counter = 2; |
|
|
|
let counter = 2; |
|
|
|
for (let i = 0; i <= 4; i++) { |
|
|
|
for (let i = 0; i <= 4; i++) { |
|
|
|
await grid.addNewRow({ index: i, value: `${i}` }); |
|
|
|
|
|
|
|
await grid.cell.userOption.select({ index: i, columnHeader: 'User', option: users[i], multiSelect: true }); |
|
|
|
await grid.cell.userOption.select({ index: i, columnHeader: 'User', option: users[i], multiSelect: true }); |
|
|
|
if (i !== 0) { |
|
|
|
if (i !== 0) { |
|
|
|
await grid.cell.userOption.select({ |
|
|
|
await grid.cell.userOption.select({ |
|
|
|