2024-05-31 11:01:10 +05:30
|
|
|
/*
|
|
|
|
* Copyright 2024 Collate.
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
2024-06-01 22:18:33 +05:30
|
|
|
import { test } from '@playwright/test';
|
2024-08-13 18:43:03 +05:30
|
|
|
import { isUndefined } from 'lodash';
|
2024-06-11 16:57:09 +05:30
|
|
|
import { CustomPropertySupportedEntityList } from '../../constant/customProperty';
|
2024-07-26 14:31:17 +05:30
|
|
|
import { ApiEndpointClass } from '../../support/entity/ApiEndpointClass';
|
2024-05-31 11:01:10 +05:30
|
|
|
import { ContainerClass } from '../../support/entity/ContainerClass';
|
|
|
|
import { DashboardClass } from '../../support/entity/DashboardClass';
|
|
|
|
import { DashboardDataModelClass } from '../../support/entity/DashboardDataModelClass';
|
|
|
|
import { EntityDataClass } from '../../support/entity/EntityDataClass';
|
|
|
|
import { MlModelClass } from '../../support/entity/MlModelClass';
|
|
|
|
import { PipelineClass } from '../../support/entity/PipelineClass';
|
|
|
|
import { SearchIndexClass } from '../../support/entity/SearchIndexClass';
|
2024-06-11 16:57:09 +05:30
|
|
|
import { StoredProcedureClass } from '../../support/entity/StoredProcedureClass';
|
2024-06-06 18:00:31 +05:30
|
|
|
import { TableClass } from '../../support/entity/TableClass';
|
2024-05-31 11:01:10 +05:30
|
|
|
import { TopicClass } from '../../support/entity/TopicClass';
|
2024-06-05 17:56:41 +05:30
|
|
|
import {
|
2024-08-21 21:51:32 +05:30
|
|
|
assignDomain,
|
2024-06-05 17:56:41 +05:30
|
|
|
createNewPage,
|
2024-06-18 11:38:46 +05:30
|
|
|
getApiContext,
|
2024-06-05 17:56:41 +05:30
|
|
|
getAuthContext,
|
|
|
|
getToken,
|
|
|
|
redirectToHomePage,
|
2024-08-21 21:51:32 +05:30
|
|
|
removeDomain,
|
|
|
|
verifyDomainPropagation,
|
2024-06-05 17:56:41 +05:30
|
|
|
} from '../../utils/common';
|
2024-06-11 16:57:09 +05:30
|
|
|
import { CustomPropertyTypeByName } from '../../utils/customProperty';
|
2024-08-21 21:51:32 +05:30
|
|
|
import { visitServiceDetailsPage } from '../../utils/service';
|
2024-05-31 11:01:10 +05:30
|
|
|
|
|
|
|
const entities = [
|
2024-07-26 14:31:17 +05:30
|
|
|
ApiEndpointClass,
|
2024-06-06 18:00:31 +05:30
|
|
|
TableClass,
|
2024-06-11 16:57:09 +05:30
|
|
|
StoredProcedureClass,
|
2024-06-05 17:56:41 +05:30
|
|
|
DashboardClass,
|
|
|
|
PipelineClass,
|
|
|
|
TopicClass,
|
|
|
|
MlModelClass,
|
|
|
|
ContainerClass,
|
|
|
|
SearchIndexClass,
|
|
|
|
DashboardDataModelClass,
|
2024-05-31 11:01:10 +05:30
|
|
|
] as const;
|
|
|
|
|
2024-06-01 22:18:33 +05:30
|
|
|
// use the admin user to login
|
|
|
|
test.use({ storageState: 'playwright/.auth/admin.json' });
|
2024-05-31 11:01:10 +05:30
|
|
|
|
2024-06-05 17:56:41 +05:30
|
|
|
entities.forEach((EntityClass) => {
|
|
|
|
const entity = new EntityClass();
|
|
|
|
const deleteEntity = new EntityClass();
|
|
|
|
|
2024-06-01 22:18:33 +05:30
|
|
|
test.describe(entity.getType(), () => {
|
|
|
|
test.beforeAll('Setup pre-requests', async ({ browser }) => {
|
|
|
|
const { apiContext, afterAction } = await createNewPage(browser);
|
2024-05-31 11:01:10 +05:30
|
|
|
|
2024-06-01 22:18:33 +05:30
|
|
|
await EntityDataClass.preRequisitesForTests(apiContext);
|
|
|
|
await entity.create(apiContext);
|
|
|
|
await afterAction();
|
2024-05-31 11:01:10 +05:30
|
|
|
});
|
|
|
|
|
2024-06-01 22:18:33 +05:30
|
|
|
test.beforeEach('Visit entity details page', async ({ page }) => {
|
|
|
|
await redirectToHomePage(page);
|
|
|
|
await entity.visitEntityPage(page);
|
|
|
|
});
|
2024-05-31 11:01:10 +05:30
|
|
|
|
2024-06-01 22:18:33 +05:30
|
|
|
test('Domain Add, Update and Remove', async ({ page }) => {
|
|
|
|
await entity.domain(
|
|
|
|
page,
|
|
|
|
EntityDataClass.domain1.responseData,
|
|
|
|
EntityDataClass.domain2.responseData
|
|
|
|
);
|
|
|
|
});
|
2024-05-31 11:01:10 +05:30
|
|
|
|
2024-08-21 21:51:32 +05:30
|
|
|
test('Domain Propagation', async ({ page }) => {
|
|
|
|
const serviceCategory = entity.serviceCategory;
|
|
|
|
if (serviceCategory) {
|
|
|
|
await visitServiceDetailsPage(
|
|
|
|
page,
|
|
|
|
{
|
|
|
|
name: entity.service.name,
|
|
|
|
type: serviceCategory,
|
|
|
|
},
|
|
|
|
false
|
|
|
|
);
|
|
|
|
|
|
|
|
await assignDomain(page, EntityDataClass.domain1.responseData);
|
|
|
|
await verifyDomainPropagation(
|
|
|
|
page,
|
|
|
|
EntityDataClass.domain1.responseData,
|
|
|
|
entity.entityResponseData?.['fullyQualifiedName']
|
|
|
|
);
|
|
|
|
|
|
|
|
await visitServiceDetailsPage(
|
|
|
|
page,
|
|
|
|
{
|
|
|
|
name: entity.service.name,
|
|
|
|
type: serviceCategory,
|
|
|
|
},
|
|
|
|
false
|
|
|
|
);
|
|
|
|
await removeDomain(page);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2024-06-01 22:18:33 +05:30
|
|
|
test('User as Owner Add, Update and Remove', async ({ page }) => {
|
2024-07-29 23:06:39 -07:00
|
|
|
test.slow(true);
|
|
|
|
|
2024-06-01 22:18:33 +05:30
|
|
|
const OWNER1 = EntityDataClass.user1.getUserName();
|
|
|
|
const OWNER2 = EntityDataClass.user2.getUserName();
|
2024-07-29 23:06:39 -07:00
|
|
|
const OWNER3 = EntityDataClass.user3.getUserName();
|
|
|
|
await entity.owner(page, [OWNER1, OWNER3], [OWNER2]);
|
2024-06-01 22:18:33 +05:30
|
|
|
});
|
2024-05-31 11:01:10 +05:30
|
|
|
|
2024-06-01 22:18:33 +05:30
|
|
|
test('Team as Owner Add, Update and Remove', async ({ page }) => {
|
|
|
|
const OWNER1 = EntityDataClass.team1.data.displayName;
|
|
|
|
const OWNER2 = EntityDataClass.team2.data.displayName;
|
2024-07-29 23:06:39 -07:00
|
|
|
await entity.owner(page, [OWNER1], [OWNER2], 'Teams');
|
2024-06-01 22:18:33 +05:30
|
|
|
});
|
2024-05-31 11:01:10 +05:30
|
|
|
|
2024-06-01 22:18:33 +05:30
|
|
|
test('Tier Add, Update and Remove', async ({ page }) => {
|
2024-06-28 11:10:47 +05:30
|
|
|
await entity.tier(
|
|
|
|
page,
|
|
|
|
'Tier1',
|
|
|
|
EntityDataClass.tierTag1.data.displayName
|
|
|
|
);
|
2024-06-01 22:18:33 +05:30
|
|
|
});
|
2024-05-31 11:01:10 +05:30
|
|
|
|
2024-06-01 22:18:33 +05:30
|
|
|
test('Update description', async ({ page }) => {
|
|
|
|
await entity.descriptionUpdate(page);
|
|
|
|
});
|
2024-05-31 11:01:10 +05:30
|
|
|
|
2024-06-01 22:18:33 +05:30
|
|
|
test('Tag Add, Update and Remove', async ({ page }) => {
|
|
|
|
await entity.tag(page, 'PersonalData.Personal', 'PII.None');
|
|
|
|
});
|
2024-05-31 11:01:10 +05:30
|
|
|
|
2024-06-01 22:18:33 +05:30
|
|
|
test('Glossary Term Add, Update and Remove', async ({ page }) => {
|
|
|
|
await entity.glossaryTerm(
|
|
|
|
page,
|
|
|
|
EntityDataClass.glossaryTerm1.responseData,
|
|
|
|
EntityDataClass.glossaryTerm2.responseData
|
|
|
|
);
|
2024-05-31 11:01:10 +05:30
|
|
|
});
|
|
|
|
|
2024-08-13 18:43:03 +05:30
|
|
|
// Run only if entity has children
|
|
|
|
if (!isUndefined(entity.childrenTabId)) {
|
|
|
|
test('Tag Add, Update and Remove for child entities', async ({
|
|
|
|
page,
|
|
|
|
}) => {
|
|
|
|
await page.getByTestId(entity.childrenTabId ?? '').click();
|
|
|
|
|
|
|
|
await entity.tagChildren({
|
|
|
|
page: page,
|
|
|
|
tag1: 'PersonalData.Personal',
|
|
|
|
tag2: 'PII.None',
|
|
|
|
rowId: entity.childrenSelectorId ?? '',
|
|
|
|
rowSelector:
|
|
|
|
entity.type === 'MlModel' ? 'data-testid' : 'data-row-key',
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
// Run only if entity has children
|
|
|
|
if (!isUndefined(entity.childrenTabId)) {
|
|
|
|
test('Glossary Term Add, Update and Remove for child entities', async ({
|
|
|
|
page,
|
|
|
|
}) => {
|
|
|
|
await page.getByTestId(entity.childrenTabId ?? '').click();
|
|
|
|
|
|
|
|
await entity.glossaryTermChildren({
|
|
|
|
page: page,
|
|
|
|
glossaryTerm1: EntityDataClass.glossaryTerm1.responseData,
|
|
|
|
glossaryTerm2: EntityDataClass.glossaryTerm2.responseData,
|
|
|
|
rowId: entity.childrenSelectorId ?? '',
|
|
|
|
rowSelector:
|
|
|
|
entity.type === 'MlModel' ? 'data-testid' : 'data-row-key',
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2024-06-05 17:56:41 +05:30
|
|
|
test(`Announcement create & delete`, async ({ page }) => {
|
|
|
|
await entity.announcement(
|
|
|
|
page,
|
|
|
|
entity.entityResponseData?.['fullyQualifiedName']
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
test(`Inactive Announcement create & delete`, async ({ page }) => {
|
|
|
|
await entity.inactiveAnnouncement(page);
|
|
|
|
});
|
|
|
|
|
2024-06-11 16:57:09 +05:30
|
|
|
test(`UpVote & DownVote entity`, async ({ page }) => {
|
|
|
|
await entity.upVote(page);
|
|
|
|
await entity.downVote(page);
|
|
|
|
});
|
2024-06-06 18:00:31 +05:30
|
|
|
|
2024-06-11 16:57:09 +05:30
|
|
|
test(`Follow & Un-follow entity`, async ({ page }) => {
|
|
|
|
const entityName = entity.entityResponseData?.['displayName'];
|
|
|
|
await entity.followUnfollowEntity(page, entityName);
|
|
|
|
});
|
|
|
|
|
|
|
|
// Create custom property only for supported entities
|
|
|
|
if (CustomPropertySupportedEntityList.includes(entity.endpoint)) {
|
|
|
|
const properties = Object.values(CustomPropertyTypeByName);
|
|
|
|
const titleText = properties.join(', ');
|
|
|
|
|
|
|
|
test(`Set & Update ${titleText} Custom Property `, async ({ page }) => {
|
|
|
|
// increase timeout as it using single test for multiple steps
|
|
|
|
test.slow(true);
|
|
|
|
|
2024-06-18 11:38:46 +05:30
|
|
|
const { apiContext, afterAction } = await getApiContext(page);
|
2024-06-14 11:55:59 +05:30
|
|
|
await entity.prepareCustomProperty(apiContext);
|
|
|
|
|
2024-06-11 16:57:09 +05:30
|
|
|
await test.step(`Set ${titleText} Custom Property`, async () => {
|
|
|
|
for (const type of properties) {
|
2024-08-13 18:43:03 +05:30
|
|
|
await entity.updateCustomProperty(
|
2024-06-11 16:57:09 +05:30
|
|
|
page,
|
|
|
|
entity.customPropertyValue[type].property,
|
|
|
|
entity.customPropertyValue[type].value
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
await test.step(`Update ${titleText} Custom Property`, async () => {
|
|
|
|
for (const type of properties) {
|
|
|
|
await entity.updateCustomProperty(
|
|
|
|
page,
|
|
|
|
entity.customPropertyValue[type].property,
|
|
|
|
entity.customPropertyValue[type].newValue
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
2024-06-14 11:55:59 +05:30
|
|
|
|
|
|
|
await entity.cleanupCustomProperty(apiContext);
|
2024-06-18 11:38:46 +05:30
|
|
|
await afterAction();
|
2024-06-06 18:00:31 +05:30
|
|
|
});
|
|
|
|
}
|
2024-06-03 14:00:03 +05:30
|
|
|
|
2024-06-05 17:56:41 +05:30
|
|
|
test(`Update displayName`, async ({ page }) => {
|
|
|
|
await entity.renameEntity(page, entity.entity.name);
|
|
|
|
});
|
|
|
|
|
2024-06-01 22:18:33 +05:30
|
|
|
test.afterAll('Cleanup', async ({ browser }) => {
|
|
|
|
const { apiContext, afterAction } = await createNewPage(browser);
|
|
|
|
await entity.delete(apiContext);
|
|
|
|
await EntityDataClass.postRequisitesForTests(apiContext);
|
|
|
|
await afterAction();
|
|
|
|
});
|
2024-05-31 11:01:10 +05:30
|
|
|
});
|
2024-06-05 17:56:41 +05:30
|
|
|
|
|
|
|
test(`Delete ${deleteEntity.getType()}`, async ({ page }) => {
|
2024-06-11 16:57:09 +05:30
|
|
|
// increase timeout as it using single test for multiple steps
|
|
|
|
test.slow(true);
|
|
|
|
|
2024-06-05 17:56:41 +05:30
|
|
|
await redirectToHomePage(page);
|
|
|
|
// get the token from localStorage
|
|
|
|
const token = await getToken(page);
|
|
|
|
|
|
|
|
// create a new context with the token
|
|
|
|
const apiContext = await getAuthContext(token);
|
|
|
|
await deleteEntity.create(apiContext);
|
|
|
|
await redirectToHomePage(page);
|
|
|
|
await deleteEntity.visitEntityPage(page);
|
|
|
|
|
|
|
|
await test.step('Soft delete', async () => {
|
|
|
|
await deleteEntity.softDeleteEntity(
|
|
|
|
page,
|
|
|
|
deleteEntity.entity.name,
|
|
|
|
deleteEntity.entityResponseData?.['displayName']
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
await test.step('Hard delete', async () => {
|
|
|
|
await deleteEntity.hardDeleteEntity(
|
|
|
|
page,
|
|
|
|
deleteEntity.entity.name,
|
|
|
|
deleteEntity.entityResponseData?.['displayName']
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|
2024-05-31 11:01:10 +05:30
|
|
|
});
|