2024-07-01 20:16:54 +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.
|
|
|
|
*/
|
|
|
|
import { test } from '@playwright/test';
|
|
|
|
import { toLower } from 'lodash';
|
|
|
|
import { ContainerClass } from '../../support/entity/ContainerClass';
|
|
|
|
import { DashboardClass } from '../../support/entity/DashboardClass';
|
|
|
|
import { MlModelClass } from '../../support/entity/MlModelClass';
|
|
|
|
import { PipelineClass } from '../../support/entity/PipelineClass';
|
|
|
|
import { SearchIndexClass } from '../../support/entity/SearchIndexClass';
|
|
|
|
import { TableClass } from '../../support/entity/TableClass';
|
|
|
|
import { TopicClass } from '../../support/entity/TopicClass';
|
2024-07-09 17:49:10 +05:30
|
|
|
import { UserClass } from '../../support/user/UserClass';
|
2024-07-30 15:05:56 +05:30
|
|
|
import { performAdminLogin } from '../../utils/admin';
|
2024-07-01 20:16:54 +05:30
|
|
|
import {
|
|
|
|
getEntityTypeSearchIndexMapping,
|
|
|
|
redirectToHomePage,
|
|
|
|
} from '../../utils/common';
|
|
|
|
import { checkDataAssetWidget } from '../../utils/entity';
|
2024-07-30 15:05:56 +05:30
|
|
|
import { performUserLogin } from '../../utils/user';
|
2024-07-01 20:16:54 +05:30
|
|
|
|
|
|
|
const entities = [
|
|
|
|
TableClass,
|
|
|
|
DashboardClass,
|
|
|
|
PipelineClass,
|
|
|
|
TopicClass,
|
|
|
|
ContainerClass,
|
|
|
|
MlModelClass,
|
|
|
|
SearchIndexClass,
|
|
|
|
] as const;
|
|
|
|
|
|
|
|
const menuLabel = {
|
|
|
|
Table: 'Tables',
|
|
|
|
Dashboard: 'Dashboards',
|
|
|
|
Pipeline: 'Pipelines',
|
|
|
|
Topic: 'Topics',
|
|
|
|
Container: 'Containers',
|
|
|
|
MlModel: 'ML Models',
|
|
|
|
SearchIndex: 'search Search Indexes',
|
|
|
|
};
|
|
|
|
|
|
|
|
entities.forEach((EntityClass) => {
|
2024-07-09 17:49:10 +05:30
|
|
|
const user = new UserClass();
|
2024-07-01 20:16:54 +05:30
|
|
|
const entity = new EntityClass();
|
|
|
|
|
|
|
|
test.describe(entity.getType(), () => {
|
|
|
|
test.beforeAll('Setup pre-requests', async ({ browser }) => {
|
2024-07-09 17:49:10 +05:30
|
|
|
const { apiContext, afterAction } = await performAdminLogin(browser);
|
|
|
|
await user.create(apiContext);
|
2024-07-01 20:16:54 +05:30
|
|
|
await entity.create(apiContext);
|
|
|
|
await afterAction();
|
|
|
|
});
|
|
|
|
|
2024-07-09 17:49:10 +05:30
|
|
|
test('Check Data Asset and Service Filtration', async ({ browser }) => {
|
|
|
|
const { page, afterAction } = await performUserLogin(browser, user);
|
2024-07-01 20:16:54 +05:30
|
|
|
await redirectToHomePage(page);
|
|
|
|
await checkDataAssetWidget(
|
|
|
|
page,
|
|
|
|
menuLabel[entity.type],
|
|
|
|
getEntityTypeSearchIndexMapping(entity.type),
|
|
|
|
toLower(entity.service.serviceType)
|
|
|
|
);
|
2024-07-09 17:49:10 +05:30
|
|
|
await afterAction();
|
2024-07-01 20:16:54 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
test.afterAll('Cleanup', async ({ browser }) => {
|
2024-07-09 17:49:10 +05:30
|
|
|
const { apiContext, afterAction } = await performAdminLogin(browser);
|
|
|
|
await user.delete(apiContext);
|
2024-07-01 20:16:54 +05:30
|
|
|
await entity.delete(apiContext);
|
|
|
|
await afterAction();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|