|
|
@ -6,7 +6,7 @@ import setup from '../../setup'; |
|
|
|
import { ToolbarPage } from '../../pages/Dashboard/common/Toolbar'; |
|
|
|
import { ToolbarPage } from '../../pages/Dashboard/common/Toolbar'; |
|
|
|
import { ProjectsPage } from '../../pages/ProjectsPage'; |
|
|
|
import { ProjectsPage } from '../../pages/ProjectsPage'; |
|
|
|
import { Api } from 'nocodb-sdk'; |
|
|
|
import { Api } from 'nocodb-sdk'; |
|
|
|
import { ProjectInfo, ProjectInfoOperator } from '../utils/projectInfoOperator'; |
|
|
|
import { ProjectInfo, ProjectInfoApiUtil } from '../utils/projectInfoApiUtil'; |
|
|
|
import { deepCompare } from '../utils/objectCompareUtil'; |
|
|
|
import { deepCompare } from '../utils/objectCompareUtil'; |
|
|
|
|
|
|
|
|
|
|
|
test.describe('Project operations', () => { |
|
|
|
test.describe('Project operations', () => { |
|
|
@ -15,7 +15,7 @@ test.describe('Project operations', () => { |
|
|
|
let context: any; |
|
|
|
let context: any; |
|
|
|
let api: Api<any>; |
|
|
|
let api: Api<any>; |
|
|
|
let projectPage: ProjectsPage; |
|
|
|
let projectPage: ProjectsPage; |
|
|
|
test.setTimeout(70000); |
|
|
|
test.setTimeout(100000); |
|
|
|
|
|
|
|
|
|
|
|
async function deleteIfExists(name: string) { |
|
|
|
async function deleteIfExists(name: string) { |
|
|
|
try { |
|
|
|
try { |
|
|
@ -30,6 +30,24 @@ test.describe('Project operations', () => { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function createTestProjectWithData(testProjectName: string) { |
|
|
|
|
|
|
|
await dashboard.clickHome(); |
|
|
|
|
|
|
|
await projectPage.createProject({ name: testProjectName, withoutPrefix: true }); |
|
|
|
|
|
|
|
await dashboard.treeView.quickImport({ title: 'Airtable' }); |
|
|
|
|
|
|
|
await dashboard.importAirtable.import({ |
|
|
|
|
|
|
|
key: airtableApiKey, |
|
|
|
|
|
|
|
baseId: airtableApiBase, |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
await dashboard.rootPage.waitForTimeout(1000); |
|
|
|
|
|
|
|
// await quickVerify({ dashboard, airtableImport: true, context });
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function cleanupTestData(dupeProjectName: string, testProjectName: string) { |
|
|
|
|
|
|
|
await dashboard.clickHome(); |
|
|
|
|
|
|
|
await projectPage.deleteProject({ title: dupeProjectName, withoutPrefix: true }); |
|
|
|
|
|
|
|
await projectPage.deleteProject({ title: testProjectName, withoutPrefix: true }); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
test.beforeEach(async ({ page }) => { |
|
|
|
test.beforeEach(async ({ page }) => { |
|
|
|
page.setDefaultTimeout(70000); |
|
|
|
page.setDefaultTimeout(70000); |
|
|
|
context = await setup({ page }); |
|
|
|
context = await setup({ page }); |
|
|
@ -71,23 +89,27 @@ test.describe('Project operations', () => { |
|
|
|
await deleteIfExists(dupeProjectName); |
|
|
|
await deleteIfExists(dupeProjectName); |
|
|
|
|
|
|
|
|
|
|
|
// // data creation for orginial test project
|
|
|
|
// // data creation for orginial test project
|
|
|
|
await createTestProjectWithData(); |
|
|
|
await createTestProjectWithData(testProjectName); |
|
|
|
|
|
|
|
|
|
|
|
// create duplicate
|
|
|
|
// create duplicate
|
|
|
|
await dashboard.clickHome(); |
|
|
|
await dashboard.clickHome(); |
|
|
|
await projectPage.duplicateProject({ name: testProjectName, withoutPrefix: true }); |
|
|
|
await projectPage.duplicateProject({ |
|
|
|
|
|
|
|
name: testProjectName, |
|
|
|
|
|
|
|
withoutPrefix: true, |
|
|
|
|
|
|
|
includeData: true, |
|
|
|
|
|
|
|
includeViews: true, |
|
|
|
|
|
|
|
}); |
|
|
|
await projectPage.openProject({ title: dupeProjectName, withoutPrefix: true }); |
|
|
|
await projectPage.openProject({ title: dupeProjectName, withoutPrefix: true }); |
|
|
|
await quickVerify({ dashboard, airtableImport: true, context }); |
|
|
|
// await quickVerify({ dashboard, airtableImport: true, context });
|
|
|
|
|
|
|
|
|
|
|
|
// compare
|
|
|
|
// compare
|
|
|
|
const projectList = await api.project.list(); |
|
|
|
const projectList = await api.project.list(); |
|
|
|
const testProjectId = await projectList.list.find((p: any) => p.title === testProjectName); |
|
|
|
const testProjectId = await projectList.list.find((p: any) => p.title === testProjectName); |
|
|
|
const dupeProjectId = await projectList.list.find((p: any) => p.title === dupeProjectName); |
|
|
|
const dupeProjectId = await projectList.list.find((p: any) => p.title === dupeProjectName); |
|
|
|
const projectInfoOp: ProjectInfoOperator = new ProjectInfoOperator(context.token); |
|
|
|
const projectInfoOp: ProjectInfoApiUtil = new ProjectInfoApiUtil(context.token); |
|
|
|
const orginal: Promise<ProjectInfo> = projectInfoOp.extractProjectData(testProjectId.id); |
|
|
|
const orginal: Promise<ProjectInfo> = projectInfoOp.extractProjectInfo(testProjectId.id); |
|
|
|
const duplicate: Promise<ProjectInfo> = projectInfoOp.extractProjectData(dupeProjectId.id); |
|
|
|
const duplicate: Promise<ProjectInfo> = projectInfoOp.extractProjectInfo(dupeProjectId.id); |
|
|
|
await Promise.all([orginal, duplicate]).then(arr => { |
|
|
|
await Promise.all([orginal, duplicate]).then(arr => { |
|
|
|
// TODO: support providing full json path instead of just last field name
|
|
|
|
|
|
|
|
const ignoredFields: Set<string> = new Set([ |
|
|
|
const ignoredFields: Set<string> = new Set([ |
|
|
|
'id', |
|
|
|
'id', |
|
|
|
'prefix', |
|
|
|
'prefix', |
|
|
@ -99,12 +121,16 @@ test.describe('Project operations', () => { |
|
|
|
'fk_model_id', |
|
|
|
'fk_model_id', |
|
|
|
'fk_column_id', |
|
|
|
'fk_column_id', |
|
|
|
'fk_cover_image_col_id', |
|
|
|
'fk_cover_image_col_id', |
|
|
|
// potential bugs
|
|
|
|
// // potential bugs
|
|
|
|
'created_at', |
|
|
|
'created_at', |
|
|
|
'updated_at', |
|
|
|
'updated_at', |
|
|
|
]); |
|
|
|
]); |
|
|
|
const ignoredKeys: Set<string> = new Set([ |
|
|
|
const ignoredKeys: Set<string> = new Set([ |
|
|
|
|
|
|
|
'.project.is_meta.id', |
|
|
|
'.project.is_meta.title', |
|
|
|
'.project.is_meta.title', |
|
|
|
|
|
|
|
'.project.tables.0.table.id', |
|
|
|
|
|
|
|
'.project.tables.0.table.id.base_id', |
|
|
|
|
|
|
|
|
|
|
|
// below are potential bugs
|
|
|
|
// below are potential bugs
|
|
|
|
'.project.is_meta.title.status', |
|
|
|
'.project.is_meta.title.status', |
|
|
|
'.project.tables.0.table.shares.views.0.view._ptn.ptype.tn', |
|
|
|
'.project.tables.0.table.shares.views.0.view._ptn.ptype.tn', |
|
|
@ -119,6 +145,7 @@ test.describe('Project operations', () => { |
|
|
|
'.project.tables.bases.0.alias.config', |
|
|
|
'.project.tables.bases.0.alias.config', |
|
|
|
'.project.tables.bases.users.0.1.email.invite_token.main_roles.roles', |
|
|
|
'.project.tables.bases.users.0.1.email.invite_token.main_roles.roles', |
|
|
|
'.project.tables.bases.users.0.1.2.email.invite_token.main_roles.roles', |
|
|
|
'.project.tables.bases.users.0.1.2.email.invite_token.main_roles.roles', |
|
|
|
|
|
|
|
'.project.tables.bases.users.0.1.2.3.email.invite_token.main_roles.roles', |
|
|
|
]); |
|
|
|
]); |
|
|
|
const orginalProjectInfo: ProjectInfo = arr[0]; |
|
|
|
const orginalProjectInfo: ProjectInfo = arr[0]; |
|
|
|
const duplicateProjectInfo: ProjectInfo = arr[1]; |
|
|
|
const duplicateProjectInfo: ProjectInfo = arr[1]; |
|
|
@ -126,24 +153,6 @@ test.describe('Project operations', () => { |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// cleanup test-data
|
|
|
|
// cleanup test-data
|
|
|
|
await cleanupTestData(); |
|
|
|
await cleanupTestData(dupeProjectName, testProjectName); |
|
|
|
|
|
|
|
|
|
|
|
async function createTestProjectWithData() { |
|
|
|
|
|
|
|
await dashboard.clickHome(); |
|
|
|
|
|
|
|
await projectPage.createProject({ name: testProjectName, withoutPrefix: true }); |
|
|
|
|
|
|
|
await dashboard.treeView.quickImport({ title: 'Airtable' }); |
|
|
|
|
|
|
|
await dashboard.importAirtable.import({ |
|
|
|
|
|
|
|
key: airtableApiKey, |
|
|
|
|
|
|
|
baseId: airtableApiBase, |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
await dashboard.rootPage.waitForTimeout(1000); |
|
|
|
|
|
|
|
await quickVerify({ dashboard, airtableImport: true, context }); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function cleanupTestData() { |
|
|
|
|
|
|
|
await dashboard.clickHome(); |
|
|
|
|
|
|
|
await projectPage.deleteProject({ title: dupeProjectName, withoutPrefix: true }); |
|
|
|
|
|
|
|
await projectPage.deleteProject({ title: testProjectName, withoutPrefix: true }); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|