|
|
@ -1,5 +1,7 @@ |
|
|
|
import { test } from '@playwright/test'; |
|
|
|
import { test } from '@playwright/test'; |
|
|
|
import { DashboardPage } from '../../pages/Dashboard'; |
|
|
|
import { DashboardPage } from '../../pages/Dashboard'; |
|
|
|
|
|
|
|
import { airtableApiBase, airtableApiKey } from '../../constants'; |
|
|
|
|
|
|
|
import { quickVerify } from '../../quickTests/commonTest'; |
|
|
|
import setup from '../../setup'; |
|
|
|
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'; |
|
|
@ -11,8 +13,23 @@ 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(150000); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function deleteIfExists(name: string) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
const projectList = await api.project.list(); |
|
|
|
|
|
|
|
const project = projectList.list.find((p: any) => p.title === name); |
|
|
|
|
|
|
|
if (project) { |
|
|
|
|
|
|
|
await api.project.delete(project.id); |
|
|
|
|
|
|
|
console.log('deleted project: ', project.id); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} catch (e) { |
|
|
|
|
|
|
|
console.log('Error: ', e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
test.beforeEach(async ({ page }) => { |
|
|
|
test.beforeEach(async ({ page }) => { |
|
|
|
|
|
|
|
page.setDefaultTimeout(70000); |
|
|
|
context = await setup({ page }); |
|
|
|
context = await setup({ page }); |
|
|
|
dashboard = new DashboardPage(page, context.project); |
|
|
|
dashboard = new DashboardPage(page, context.project); |
|
|
|
projectPage = new ProjectsPage(page); |
|
|
|
projectPage = new ProjectsPage(page); |
|
|
@ -28,16 +45,7 @@ test.describe('Project operations', () => { |
|
|
|
|
|
|
|
|
|
|
|
test('rename, delete', async () => { |
|
|
|
test('rename, delete', async () => { |
|
|
|
// if project already exists, delete it
|
|
|
|
// if project already exists, delete it
|
|
|
|
try { |
|
|
|
await deleteIfExists('project-firstName'); |
|
|
|
const projectList = await api.project.list(); |
|
|
|
|
|
|
|
const project = projectList.list.find((p: any) => p.title === 'project-firstName'); |
|
|
|
|
|
|
|
if (project) { |
|
|
|
|
|
|
|
await api.project.delete(project.id); |
|
|
|
|
|
|
|
console.log('deleted project: ', project.id); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} catch (e) { |
|
|
|
|
|
|
|
console.log('Error: ', e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await dashboard.clickHome(); |
|
|
|
await dashboard.clickHome(); |
|
|
|
await projectPage.createProject({ name: 'project-firstName', withoutPrefix: true }); |
|
|
|
await projectPage.createProject({ name: 'project-firstName', withoutPrefix: true }); |
|
|
@ -52,4 +60,42 @@ test.describe('Project operations', () => { |
|
|
|
await dashboard.clickHome(); |
|
|
|
await dashboard.clickHome(); |
|
|
|
await projectPage.deleteProject({ title: 'project-rename', withoutPrefix: true }); |
|
|
|
await projectPage.deleteProject({ title: 'project-rename', withoutPrefix: true }); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test.only('project_duplicate', async () => { |
|
|
|
|
|
|
|
// if project already exists, delete it to avoid test failures due to residual data
|
|
|
|
|
|
|
|
const testProjectName = 'project-to-imexp'; |
|
|
|
|
|
|
|
const dupeProjectName: string = testProjectName + ' copy'; |
|
|
|
|
|
|
|
await deleteIfExists(testProjectName); |
|
|
|
|
|
|
|
await deleteIfExists(dupeProjectName); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// // data creation for orginial test project
|
|
|
|
|
|
|
|
await createTestProjectWithData(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// create duplicate
|
|
|
|
|
|
|
|
await dashboard.clickHome(); |
|
|
|
|
|
|
|
await projectPage.duplicateProject({ name: testProjectName, withoutPrefix: true }); |
|
|
|
|
|
|
|
await projectPage.openProject({ title: dupeProjectName, withoutPrefix: true }); |
|
|
|
|
|
|
|
await quickVerify({ dashboard, airtableImport: true, context }); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// cleanup test-data
|
|
|
|
|
|
|
|
await cleanupTestData(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 }); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|