Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

1044 lines
29 KiB
TypeScript
Raw Normal View History

/*
* Copyright 2025 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, { APIRequestContext, expect, Page } from '@playwright/test';
[RbacDomain] RBAC with Domain Restrictions (#16586) * Add domain field to entity jsons * add subdomains ui * Add Domain To create Request * Typo fix * commit progress * allow multiple domains * - add userDomains and teamDomains * - Restrict Api Access * allow multiple domain support * - Add Listing Restricition - Add Search Restrictions * - Field Fix * - Inherit Team Domains * remove glossary filter from ui * - Fix Tag and User Filter * - Id -> FQN in create * - Missing domain on indexes * add domain in creation of team, user and glossary * fix merge conflicts * fix feedbacks * fix tests * add domain playwright * minor changes * fix domain fetching calls * Add Thread Listing with EntityDomain * Fixes for Team Join * Mkae list mutable * Add missing import * Fix Team Test * User Test case fix * Fix User Domain * Minor bug fixes related to sub domains * Fix data retaining in add sub domain modal after closing * fix NavBar unit test * Make Domain Access Work Via Policies * Fix errors introduced after conflict resolutions * update render function in SubDomainsTable.component.tsx to accept an array of owners instead of a single owner * fix java checkstyle * fix py-test * format * Fix the domain e2e owner field type * Fix Failing Tests * fixed pytest list index * update userDomains and teamDomains to domains * Entity Domain to Domain for thread and changeEvent * FIx fields * @Ovveride * FIx * Remove Duplicate Field * Remove Duplicate Field * Fix Failing Test * fix domain related changes * fix subdomains loader * Fix Owners Order * Enforce Domain Permissions * fix domain cleanup * Fix Test * rever owner change --------- Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Aniket Katkar <aniketkatkar97@gmail.com> Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: sonikashah <sonikashah94@gmail.com> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com>
2024-08-02 10:16:14 +05:30
import { get, isEmpty, isUndefined } from 'lodash';
import { SidebarItem } from '../constant/sidebar';
import { PolicyClass } from '../support/access-control/PoliciesClass';
import { RolesClass } from '../support/access-control/RolesClass';
[RbacDomain] RBAC with Domain Restrictions (#16586) * Add domain field to entity jsons * add subdomains ui * Add Domain To create Request * Typo fix * commit progress * allow multiple domains * - add userDomains and teamDomains * - Restrict Api Access * allow multiple domain support * - Add Listing Restricition - Add Search Restrictions * - Field Fix * - Inherit Team Domains * remove glossary filter from ui * - Fix Tag and User Filter * - Id -> FQN in create * - Missing domain on indexes * add domain in creation of team, user and glossary * fix merge conflicts * fix feedbacks * fix tests * add domain playwright * minor changes * fix domain fetching calls * Add Thread Listing with EntityDomain * Fixes for Team Join * Mkae list mutable * Add missing import * Fix Team Test * User Test case fix * Fix User Domain * Minor bug fixes related to sub domains * Fix data retaining in add sub domain modal after closing * fix NavBar unit test * Make Domain Access Work Via Policies * Fix errors introduced after conflict resolutions * update render function in SubDomainsTable.component.tsx to accept an array of owners instead of a single owner * fix java checkstyle * fix py-test * format * Fix the domain e2e owner field type * Fix Failing Tests * fixed pytest list index * update userDomains and teamDomains to domains * Entity Domain to Domain for thread and changeEvent * FIx fields * @Ovveride * FIx * Remove Duplicate Field * Remove Duplicate Field * Fix Failing Test * fix domain related changes * fix subdomains loader * Fix Owners Order * Enforce Domain Permissions * fix domain cleanup * Fix Test * rever owner change --------- Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Aniket Katkar <aniketkatkar97@gmail.com> Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: sonikashah <sonikashah94@gmail.com> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com>
2024-08-02 10:16:14 +05:30
import { DataProduct } from '../support/domain/DataProduct';
import { Domain } from '../support/domain/Domain';
import { SubDomain } from '../support/domain/SubDomain';
[RbacDomain] RBAC with Domain Restrictions (#16586) * Add domain field to entity jsons * add subdomains ui * Add Domain To create Request * Typo fix * commit progress * allow multiple domains * - add userDomains and teamDomains * - Restrict Api Access * allow multiple domain support * - Add Listing Restricition - Add Search Restrictions * - Field Fix * - Inherit Team Domains * remove glossary filter from ui * - Fix Tag and User Filter * - Id -> FQN in create * - Missing domain on indexes * add domain in creation of team, user and glossary * fix merge conflicts * fix feedbacks * fix tests * add domain playwright * minor changes * fix domain fetching calls * Add Thread Listing with EntityDomain * Fixes for Team Join * Mkae list mutable * Add missing import * Fix Team Test * User Test case fix * Fix User Domain * Minor bug fixes related to sub domains * Fix data retaining in add sub domain modal after closing * fix NavBar unit test * Make Domain Access Work Via Policies * Fix errors introduced after conflict resolutions * update render function in SubDomainsTable.component.tsx to accept an array of owners instead of a single owner * fix java checkstyle * fix py-test * format * Fix the domain e2e owner field type * Fix Failing Tests * fixed pytest list index * update userDomains and teamDomains to domains * Entity Domain to Domain for thread and changeEvent * FIx fields * @Ovveride * FIx * Remove Duplicate Field * Remove Duplicate Field * Fix Failing Test * fix domain related changes * fix subdomains loader * Fix Owners Order * Enforce Domain Permissions * fix domain cleanup * Fix Test * rever owner change --------- Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Aniket Katkar <aniketkatkar97@gmail.com> Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: sonikashah <sonikashah94@gmail.com> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com>
2024-08-02 10:16:14 +05:30
import { DashboardClass } from '../support/entity/DashboardClass';
import { EntityTypeEndpoint } from '../support/entity/Entity.interface';
import { EntityClass } from '../support/entity/EntityClass';
import { TableClass } from '../support/entity/TableClass';
import { TopicClass } from '../support/entity/TopicClass';
import { TeamClass } from '../support/team/TeamClass';
import { UserClass } from '../support/user/UserClass';
[RbacDomain] RBAC with Domain Restrictions (#16586) * Add domain field to entity jsons * add subdomains ui * Add Domain To create Request * Typo fix * commit progress * allow multiple domains * - add userDomains and teamDomains * - Restrict Api Access * allow multiple domain support * - Add Listing Restricition - Add Search Restrictions * - Field Fix * - Inherit Team Domains * remove glossary filter from ui * - Fix Tag and User Filter * - Id -> FQN in create * - Missing domain on indexes * add domain in creation of team, user and glossary * fix merge conflicts * fix feedbacks * fix tests * add domain playwright * minor changes * fix domain fetching calls * Add Thread Listing with EntityDomain * Fixes for Team Join * Mkae list mutable * Add missing import * Fix Team Test * User Test case fix * Fix User Domain * Minor bug fixes related to sub domains * Fix data retaining in add sub domain modal after closing * fix NavBar unit test * Make Domain Access Work Via Policies * Fix errors introduced after conflict resolutions * update render function in SubDomainsTable.component.tsx to accept an array of owners instead of a single owner * fix java checkstyle * fix py-test * format * Fix the domain e2e owner field type * Fix Failing Tests * fixed pytest list index * update userDomains and teamDomains to domains * Entity Domain to Domain for thread and changeEvent * FIx fields * @Ovveride * FIx * Remove Duplicate Field * Remove Duplicate Field * Fix Failing Test * fix domain related changes * fix subdomains loader * Fix Owners Order * Enforce Domain Permissions * fix domain cleanup * Fix Test * rever owner change --------- Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Aniket Katkar <aniketkatkar97@gmail.com> Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: sonikashah <sonikashah94@gmail.com> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com>
2024-08-02 10:16:14 +05:30
import {
closeFirstPopupAlert,
[RbacDomain] RBAC with Domain Restrictions (#16586) * Add domain field to entity jsons * add subdomains ui * Add Domain To create Request * Typo fix * commit progress * allow multiple domains * - add userDomains and teamDomains * - Restrict Api Access * allow multiple domain support * - Add Listing Restricition - Add Search Restrictions * - Field Fix * - Inherit Team Domains * remove glossary filter from ui * - Fix Tag and User Filter * - Id -> FQN in create * - Missing domain on indexes * add domain in creation of team, user and glossary * fix merge conflicts * fix feedbacks * fix tests * add domain playwright * minor changes * fix domain fetching calls * Add Thread Listing with EntityDomain * Fixes for Team Join * Mkae list mutable * Add missing import * Fix Team Test * User Test case fix * Fix User Domain * Minor bug fixes related to sub domains * Fix data retaining in add sub domain modal after closing * fix NavBar unit test * Make Domain Access Work Via Policies * Fix errors introduced after conflict resolutions * update render function in SubDomainsTable.component.tsx to accept an array of owners instead of a single owner * fix java checkstyle * fix py-test * format * Fix the domain e2e owner field type * Fix Failing Tests * fixed pytest list index * update userDomains and teamDomains to domains * Entity Domain to Domain for thread and changeEvent * FIx fields * @Ovveride * FIx * Remove Duplicate Field * Remove Duplicate Field * Fix Failing Test * fix domain related changes * fix subdomains loader * Fix Owners Order * Enforce Domain Permissions * fix domain cleanup * Fix Test * rever owner change --------- Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Aniket Katkar <aniketkatkar97@gmail.com> Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: sonikashah <sonikashah94@gmail.com> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com>
2024-08-02 10:16:14 +05:30
descriptionBox,
getApiContext,
INVALID_NAMES,
NAME_MAX_LENGTH_VALIDATION_ERROR,
NAME_VALIDATION_ERROR,
redirectToHomePage,
2025-09-26 20:31:39 +05:30
toastNotification,
uuid,
[RbacDomain] RBAC with Domain Restrictions (#16586) * Add domain field to entity jsons * add subdomains ui * Add Domain To create Request * Typo fix * commit progress * allow multiple domains * - add userDomains and teamDomains * - Restrict Api Access * allow multiple domain support * - Add Listing Restricition - Add Search Restrictions * - Field Fix * - Inherit Team Domains * remove glossary filter from ui * - Fix Tag and User Filter * - Id -> FQN in create * - Missing domain on indexes * add domain in creation of team, user and glossary * fix merge conflicts * fix feedbacks * fix tests * add domain playwright * minor changes * fix domain fetching calls * Add Thread Listing with EntityDomain * Fixes for Team Join * Mkae list mutable * Add missing import * Fix Team Test * User Test case fix * Fix User Domain * Minor bug fixes related to sub domains * Fix data retaining in add sub domain modal after closing * fix NavBar unit test * Make Domain Access Work Via Policies * Fix errors introduced after conflict resolutions * update render function in SubDomainsTable.component.tsx to accept an array of owners instead of a single owner * fix java checkstyle * fix py-test * format * Fix the domain e2e owner field type * Fix Failing Tests * fixed pytest list index * update userDomains and teamDomains to domains * Entity Domain to Domain for thread and changeEvent * FIx fields * @Ovveride * FIx * Remove Duplicate Field * Remove Duplicate Field * Fix Failing Test * fix domain related changes * fix subdomains loader * Fix Owners Order * Enforce Domain Permissions * fix domain cleanup * Fix Test * rever owner change --------- Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Aniket Katkar <aniketkatkar97@gmail.com> Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: sonikashah <sonikashah94@gmail.com> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com>
2024-08-02 10:16:14 +05:30
} from './common';
import { addOwner, waitForAllLoadersToDisappear } from './entity';
import { sidebarClick } from './sidebar';
export const assignDomain = async (page: Page, domain: Domain['data']) => {
2025-09-26 20:31:39 +05:30
await page.getByTestId('add-entity-button').click();
await page.waitForSelector('[data-testid="loader"]', { state: 'detached' });
const searchDomain = page.waitForResponse(
`/api/v1/search/query?q=*${encodeURIComponent(domain.name)}*`
);
await page
.getByTestId('selectable-list')
.getByTestId('searchbar')
.fill(domain.name);
await searchDomain;
await page.getByRole('listitem', { name: domain.displayName }).click();
Data contracts support for tables & Multi Domain Migration (#22108) * WIP - MINOR - Rule Engine * WIP - MINOR - Rule Engine * WIP - MINOR - Rule Engine * WIP - MINOR - Rule Engine * rules * rules * rules * fix retrieval by entity * test dc * test dc * WIP: Data contract feature * destructure component to it's own files * WIP contract tab * update local * fix test * First iteration for multi domain support * fix inheritance fields * fix inheritance fields * fix create interface * fix few more tests * fix indexing updates * fix domain rel * update domain --> domains * merge * fix merge * fix csv tests and createEntity interface * Update generated TypeScript types * Trigger Build * migrations * fix tests * fix tests * fix tests * Update generated TypeScript types * Trigger Build * handle drive service * fix pg migration * fix domains ref after merge and clean python tests * Update generated TypeScript types * fix merge domains * format * add missing migrations * Update generated TypeScript types * tests * Update generated TypeScript types * Trigger Build * tests * tests * fix py test * migrate domain to domains and fix compilation errors * fix domain assignement * fix domain spec * fix py tests * fix data product creation issue * fix domain tests * fix bulk import * fix tests * fix tests * fix query and domain migration * fix py test * fix playwrights * fix getEntitiesWithDisplayName indexing quotes * fix domain prapogation tests * fix domain propagation * Fix patch api * fix domain schema build edit playwright * fix test * fix test * fix domain selection issue and console errors * quick fix landing page changes * fix remaining tests * fix ui tests * Fix adding data products * format --------- Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Sriharsha Chintalapani <harsha@getcollate.io> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com>
2025-07-22 13:04:50 +05:30
const patchReq = page.waitForResponse(
(req) => req.request().method() === 'PATCH'
);
await page.getByTestId('saveAssociatedTag').click();
await patchReq;
await page.waitForSelector('[data-testid="loader"]', { state: 'detached' });
await expect(page.getByTestId('domain-link')).toContainText(
domain.displayName
);
};
export const updateDomain = async (page: Page, domain: Domain['data']) => {
2025-09-26 20:31:39 +05:30
await page.getByTestId('add-entity-button').click();
await page.waitForSelector('[data-testid="loader"]', { state: 'detached' });
await page.getByTestId('selectable-list').getByTestId('searchbar').clear();
const searchDomain = page.waitForResponse(
`/api/v1/search/query?q=*${encodeURIComponent(domain.name)}*`
);
await page
.getByTestId('selectable-list')
.getByTestId('searchbar')
.fill(domain.name);
await searchDomain;
await page.getByRole('listitem', { name: domain.displayName }).click();
await expect(page.getByTestId('domain-link')).toContainText(
domain.displayName
);
};
export const removeDomain = async (page: Page) => {
2025-09-26 20:31:39 +05:30
await page.getByTestId('add-entity-button').click();
await page.waitForSelector('[data-testid="loader"]', { state: 'detached' });
await expect(page.getByTestId('remove-owner').locator('path')).toBeVisible();
await page.getByTestId('remove-owner').locator('svg').click();
await expect(page.getByTestId('no-domain-text')).toContainText('No Domain');
};
[RbacDomain] RBAC with Domain Restrictions (#16586) * Add domain field to entity jsons * add subdomains ui * Add Domain To create Request * Typo fix * commit progress * allow multiple domains * - add userDomains and teamDomains * - Restrict Api Access * allow multiple domain support * - Add Listing Restricition - Add Search Restrictions * - Field Fix * - Inherit Team Domains * remove glossary filter from ui * - Fix Tag and User Filter * - Id -> FQN in create * - Missing domain on indexes * add domain in creation of team, user and glossary * fix merge conflicts * fix feedbacks * fix tests * add domain playwright * minor changes * fix domain fetching calls * Add Thread Listing with EntityDomain * Fixes for Team Join * Mkae list mutable * Add missing import * Fix Team Test * User Test case fix * Fix User Domain * Minor bug fixes related to sub domains * Fix data retaining in add sub domain modal after closing * fix NavBar unit test * Make Domain Access Work Via Policies * Fix errors introduced after conflict resolutions * update render function in SubDomainsTable.component.tsx to accept an array of owners instead of a single owner * fix java checkstyle * fix py-test * format * Fix the domain e2e owner field type * Fix Failing Tests * fixed pytest list index * update userDomains and teamDomains to domains * Entity Domain to Domain for thread and changeEvent * FIx fields * @Ovveride * FIx * Remove Duplicate Field * Remove Duplicate Field * Fix Failing Test * fix domain related changes * fix subdomains loader * Fix Owners Order * Enforce Domain Permissions * fix domain cleanup * Fix Test * rever owner change --------- Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Aniket Katkar <aniketkatkar97@gmail.com> Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: sonikashah <sonikashah94@gmail.com> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com>
2024-08-02 10:16:14 +05:30
export const validateDomainForm = async (page: Page) => {
[RbacDomain] RBAC with Domain Restrictions (#16586) * Add domain field to entity jsons * add subdomains ui * Add Domain To create Request * Typo fix * commit progress * allow multiple domains * - add userDomains and teamDomains * - Restrict Api Access * allow multiple domain support * - Add Listing Restricition - Add Search Restrictions * - Field Fix * - Inherit Team Domains * remove glossary filter from ui * - Fix Tag and User Filter * - Id -> FQN in create * - Missing domain on indexes * add domain in creation of team, user and glossary * fix merge conflicts * fix feedbacks * fix tests * add domain playwright * minor changes * fix domain fetching calls * Add Thread Listing with EntityDomain * Fixes for Team Join * Mkae list mutable * Add missing import * Fix Team Test * User Test case fix * Fix User Domain * Minor bug fixes related to sub domains * Fix data retaining in add sub domain modal after closing * fix NavBar unit test * Make Domain Access Work Via Policies * Fix errors introduced after conflict resolutions * update render function in SubDomainsTable.component.tsx to accept an array of owners instead of a single owner * fix java checkstyle * fix py-test * format * Fix the domain e2e owner field type * Fix Failing Tests * fixed pytest list index * update userDomains and teamDomains to domains * Entity Domain to Domain for thread and changeEvent * FIx fields * @Ovveride * FIx * Remove Duplicate Field * Remove Duplicate Field * Fix Failing Test * fix domain related changes * fix subdomains loader * Fix Owners Order * Enforce Domain Permissions * fix domain cleanup * Fix Test * rever owner change --------- Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Aniket Katkar <aniketkatkar97@gmail.com> Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: sonikashah <sonikashah94@gmail.com> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com>
2024-08-02 10:16:14 +05:30
// Error messages
await expect(page.locator('#name_help')).toHaveText('Name is required');
await expect(page.locator('#description_help')).toHaveText(
'Description is required'
);
// Max length validation
await page.locator('[data-testid="name"]').type(INVALID_NAMES.MAX_LENGTH);
await expect(page.locator('#name_help')).toHaveText(
NAME_MAX_LENGTH_VALIDATION_ERROR
);
// With special char validation
await page.locator('[data-testid="name"]').clear();
await page
.locator('[data-testid="name"]')
.type(INVALID_NAMES.WITH_SPECIAL_CHARS);
await expect(page.locator('#name_help')).toHaveText(NAME_VALIDATION_ERROR);
};
2025-09-26 20:31:39 +05:30
export const selectDomain = async (page: Page, domain: Domain['data']) => {
const searchBox = page
.getByTestId('page-layout-v1')
.getByRole('textbox', { name: 'Search' });
const domainRes = page.waitForResponse(
'/api/v1/search/query?q=*&index=domain_search_index*'
);
await searchBox.fill(domain.name);
await domainRes;
await page.waitForSelector('[data-testid="loader"]', {
state: 'detached',
2025-09-13 13:44:24 +05:30
});
2025-09-26 20:31:39 +05:30
await page.getByRole('row', { name: domain.displayName }).click();
2025-09-13 13:44:24 +05:30
2025-06-26 19:08:53 +05:30
await page.waitForLoadState('networkidle');
2025-09-13 13:44:24 +05:30
await page.waitForSelector('[data-testid="loader"]', {
state: 'detached',
});
[RbacDomain] RBAC with Domain Restrictions (#16586) * Add domain field to entity jsons * add subdomains ui * Add Domain To create Request * Typo fix * commit progress * allow multiple domains * - add userDomains and teamDomains * - Restrict Api Access * allow multiple domain support * - Add Listing Restricition - Add Search Restrictions * - Field Fix * - Inherit Team Domains * remove glossary filter from ui * - Fix Tag and User Filter * - Id -> FQN in create * - Missing domain on indexes * add domain in creation of team, user and glossary * fix merge conflicts * fix feedbacks * fix tests * add domain playwright * minor changes * fix domain fetching calls * Add Thread Listing with EntityDomain * Fixes for Team Join * Mkae list mutable * Add missing import * Fix Team Test * User Test case fix * Fix User Domain * Minor bug fixes related to sub domains * Fix data retaining in add sub domain modal after closing * fix NavBar unit test * Make Domain Access Work Via Policies * Fix errors introduced after conflict resolutions * update render function in SubDomainsTable.component.tsx to accept an array of owners instead of a single owner * fix java checkstyle * fix py-test * format * Fix the domain e2e owner field type * Fix Failing Tests * fixed pytest list index * update userDomains and teamDomains to domains * Entity Domain to Domain for thread and changeEvent * FIx fields * @Ovveride * FIx * Remove Duplicate Field * Remove Duplicate Field * Fix Failing Test * fix domain related changes * fix subdomains loader * Fix Owners Order * Enforce Domain Permissions * fix domain cleanup * Fix Test * rever owner change --------- Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Aniket Katkar <aniketkatkar97@gmail.com> Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: sonikashah <sonikashah94@gmail.com> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com>
2024-08-02 10:16:14 +05:30
};
export const selectSubDomain = async (
page: Page,
domain: Domain['data'],
subDomain: SubDomain['data']
) => {
const menuItem = page.getByRole('menuitem', { name: domain.displayName });
const isSelected = await menuItem.evaluate((element) => {
return element.classList.contains('ant-menu-item-selected');
});
if (!isSelected) {
2025-08-06 13:18:58 +05:30
const subDomainRes = page.waitForResponse(
'/api/v1/search/query?q=*&from=0&size=0&index=domain_search_index&deleted=false&track_total_hits=true'
2025-08-06 13:18:58 +05:30
);
await menuItem.click();
2025-08-06 13:18:58 +05:30
await subDomainRes;
await page.waitForLoadState('networkidle');
}
const subDomainRes = page.waitForResponse(
'/api/v1/search/query?q=*&from=0&size=50&index=domain_search_index&deleted=false&track_total_hits=true'
);
await page.getByTestId('subdomains').getByText('Sub Domains').click();
await subDomainRes;
await page.waitForSelector('[data-testid="loader"]', {
state: 'detached',
});
await page.getByTestId(subDomain.name).click();
await page.waitForLoadState('networkidle');
};
export const selectDataProductFromTab = async (
page: Page,
dataProduct: DataProduct['data']
) => {
const dpRes = page.waitForResponse(
'/api/v1/search/query?*&from=0&size=50&index=data_product_search_index*'
);
await page
.locator('.domain-details-page-tabs')
.getByText('Data Products')
.click();
await dpRes;
await page.waitForSelector('[data-testid="loader"]', { state: 'detached' });
const dpDataRes = page.waitForResponse('/api/v1/dataProducts/name/*');
await page
.getByTestId(`explore-card-${dataProduct.name}`)
.getByTestId('entity-link')
.click();
await dpDataRes;
};
[RbacDomain] RBAC with Domain Restrictions (#16586) * Add domain field to entity jsons * add subdomains ui * Add Domain To create Request * Typo fix * commit progress * allow multiple domains * - add userDomains and teamDomains * - Restrict Api Access * allow multiple domain support * - Add Listing Restricition - Add Search Restrictions * - Field Fix * - Inherit Team Domains * remove glossary filter from ui * - Fix Tag and User Filter * - Id -> FQN in create * - Missing domain on indexes * add domain in creation of team, user and glossary * fix merge conflicts * fix feedbacks * fix tests * add domain playwright * minor changes * fix domain fetching calls * Add Thread Listing with EntityDomain * Fixes for Team Join * Mkae list mutable * Add missing import * Fix Team Test * User Test case fix * Fix User Domain * Minor bug fixes related to sub domains * Fix data retaining in add sub domain modal after closing * fix NavBar unit test * Make Domain Access Work Via Policies * Fix errors introduced after conflict resolutions * update render function in SubDomainsTable.component.tsx to accept an array of owners instead of a single owner * fix java checkstyle * fix py-test * format * Fix the domain e2e owner field type * Fix Failing Tests * fixed pytest list index * update userDomains and teamDomains to domains * Entity Domain to Domain for thread and changeEvent * FIx fields * @Ovveride * FIx * Remove Duplicate Field * Remove Duplicate Field * Fix Failing Test * fix domain related changes * fix subdomains loader * Fix Owners Order * Enforce Domain Permissions * fix domain cleanup * Fix Test * rever owner change --------- Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Aniket Katkar <aniketkatkar97@gmail.com> Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: sonikashah <sonikashah94@gmail.com> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com>
2024-08-02 10:16:14 +05:30
export const selectDataProduct = async (
page: Page,
domain: Domain['data'],
dataProduct: DataProduct['data']
) => {
await page
.getByRole('menuitem', { name: domain.displayName })
.locator('span')
.click();
await selectDataProductFromTab(page, dataProduct);
[RbacDomain] RBAC with Domain Restrictions (#16586) * Add domain field to entity jsons * add subdomains ui * Add Domain To create Request * Typo fix * commit progress * allow multiple domains * - add userDomains and teamDomains * - Restrict Api Access * allow multiple domain support * - Add Listing Restricition - Add Search Restrictions * - Field Fix * - Inherit Team Domains * remove glossary filter from ui * - Fix Tag and User Filter * - Id -> FQN in create * - Missing domain on indexes * add domain in creation of team, user and glossary * fix merge conflicts * fix feedbacks * fix tests * add domain playwright * minor changes * fix domain fetching calls * Add Thread Listing with EntityDomain * Fixes for Team Join * Mkae list mutable * Add missing import * Fix Team Test * User Test case fix * Fix User Domain * Minor bug fixes related to sub domains * Fix data retaining in add sub domain modal after closing * fix NavBar unit test * Make Domain Access Work Via Policies * Fix errors introduced after conflict resolutions * update render function in SubDomainsTable.component.tsx to accept an array of owners instead of a single owner * fix java checkstyle * fix py-test * format * Fix the domain e2e owner field type * Fix Failing Tests * fixed pytest list index * update userDomains and teamDomains to domains * Entity Domain to Domain for thread and changeEvent * FIx fields * @Ovveride * FIx * Remove Duplicate Field * Remove Duplicate Field * Fix Failing Test * fix domain related changes * fix subdomains loader * Fix Owners Order * Enforce Domain Permissions * fix domain cleanup * Fix Test * rever owner change --------- Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Aniket Katkar <aniketkatkar97@gmail.com> Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: sonikashah <sonikashah94@gmail.com> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com>
2024-08-02 10:16:14 +05:30
};
const goToAssetsTab = async (page: Page, domain: Domain['data']) => {
await selectDomain(page, domain);
await checkDomainDisplayName(page, domain.displayName);
2025-09-26 20:31:39 +05:30
await page.getByRole('tab', { name: /Assets/ }).click();
await waitForAllLoadersToDisappear(page);
[RbacDomain] RBAC with Domain Restrictions (#16586) * Add domain field to entity jsons * add subdomains ui * Add Domain To create Request * Typo fix * commit progress * allow multiple domains * - add userDomains and teamDomains * - Restrict Api Access * allow multiple domain support * - Add Listing Restricition - Add Search Restrictions * - Field Fix * - Inherit Team Domains * remove glossary filter from ui * - Fix Tag and User Filter * - Id -> FQN in create * - Missing domain on indexes * add domain in creation of team, user and glossary * fix merge conflicts * fix feedbacks * fix tests * add domain playwright * minor changes * fix domain fetching calls * Add Thread Listing with EntityDomain * Fixes for Team Join * Mkae list mutable * Add missing import * Fix Team Test * User Test case fix * Fix User Domain * Minor bug fixes related to sub domains * Fix data retaining in add sub domain modal after closing * fix NavBar unit test * Make Domain Access Work Via Policies * Fix errors introduced after conflict resolutions * update render function in SubDomainsTable.component.tsx to accept an array of owners instead of a single owner * fix java checkstyle * fix py-test * format * Fix the domain e2e owner field type * Fix Failing Tests * fixed pytest list index * update userDomains and teamDomains to domains * Entity Domain to Domain for thread and changeEvent * FIx fields * @Ovveride * FIx * Remove Duplicate Field * Remove Duplicate Field * Fix Failing Test * fix domain related changes * fix subdomains loader * Fix Owners Order * Enforce Domain Permissions * fix domain cleanup * Fix Test * rever owner change --------- Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Aniket Katkar <aniketkatkar97@gmail.com> Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: sonikashah <sonikashah94@gmail.com> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com>
2024-08-02 10:16:14 +05:30
};
const fillCommonFormItems = async (
page: Page,
entity: Domain['data'] | DataProduct['data'] | SubDomain['data']
[RbacDomain] RBAC with Domain Restrictions (#16586) * Add domain field to entity jsons * add subdomains ui * Add Domain To create Request * Typo fix * commit progress * allow multiple domains * - add userDomains and teamDomains * - Restrict Api Access * allow multiple domain support * - Add Listing Restricition - Add Search Restrictions * - Field Fix * - Inherit Team Domains * remove glossary filter from ui * - Fix Tag and User Filter * - Id -> FQN in create * - Missing domain on indexes * add domain in creation of team, user and glossary * fix merge conflicts * fix feedbacks * fix tests * add domain playwright * minor changes * fix domain fetching calls * Add Thread Listing with EntityDomain * Fixes for Team Join * Mkae list mutable * Add missing import * Fix Team Test * User Test case fix * Fix User Domain * Minor bug fixes related to sub domains * Fix data retaining in add sub domain modal after closing * fix NavBar unit test * Make Domain Access Work Via Policies * Fix errors introduced after conflict resolutions * update render function in SubDomainsTable.component.tsx to accept an array of owners instead of a single owner * fix java checkstyle * fix py-test * format * Fix the domain e2e owner field type * Fix Failing Tests * fixed pytest list index * update userDomains and teamDomains to domains * Entity Domain to Domain for thread and changeEvent * FIx fields * @Ovveride * FIx * Remove Duplicate Field * Remove Duplicate Field * Fix Failing Test * fix domain related changes * fix subdomains loader * Fix Owners Order * Enforce Domain Permissions * fix domain cleanup * Fix Test * rever owner change --------- Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Aniket Katkar <aniketkatkar97@gmail.com> Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: sonikashah <sonikashah94@gmail.com> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com>
2024-08-02 10:16:14 +05:30
) => {
2025-09-26 20:31:39 +05:30
await page.locator('#root\\/name').fill(entity.name);
await page.locator('#root\\/displayName').fill(entity.displayName);
feat(#15380): replace description editor with block editor (#19003) * feat(#15380): replace the description editor with a new block editor. * chore: Add placeholder support to BlockEditor * feat: Add autofocus support to BlockEditor * chore: implement block editor in richtext editor * chore: Remove unused CSS import in RichTextEditor * fix: ensure safe access to getEditorContent in Markdown editor components * minor change * fix: add support for ttf file extension in pom.xml * fix: adjust block editor styles for better usability and overflow handling * fix: update RichTextEditorPreviewer to RichTextEditorPreviewerV1 and adjust block editor styles * fix: update description box selector to use om-block-editor for consistency * fix: disable autoFocus on BlockEditor in RichTextEditorPreviewerV1 * refactor: update RichTextEditorPreviewer references to RichTextEditorPreviewerV1 in tests * test: update timer handling in ApplicationCard and SuggestionsAlert tests * fix(diff): update diff view rendering and attributes for consistency * fix(RichTextEditor): add placeholder for empty markdown descriptions * Add data-diff in <span> * Fix test * fix: update description box selector to use locator method for better reliability * feat: integrate RichTextEditorPreviewerV1 for description rendering in Notification and Observability Alerts pages * feat: add markdown conversion for mentions and hashtags in BlockEditorUtils * fix: update initial value handling in TagsForm and formUtils * MINOR - Update description handling in Playwright tests and utilities * Refactor Playwright tests to use descriptionBox for tag and team descriptions * Refactor custom property handling and update description check logic * Enhance entity version page tests by adding description box read-only check and updating data-testid attributes * Refactor description handling and improve diff rendering logic in task pages * Fix user description clearing logic in UserDetails.spec.ts * Enhance Rich Text Editor by adding custom styles and converting markdown to HTML for backward compatibility * Remove test for rendering alert description when not present in AlertDetailsPage * Clean up RichTextEditorPreviewerV1 by removing unnecessary comments and improving readability * Update SearchIndexApplication.spec.ts to select 'Table' instead of 'Topic' in the tree widget * Refactor BlockEditor and FeedUtils to improve code organization and readability * Fix regex in getTextFromHtmlString to correctly remove HTML tags * Add tests for getTextFromHtmlString and improve HTML tag removal regex --------- Co-authored-by: mohitdeuex <mohit.y@deuexsolutions.com>
2024-12-27 20:57:37 +05:30
await page.locator(descriptionBox).fill(entity.description);
[RbacDomain] RBAC with Domain Restrictions (#16586) * Add domain field to entity jsons * add subdomains ui * Add Domain To create Request * Typo fix * commit progress * allow multiple domains * - add userDomains and teamDomains * - Restrict Api Access * allow multiple domain support * - Add Listing Restricition - Add Search Restrictions * - Field Fix * - Inherit Team Domains * remove glossary filter from ui * - Fix Tag and User Filter * - Id -> FQN in create * - Missing domain on indexes * add domain in creation of team, user and glossary * fix merge conflicts * fix feedbacks * fix tests * add domain playwright * minor changes * fix domain fetching calls * Add Thread Listing with EntityDomain * Fixes for Team Join * Mkae list mutable * Add missing import * Fix Team Test * User Test case fix * Fix User Domain * Minor bug fixes related to sub domains * Fix data retaining in add sub domain modal after closing * fix NavBar unit test * Make Domain Access Work Via Policies * Fix errors introduced after conflict resolutions * update render function in SubDomainsTable.component.tsx to accept an array of owners instead of a single owner * fix java checkstyle * fix py-test * format * Fix the domain e2e owner field type * Fix Failing Tests * fixed pytest list index * update userDomains and teamDomains to domains * Entity Domain to Domain for thread and changeEvent * FIx fields * @Ovveride * FIx * Remove Duplicate Field * Remove Duplicate Field * Fix Failing Test * fix domain related changes * fix subdomains loader * Fix Owners Order * Enforce Domain Permissions * fix domain cleanup * Fix Test * rever owner change --------- Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Aniket Katkar <aniketkatkar97@gmail.com> Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: sonikashah <sonikashah94@gmail.com> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com>
2024-08-02 10:16:14 +05:30
if (!isEmpty(entity.owners) && !isUndefined(entity.owners)) {
await addOwner({
[RbacDomain] RBAC with Domain Restrictions (#16586) * Add domain field to entity jsons * add subdomains ui * Add Domain To create Request * Typo fix * commit progress * allow multiple domains * - add userDomains and teamDomains * - Restrict Api Access * allow multiple domain support * - Add Listing Restricition - Add Search Restrictions * - Field Fix * - Inherit Team Domains * remove glossary filter from ui * - Fix Tag and User Filter * - Id -> FQN in create * - Missing domain on indexes * add domain in creation of team, user and glossary * fix merge conflicts * fix feedbacks * fix tests * add domain playwright * minor changes * fix domain fetching calls * Add Thread Listing with EntityDomain * Fixes for Team Join * Mkae list mutable * Add missing import * Fix Team Test * User Test case fix * Fix User Domain * Minor bug fixes related to sub domains * Fix data retaining in add sub domain modal after closing * fix NavBar unit test * Make Domain Access Work Via Policies * Fix errors introduced after conflict resolutions * update render function in SubDomainsTable.component.tsx to accept an array of owners instead of a single owner * fix java checkstyle * fix py-test * format * Fix the domain e2e owner field type * Fix Failing Tests * fixed pytest list index * update userDomains and teamDomains to domains * Entity Domain to Domain for thread and changeEvent * FIx fields * @Ovveride * FIx * Remove Duplicate Field * Remove Duplicate Field * Fix Failing Test * fix domain related changes * fix subdomains loader * Fix Owners Order * Enforce Domain Permissions * fix domain cleanup * Fix Test * rever owner change --------- Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Aniket Katkar <aniketkatkar97@gmail.com> Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: sonikashah <sonikashah94@gmail.com> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com>
2024-08-02 10:16:14 +05:30
page,
owner: entity.owners[0].name,
type: entity.owners[0].type as 'Users' | 'Teams',
endpoint: EntityTypeEndpoint.Domain,
dataTestId: 'owner-container',
initiatorId: 'add-owner',
});
[RbacDomain] RBAC with Domain Restrictions (#16586) * Add domain field to entity jsons * add subdomains ui * Add Domain To create Request * Typo fix * commit progress * allow multiple domains * - add userDomains and teamDomains * - Restrict Api Access * allow multiple domain support * - Add Listing Restricition - Add Search Restrictions * - Field Fix * - Inherit Team Domains * remove glossary filter from ui * - Fix Tag and User Filter * - Id -> FQN in create * - Missing domain on indexes * add domain in creation of team, user and glossary * fix merge conflicts * fix feedbacks * fix tests * add domain playwright * minor changes * fix domain fetching calls * Add Thread Listing with EntityDomain * Fixes for Team Join * Mkae list mutable * Add missing import * Fix Team Test * User Test case fix * Fix User Domain * Minor bug fixes related to sub domains * Fix data retaining in add sub domain modal after closing * fix NavBar unit test * Make Domain Access Work Via Policies * Fix errors introduced after conflict resolutions * update render function in SubDomainsTable.component.tsx to accept an array of owners instead of a single owner * fix java checkstyle * fix py-test * format * Fix the domain e2e owner field type * Fix Failing Tests * fixed pytest list index * update userDomains and teamDomains to domains * Entity Domain to Domain for thread and changeEvent * FIx fields * @Ovveride * FIx * Remove Duplicate Field * Remove Duplicate Field * Fix Failing Test * fix domain related changes * fix subdomains loader * Fix Owners Order * Enforce Domain Permissions * fix domain cleanup * Fix Test * rever owner change --------- Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Aniket Katkar <aniketkatkar97@gmail.com> Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: sonikashah <sonikashah94@gmail.com> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com>
2024-08-02 10:16:14 +05:30
}
};
export const fillDomainForm = async (
page: Page,
entity: Domain['data'] | SubDomain['data'],
isDomain = true
) => {
[RbacDomain] RBAC with Domain Restrictions (#16586) * Add domain field to entity jsons * add subdomains ui * Add Domain To create Request * Typo fix * commit progress * allow multiple domains * - add userDomains and teamDomains * - Restrict Api Access * allow multiple domain support * - Add Listing Restricition - Add Search Restrictions * - Field Fix * - Inherit Team Domains * remove glossary filter from ui * - Fix Tag and User Filter * - Id -> FQN in create * - Missing domain on indexes * add domain in creation of team, user and glossary * fix merge conflicts * fix feedbacks * fix tests * add domain playwright * minor changes * fix domain fetching calls * Add Thread Listing with EntityDomain * Fixes for Team Join * Mkae list mutable * Add missing import * Fix Team Test * User Test case fix * Fix User Domain * Minor bug fixes related to sub domains * Fix data retaining in add sub domain modal after closing * fix NavBar unit test * Make Domain Access Work Via Policies * Fix errors introduced after conflict resolutions * update render function in SubDomainsTable.component.tsx to accept an array of owners instead of a single owner * fix java checkstyle * fix py-test * format * Fix the domain e2e owner field type * Fix Failing Tests * fixed pytest list index * update userDomains and teamDomains to domains * Entity Domain to Domain for thread and changeEvent * FIx fields * @Ovveride * FIx * Remove Duplicate Field * Remove Duplicate Field * Fix Failing Test * fix domain related changes * fix subdomains loader * Fix Owners Order * Enforce Domain Permissions * fix domain cleanup * Fix Test * rever owner change --------- Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Aniket Katkar <aniketkatkar97@gmail.com> Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: sonikashah <sonikashah94@gmail.com> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com>
2024-08-02 10:16:14 +05:30
await fillCommonFormItems(page, entity);
2025-09-26 20:31:39 +05:30
const domainTypeCombo = page.getByRole('combobox', { name: 'Domain Type' });
await domainTypeCombo.click();
await page.getByRole('option', { name: entity.domainType }).click();
[RbacDomain] RBAC with Domain Restrictions (#16586) * Add domain field to entity jsons * add subdomains ui * Add Domain To create Request * Typo fix * commit progress * allow multiple domains * - add userDomains and teamDomains * - Restrict Api Access * allow multiple domain support * - Add Listing Restricition - Add Search Restrictions * - Field Fix * - Inherit Team Domains * remove glossary filter from ui * - Fix Tag and User Filter * - Id -> FQN in create * - Missing domain on indexes * add domain in creation of team, user and glossary * fix merge conflicts * fix feedbacks * fix tests * add domain playwright * minor changes * fix domain fetching calls * Add Thread Listing with EntityDomain * Fixes for Team Join * Mkae list mutable * Add missing import * Fix Team Test * User Test case fix * Fix User Domain * Minor bug fixes related to sub domains * Fix data retaining in add sub domain modal after closing * fix NavBar unit test * Make Domain Access Work Via Policies * Fix errors introduced after conflict resolutions * update render function in SubDomainsTable.component.tsx to accept an array of owners instead of a single owner * fix java checkstyle * fix py-test * format * Fix the domain e2e owner field type * Fix Failing Tests * fixed pytest list index * update userDomains and teamDomains to domains * Entity Domain to Domain for thread and changeEvent * FIx fields * @Ovveride * FIx * Remove Duplicate Field * Remove Duplicate Field * Fix Failing Test * fix domain related changes * fix subdomains loader * Fix Owners Order * Enforce Domain Permissions * fix domain cleanup * Fix Test * rever owner change --------- Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Aniket Katkar <aniketkatkar97@gmail.com> Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: sonikashah <sonikashah94@gmail.com> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com>
2024-08-02 10:16:14 +05:30
};
export const checkDomainDisplayName = async (
page: Page,
displayName: string
) => {
await expect(page.getByTestId('entity-header-display-name')).toHaveText(
displayName
);
};
export const checkAssetsCount = async (page: Page, count: number) => {
await expect(page.getByTestId('assets').getByTestId('count')).toContainText(
count.toString()
);
};
export const checkDataProductCount = async (page: Page, count: number) => {
await expect(
page.getByTestId('data_products').getByTestId('count')
).toContainText(count.toString());
};
export const verifyDomain = async (
page: Page,
domain: Domain['data'] | SubDomain['data'],
parentDomain?: Domain['data'],
isDomain = true
) => {
[RbacDomain] RBAC with Domain Restrictions (#16586) * Add domain field to entity jsons * add subdomains ui * Add Domain To create Request * Typo fix * commit progress * allow multiple domains * - add userDomains and teamDomains * - Restrict Api Access * allow multiple domain support * - Add Listing Restricition - Add Search Restrictions * - Field Fix * - Inherit Team Domains * remove glossary filter from ui * - Fix Tag and User Filter * - Id -> FQN in create * - Missing domain on indexes * add domain in creation of team, user and glossary * fix merge conflicts * fix feedbacks * fix tests * add domain playwright * minor changes * fix domain fetching calls * Add Thread Listing with EntityDomain * Fixes for Team Join * Mkae list mutable * Add missing import * Fix Team Test * User Test case fix * Fix User Domain * Minor bug fixes related to sub domains * Fix data retaining in add sub domain modal after closing * fix NavBar unit test * Make Domain Access Work Via Policies * Fix errors introduced after conflict resolutions * update render function in SubDomainsTable.component.tsx to accept an array of owners instead of a single owner * fix java checkstyle * fix py-test * format * Fix the domain e2e owner field type * Fix Failing Tests * fixed pytest list index * update userDomains and teamDomains to domains * Entity Domain to Domain for thread and changeEvent * FIx fields * @Ovveride * FIx * Remove Duplicate Field * Remove Duplicate Field * Fix Failing Test * fix domain related changes * fix subdomains loader * Fix Owners Order * Enforce Domain Permissions * fix domain cleanup * Fix Test * rever owner change --------- Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Aniket Katkar <aniketkatkar97@gmail.com> Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: sonikashah <sonikashah94@gmail.com> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com>
2024-08-02 10:16:14 +05:30
await checkDomainDisplayName(page, domain.displayName);
await expect(page.getByText(domain.description)).toBeVisible();
[RbacDomain] RBAC with Domain Restrictions (#16586) * Add domain field to entity jsons * add subdomains ui * Add Domain To create Request * Typo fix * commit progress * allow multiple domains * - add userDomains and teamDomains * - Restrict Api Access * allow multiple domain support * - Add Listing Restricition - Add Search Restrictions * - Field Fix * - Inherit Team Domains * remove glossary filter from ui * - Fix Tag and User Filter * - Id -> FQN in create * - Missing domain on indexes * add domain in creation of team, user and glossary * fix merge conflicts * fix feedbacks * fix tests * add domain playwright * minor changes * fix domain fetching calls * Add Thread Listing with EntityDomain * Fixes for Team Join * Mkae list mutable * Add missing import * Fix Team Test * User Test case fix * Fix User Domain * Minor bug fixes related to sub domains * Fix data retaining in add sub domain modal after closing * fix NavBar unit test * Make Domain Access Work Via Policies * Fix errors introduced after conflict resolutions * update render function in SubDomainsTable.component.tsx to accept an array of owners instead of a single owner * fix java checkstyle * fix py-test * format * Fix the domain e2e owner field type * Fix Failing Tests * fixed pytest list index * update userDomains and teamDomains to domains * Entity Domain to Domain for thread and changeEvent * FIx fields * @Ovveride * FIx * Remove Duplicate Field * Remove Duplicate Field * Fix Failing Test * fix domain related changes * fix subdomains loader * Fix Owners Order * Enforce Domain Permissions * fix domain cleanup * Fix Test * rever owner change --------- Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Aniket Katkar <aniketkatkar97@gmail.com> Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: sonikashah <sonikashah94@gmail.com> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com>
2024-08-02 10:16:14 +05:30
expect(
await page.locator(`[id="KnowledgePanel\\.Description"]`).textContent()
).toContain(domain.description);
[RbacDomain] RBAC with Domain Restrictions (#16586) * Add domain field to entity jsons * add subdomains ui * Add Domain To create Request * Typo fix * commit progress * allow multiple domains * - add userDomains and teamDomains * - Restrict Api Access * allow multiple domain support * - Add Listing Restricition - Add Search Restrictions * - Field Fix * - Inherit Team Domains * remove glossary filter from ui * - Fix Tag and User Filter * - Id -> FQN in create * - Missing domain on indexes * add domain in creation of team, user and glossary * fix merge conflicts * fix feedbacks * fix tests * add domain playwright * minor changes * fix domain fetching calls * Add Thread Listing with EntityDomain * Fixes for Team Join * Mkae list mutable * Add missing import * Fix Team Test * User Test case fix * Fix User Domain * Minor bug fixes related to sub domains * Fix data retaining in add sub domain modal after closing * fix NavBar unit test * Make Domain Access Work Via Policies * Fix errors introduced after conflict resolutions * update render function in SubDomainsTable.component.tsx to accept an array of owners instead of a single owner * fix java checkstyle * fix py-test * format * Fix the domain e2e owner field type * Fix Failing Tests * fixed pytest list index * update userDomains and teamDomains to domains * Entity Domain to Domain for thread and changeEvent * FIx fields * @Ovveride * FIx * Remove Duplicate Field * Remove Duplicate Field * Fix Failing Test * fix domain related changes * fix subdomains loader * Fix Owners Order * Enforce Domain Permissions * fix domain cleanup * Fix Test * rever owner change --------- Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Aniket Katkar <aniketkatkar97@gmail.com> Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: sonikashah <sonikashah94@gmail.com> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com>
2024-08-02 10:16:14 +05:30
if (!isEmpty(domain.owners) && !isUndefined(domain.owners)) {
await expect(
page.getByTestId('domain-owner-name').getByTestId('owner-link')
).toContainText(domain.owners[0].name);
}
await expect(
page.getByTestId('domain-type-label').locator('div')
).toContainText(domain.domainType);
// Check breadcrumbs
if (!isDomain && parentDomain) {
await expect(
page.getByRole('link', { name: parentDomain.fullyQualifiedName })
).toBeVisible();
}
[RbacDomain] RBAC with Domain Restrictions (#16586) * Add domain field to entity jsons * add subdomains ui * Add Domain To create Request * Typo fix * commit progress * allow multiple domains * - add userDomains and teamDomains * - Restrict Api Access * allow multiple domain support * - Add Listing Restricition - Add Search Restrictions * - Field Fix * - Inherit Team Domains * remove glossary filter from ui * - Fix Tag and User Filter * - Id -> FQN in create * - Missing domain on indexes * add domain in creation of team, user and glossary * fix merge conflicts * fix feedbacks * fix tests * add domain playwright * minor changes * fix domain fetching calls * Add Thread Listing with EntityDomain * Fixes for Team Join * Mkae list mutable * Add missing import * Fix Team Test * User Test case fix * Fix User Domain * Minor bug fixes related to sub domains * Fix data retaining in add sub domain modal after closing * fix NavBar unit test * Make Domain Access Work Via Policies * Fix errors introduced after conflict resolutions * update render function in SubDomainsTable.component.tsx to accept an array of owners instead of a single owner * fix java checkstyle * fix py-test * format * Fix the domain e2e owner field type * Fix Failing Tests * fixed pytest list index * update userDomains and teamDomains to domains * Entity Domain to Domain for thread and changeEvent * FIx fields * @Ovveride * FIx * Remove Duplicate Field * Remove Duplicate Field * Fix Failing Test * fix domain related changes * fix subdomains loader * Fix Owners Order * Enforce Domain Permissions * fix domain cleanup * Fix Test * rever owner change --------- Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Aniket Katkar <aniketkatkar97@gmail.com> Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: sonikashah <sonikashah94@gmail.com> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com>
2024-08-02 10:16:14 +05:30
};
export const createDomain = async (
page: Page,
domain: Domain['data'],
validate = false
) => {
2025-09-26 20:31:39 +05:30
await page.click('[data-testid="add-entity-button"]');
[RbacDomain] RBAC with Domain Restrictions (#16586) * Add domain field to entity jsons * add subdomains ui * Add Domain To create Request * Typo fix * commit progress * allow multiple domains * - add userDomains and teamDomains * - Restrict Api Access * allow multiple domain support * - Add Listing Restricition - Add Search Restrictions * - Field Fix * - Inherit Team Domains * remove glossary filter from ui * - Fix Tag and User Filter * - Id -> FQN in create * - Missing domain on indexes * add domain in creation of team, user and glossary * fix merge conflicts * fix feedbacks * fix tests * add domain playwright * minor changes * fix domain fetching calls * Add Thread Listing with EntityDomain * Fixes for Team Join * Mkae list mutable * Add missing import * Fix Team Test * User Test case fix * Fix User Domain * Minor bug fixes related to sub domains * Fix data retaining in add sub domain modal after closing * fix NavBar unit test * Make Domain Access Work Via Policies * Fix errors introduced after conflict resolutions * update render function in SubDomainsTable.component.tsx to accept an array of owners instead of a single owner * fix java checkstyle * fix py-test * format * Fix the domain e2e owner field type * Fix Failing Tests * fixed pytest list index * update userDomains and teamDomains to domains * Entity Domain to Domain for thread and changeEvent * FIx fields * @Ovveride * FIx * Remove Duplicate Field * Remove Duplicate Field * Fix Failing Test * fix domain related changes * fix subdomains loader * Fix Owners Order * Enforce Domain Permissions * fix domain cleanup * Fix Test * rever owner change --------- Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Aniket Katkar <aniketkatkar97@gmail.com> Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: sonikashah <sonikashah94@gmail.com> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com>
2024-08-02 10:16:14 +05:30
2025-09-26 20:31:39 +05:30
await page.waitForSelector('h6:has-text("Add Domain")', { timeout: 5000 });
await expect(page.locator('h6:has-text("Add Domain")')).toBeVisible();
[RbacDomain] RBAC with Domain Restrictions (#16586) * Add domain field to entity jsons * add subdomains ui * Add Domain To create Request * Typo fix * commit progress * allow multiple domains * - add userDomains and teamDomains * - Restrict Api Access * allow multiple domain support * - Add Listing Restricition - Add Search Restrictions * - Field Fix * - Inherit Team Domains * remove glossary filter from ui * - Fix Tag and User Filter * - Id -> FQN in create * - Missing domain on indexes * add domain in creation of team, user and glossary * fix merge conflicts * fix feedbacks * fix tests * add domain playwright * minor changes * fix domain fetching calls * Add Thread Listing with EntityDomain * Fixes for Team Join * Mkae list mutable * Add missing import * Fix Team Test * User Test case fix * Fix User Domain * Minor bug fixes related to sub domains * Fix data retaining in add sub domain modal after closing * fix NavBar unit test * Make Domain Access Work Via Policies * Fix errors introduced after conflict resolutions * update render function in SubDomainsTable.component.tsx to accept an array of owners instead of a single owner * fix java checkstyle * fix py-test * format * Fix the domain e2e owner field type * Fix Failing Tests * fixed pytest list index * update userDomains and teamDomains to domains * Entity Domain to Domain for thread and changeEvent * FIx fields * @Ovveride * FIx * Remove Duplicate Field * Remove Duplicate Field * Fix Failing Test * fix domain related changes * fix subdomains loader * Fix Owners Order * Enforce Domain Permissions * fix domain cleanup * Fix Test * rever owner change --------- Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Aniket Katkar <aniketkatkar97@gmail.com> Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: sonikashah <sonikashah94@gmail.com> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com>
2024-08-02 10:16:14 +05:30
2025-09-26 20:31:39 +05:30
const saveButton = page.getByRole('button', { name: 'Save' });
[RbacDomain] RBAC with Domain Restrictions (#16586) * Add domain field to entity jsons * add subdomains ui * Add Domain To create Request * Typo fix * commit progress * allow multiple domains * - add userDomains and teamDomains * - Restrict Api Access * allow multiple domain support * - Add Listing Restricition - Add Search Restrictions * - Field Fix * - Inherit Team Domains * remove glossary filter from ui * - Fix Tag and User Filter * - Id -> FQN in create * - Missing domain on indexes * add domain in creation of team, user and glossary * fix merge conflicts * fix feedbacks * fix tests * add domain playwright * minor changes * fix domain fetching calls * Add Thread Listing with EntityDomain * Fixes for Team Join * Mkae list mutable * Add missing import * Fix Team Test * User Test case fix * Fix User Domain * Minor bug fixes related to sub domains * Fix data retaining in add sub domain modal after closing * fix NavBar unit test * Make Domain Access Work Via Policies * Fix errors introduced after conflict resolutions * update render function in SubDomainsTable.component.tsx to accept an array of owners instead of a single owner * fix java checkstyle * fix py-test * format * Fix the domain e2e owner field type * Fix Failing Tests * fixed pytest list index * update userDomains and teamDomains to domains * Entity Domain to Domain for thread and changeEvent * FIx fields * @Ovveride * FIx * Remove Duplicate Field * Remove Duplicate Field * Fix Failing Test * fix domain related changes * fix subdomains loader * Fix Owners Order * Enforce Domain Permissions * fix domain cleanup * Fix Test * rever owner change --------- Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Aniket Katkar <aniketkatkar97@gmail.com> Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: sonikashah <sonikashah94@gmail.com> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com>
2024-08-02 10:16:14 +05:30
if (validate) {
2025-09-26 20:31:39 +05:30
await saveButton.click();
[RbacDomain] RBAC with Domain Restrictions (#16586) * Add domain field to entity jsons * add subdomains ui * Add Domain To create Request * Typo fix * commit progress * allow multiple domains * - add userDomains and teamDomains * - Restrict Api Access * allow multiple domain support * - Add Listing Restricition - Add Search Restrictions * - Field Fix * - Inherit Team Domains * remove glossary filter from ui * - Fix Tag and User Filter * - Id -> FQN in create * - Missing domain on indexes * add domain in creation of team, user and glossary * fix merge conflicts * fix feedbacks * fix tests * add domain playwright * minor changes * fix domain fetching calls * Add Thread Listing with EntityDomain * Fixes for Team Join * Mkae list mutable * Add missing import * Fix Team Test * User Test case fix * Fix User Domain * Minor bug fixes related to sub domains * Fix data retaining in add sub domain modal after closing * fix NavBar unit test * Make Domain Access Work Via Policies * Fix errors introduced after conflict resolutions * update render function in SubDomainsTable.component.tsx to accept an array of owners instead of a single owner * fix java checkstyle * fix py-test * format * Fix the domain e2e owner field type * Fix Failing Tests * fixed pytest list index * update userDomains and teamDomains to domains * Entity Domain to Domain for thread and changeEvent * FIx fields * @Ovveride * FIx * Remove Duplicate Field * Remove Duplicate Field * Fix Failing Test * fix domain related changes * fix subdomains loader * Fix Owners Order * Enforce Domain Permissions * fix domain cleanup * Fix Test * rever owner change --------- Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Aniket Katkar <aniketkatkar97@gmail.com> Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: sonikashah <sonikashah94@gmail.com> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com>
2024-08-02 10:16:14 +05:30
await validateDomainForm(page);
}
await fillDomainForm(page, domain);
const domainRes = page.waitForResponse('/api/v1/domains');
2025-09-26 20:31:39 +05:30
await saveButton.click();
[RbacDomain] RBAC with Domain Restrictions (#16586) * Add domain field to entity jsons * add subdomains ui * Add Domain To create Request * Typo fix * commit progress * allow multiple domains * - add userDomains and teamDomains * - Restrict Api Access * allow multiple domain support * - Add Listing Restricition - Add Search Restrictions * - Field Fix * - Inherit Team Domains * remove glossary filter from ui * - Fix Tag and User Filter * - Id -> FQN in create * - Missing domain on indexes * add domain in creation of team, user and glossary * fix merge conflicts * fix feedbacks * fix tests * add domain playwright * minor changes * fix domain fetching calls * Add Thread Listing with EntityDomain * Fixes for Team Join * Mkae list mutable * Add missing import * Fix Team Test * User Test case fix * Fix User Domain * Minor bug fixes related to sub domains * Fix data retaining in add sub domain modal after closing * fix NavBar unit test * Make Domain Access Work Via Policies * Fix errors introduced after conflict resolutions * update render function in SubDomainsTable.component.tsx to accept an array of owners instead of a single owner * fix java checkstyle * fix py-test * format * Fix the domain e2e owner field type * Fix Failing Tests * fixed pytest list index * update userDomains and teamDomains to domains * Entity Domain to Domain for thread and changeEvent * FIx fields * @Ovveride * FIx * Remove Duplicate Field * Remove Duplicate Field * Fix Failing Test * fix domain related changes * fix subdomains loader * Fix Owners Order * Enforce Domain Permissions * fix domain cleanup * Fix Test * rever owner change --------- Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Aniket Katkar <aniketkatkar97@gmail.com> Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: sonikashah <sonikashah94@gmail.com> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com>
2024-08-02 10:16:14 +05:30
await domainRes;
2025-09-26 20:31:39 +05:30
await toastNotification(page, /Domain created successfully/);
await selectDomain(page, domain);
[RbacDomain] RBAC with Domain Restrictions (#16586) * Add domain field to entity jsons * add subdomains ui * Add Domain To create Request * Typo fix * commit progress * allow multiple domains * - add userDomains and teamDomains * - Restrict Api Access * allow multiple domain support * - Add Listing Restricition - Add Search Restrictions * - Field Fix * - Inherit Team Domains * remove glossary filter from ui * - Fix Tag and User Filter * - Id -> FQN in create * - Missing domain on indexes * add domain in creation of team, user and glossary * fix merge conflicts * fix feedbacks * fix tests * add domain playwright * minor changes * fix domain fetching calls * Add Thread Listing with EntityDomain * Fixes for Team Join * Mkae list mutable * Add missing import * Fix Team Test * User Test case fix * Fix User Domain * Minor bug fixes related to sub domains * Fix data retaining in add sub domain modal after closing * fix NavBar unit test * Make Domain Access Work Via Policies * Fix errors introduced after conflict resolutions * update render function in SubDomainsTable.component.tsx to accept an array of owners instead of a single owner * fix java checkstyle * fix py-test * format * Fix the domain e2e owner field type * Fix Failing Tests * fixed pytest list index * update userDomains and teamDomains to domains * Entity Domain to Domain for thread and changeEvent * FIx fields * @Ovveride * FIx * Remove Duplicate Field * Remove Duplicate Field * Fix Failing Test * fix domain related changes * fix subdomains loader * Fix Owners Order * Enforce Domain Permissions * fix domain cleanup * Fix Test * rever owner change --------- Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Aniket Katkar <aniketkatkar97@gmail.com> Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: sonikashah <sonikashah94@gmail.com> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com>
2024-08-02 10:16:14 +05:30
await checkDomainDisplayName(page, domain.displayName);
await checkAssetsCount(page, 0);
await checkDataProductCount(page, 0);
};
export const createSubDomain = async (
page: Page,
subDomain: SubDomain['data']
) => {
await page.getByTestId('domain-details-add-button').click();
await page.getByRole('menuitem', { name: 'Sub Domains' }).click();
await expect(page.getByText('Add Sub Domain')).toBeVisible();
await fillDomainForm(page, subDomain, false);
const saveRes = page.waitForResponse('/api/v1/domains');
await page.getByTestId('save-sub-domain').click();
await saveRes;
};
[RbacDomain] RBAC with Domain Restrictions (#16586) * Add domain field to entity jsons * add subdomains ui * Add Domain To create Request * Typo fix * commit progress * allow multiple domains * - add userDomains and teamDomains * - Restrict Api Access * allow multiple domain support * - Add Listing Restricition - Add Search Restrictions * - Field Fix * - Inherit Team Domains * remove glossary filter from ui * - Fix Tag and User Filter * - Id -> FQN in create * - Missing domain on indexes * add domain in creation of team, user and glossary * fix merge conflicts * fix feedbacks * fix tests * add domain playwright * minor changes * fix domain fetching calls * Add Thread Listing with EntityDomain * Fixes for Team Join * Mkae list mutable * Add missing import * Fix Team Test * User Test case fix * Fix User Domain * Minor bug fixes related to sub domains * Fix data retaining in add sub domain modal after closing * fix NavBar unit test * Make Domain Access Work Via Policies * Fix errors introduced after conflict resolutions * update render function in SubDomainsTable.component.tsx to accept an array of owners instead of a single owner * fix java checkstyle * fix py-test * format * Fix the domain e2e owner field type * Fix Failing Tests * fixed pytest list index * update userDomains and teamDomains to domains * Entity Domain to Domain for thread and changeEvent * FIx fields * @Ovveride * FIx * Remove Duplicate Field * Remove Duplicate Field * Fix Failing Test * fix domain related changes * fix subdomains loader * Fix Owners Order * Enforce Domain Permissions * fix domain cleanup * Fix Test * rever owner change --------- Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Aniket Katkar <aniketkatkar97@gmail.com> Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: sonikashah <sonikashah94@gmail.com> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com>
2024-08-02 10:16:14 +05:30
export const addAssetsToDomain = async (
page: Page,
domain: Domain,
assets: EntityClass[],
navigateToAssetsTab = true
[RbacDomain] RBAC with Domain Restrictions (#16586) * Add domain field to entity jsons * add subdomains ui * Add Domain To create Request * Typo fix * commit progress * allow multiple domains * - add userDomains and teamDomains * - Restrict Api Access * allow multiple domain support * - Add Listing Restricition - Add Search Restrictions * - Field Fix * - Inherit Team Domains * remove glossary filter from ui * - Fix Tag and User Filter * - Id -> FQN in create * - Missing domain on indexes * add domain in creation of team, user and glossary * fix merge conflicts * fix feedbacks * fix tests * add domain playwright * minor changes * fix domain fetching calls * Add Thread Listing with EntityDomain * Fixes for Team Join * Mkae list mutable * Add missing import * Fix Team Test * User Test case fix * Fix User Domain * Minor bug fixes related to sub domains * Fix data retaining in add sub domain modal after closing * fix NavBar unit test * Make Domain Access Work Via Policies * Fix errors introduced after conflict resolutions * update render function in SubDomainsTable.component.tsx to accept an array of owners instead of a single owner * fix java checkstyle * fix py-test * format * Fix the domain e2e owner field type * Fix Failing Tests * fixed pytest list index * update userDomains and teamDomains to domains * Entity Domain to Domain for thread and changeEvent * FIx fields * @Ovveride * FIx * Remove Duplicate Field * Remove Duplicate Field * Fix Failing Test * fix domain related changes * fix subdomains loader * Fix Owners Order * Enforce Domain Permissions * fix domain cleanup * Fix Test * rever owner change --------- Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Aniket Katkar <aniketkatkar97@gmail.com> Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: sonikashah <sonikashah94@gmail.com> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com>
2024-08-02 10:16:14 +05:30
) => {
if (navigateToAssetsTab) {
await goToAssetsTab(page, domain.data);
}
[RbacDomain] RBAC with Domain Restrictions (#16586) * Add domain field to entity jsons * add subdomains ui * Add Domain To create Request * Typo fix * commit progress * allow multiple domains * - add userDomains and teamDomains * - Restrict Api Access * allow multiple domain support * - Add Listing Restricition - Add Search Restrictions * - Field Fix * - Inherit Team Domains * remove glossary filter from ui * - Fix Tag and User Filter * - Id -> FQN in create * - Missing domain on indexes * add domain in creation of team, user and glossary * fix merge conflicts * fix feedbacks * fix tests * add domain playwright * minor changes * fix domain fetching calls * Add Thread Listing with EntityDomain * Fixes for Team Join * Mkae list mutable * Add missing import * Fix Team Test * User Test case fix * Fix User Domain * Minor bug fixes related to sub domains * Fix data retaining in add sub domain modal after closing * fix NavBar unit test * Make Domain Access Work Via Policies * Fix errors introduced after conflict resolutions * update render function in SubDomainsTable.component.tsx to accept an array of owners instead of a single owner * fix java checkstyle * fix py-test * format * Fix the domain e2e owner field type * Fix Failing Tests * fixed pytest list index * update userDomains and teamDomains to domains * Entity Domain to Domain for thread and changeEvent * FIx fields * @Ovveride * FIx * Remove Duplicate Field * Remove Duplicate Field * Fix Failing Test * fix domain related changes * fix subdomains loader * Fix Owners Order * Enforce Domain Permissions * fix domain cleanup * Fix Test * rever owner change --------- Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Aniket Katkar <aniketkatkar97@gmail.com> Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: sonikashah <sonikashah94@gmail.com> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com>
2024-08-02 10:16:14 +05:30
await checkAssetsCount(page, 0);
await expect(page.getByTestId('no-data-placeholder')).toContainText(
'Adding a new Asset is easy, just give it a spin!'
);
await page.getByTestId('domain-details-add-button').click();
await page.getByRole('menuitem', { name: 'Assets', exact: true }).click();
[RbacDomain] RBAC with Domain Restrictions (#16586) * Add domain field to entity jsons * add subdomains ui * Add Domain To create Request * Typo fix * commit progress * allow multiple domains * - add userDomains and teamDomains * - Restrict Api Access * allow multiple domain support * - Add Listing Restricition - Add Search Restrictions * - Field Fix * - Inherit Team Domains * remove glossary filter from ui * - Fix Tag and User Filter * - Id -> FQN in create * - Missing domain on indexes * add domain in creation of team, user and glossary * fix merge conflicts * fix feedbacks * fix tests * add domain playwright * minor changes * fix domain fetching calls * Add Thread Listing with EntityDomain * Fixes for Team Join * Mkae list mutable * Add missing import * Fix Team Test * User Test case fix * Fix User Domain * Minor bug fixes related to sub domains * Fix data retaining in add sub domain modal after closing * fix NavBar unit test * Make Domain Access Work Via Policies * Fix errors introduced after conflict resolutions * update render function in SubDomainsTable.component.tsx to accept an array of owners instead of a single owner * fix java checkstyle * fix py-test * format * Fix the domain e2e owner field type * Fix Failing Tests * fixed pytest list index * update userDomains and teamDomains to domains * Entity Domain to Domain for thread and changeEvent * FIx fields * @Ovveride * FIx * Remove Duplicate Field * Remove Duplicate Field * Fix Failing Test * fix domain related changes * fix subdomains loader * Fix Owners Order * Enforce Domain Permissions * fix domain cleanup * Fix Test * rever owner change --------- Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Aniket Katkar <aniketkatkar97@gmail.com> Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: sonikashah <sonikashah94@gmail.com> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com>
2024-08-02 10:16:14 +05:30
for (const asset of assets) {
const name = get(asset, 'entityResponseData.name');
const fqn = get(asset, 'entityResponseData.fullyQualifiedName');
const entityDisplayName = get(asset, 'entityResponseData.displayName');
const visibleName = entityDisplayName ?? name;
[RbacDomain] RBAC with Domain Restrictions (#16586) * Add domain field to entity jsons * add subdomains ui * Add Domain To create Request * Typo fix * commit progress * allow multiple domains * - add userDomains and teamDomains * - Restrict Api Access * allow multiple domain support * - Add Listing Restricition - Add Search Restrictions * - Field Fix * - Inherit Team Domains * remove glossary filter from ui * - Fix Tag and User Filter * - Id -> FQN in create * - Missing domain on indexes * add domain in creation of team, user and glossary * fix merge conflicts * fix feedbacks * fix tests * add domain playwright * minor changes * fix domain fetching calls * Add Thread Listing with EntityDomain * Fixes for Team Join * Mkae list mutable * Add missing import * Fix Team Test * User Test case fix * Fix User Domain * Minor bug fixes related to sub domains * Fix data retaining in add sub domain modal after closing * fix NavBar unit test * Make Domain Access Work Via Policies * Fix errors introduced after conflict resolutions * update render function in SubDomainsTable.component.tsx to accept an array of owners instead of a single owner * fix java checkstyle * fix py-test * format * Fix the domain e2e owner field type * Fix Failing Tests * fixed pytest list index * update userDomains and teamDomains to domains * Entity Domain to Domain for thread and changeEvent * FIx fields * @Ovveride * FIx * Remove Duplicate Field * Remove Duplicate Field * Fix Failing Test * fix domain related changes * fix subdomains loader * Fix Owners Order * Enforce Domain Permissions * fix domain cleanup * Fix Test * rever owner change --------- Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Aniket Katkar <aniketkatkar97@gmail.com> Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: sonikashah <sonikashah94@gmail.com> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com>
2024-08-02 10:16:14 +05:30
const searchRes = page.waitForResponse(
`/api/v1/search/query?q=${visibleName}&index=all&from=0&size=25&*`
[RbacDomain] RBAC with Domain Restrictions (#16586) * Add domain field to entity jsons * add subdomains ui * Add Domain To create Request * Typo fix * commit progress * allow multiple domains * - add userDomains and teamDomains * - Restrict Api Access * allow multiple domain support * - Add Listing Restricition - Add Search Restrictions * - Field Fix * - Inherit Team Domains * remove glossary filter from ui * - Fix Tag and User Filter * - Id -> FQN in create * - Missing domain on indexes * add domain in creation of team, user and glossary * fix merge conflicts * fix feedbacks * fix tests * add domain playwright * minor changes * fix domain fetching calls * Add Thread Listing with EntityDomain * Fixes for Team Join * Mkae list mutable * Add missing import * Fix Team Test * User Test case fix * Fix User Domain * Minor bug fixes related to sub domains * Fix data retaining in add sub domain modal after closing * fix NavBar unit test * Make Domain Access Work Via Policies * Fix errors introduced after conflict resolutions * update render function in SubDomainsTable.component.tsx to accept an array of owners instead of a single owner * fix java checkstyle * fix py-test * format * Fix the domain e2e owner field type * Fix Failing Tests * fixed pytest list index * update userDomains and teamDomains to domains * Entity Domain to Domain for thread and changeEvent * FIx fields * @Ovveride * FIx * Remove Duplicate Field * Remove Duplicate Field * Fix Failing Test * fix domain related changes * fix subdomains loader * Fix Owners Order * Enforce Domain Permissions * fix domain cleanup * Fix Test * rever owner change --------- Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Aniket Katkar <aniketkatkar97@gmail.com> Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: sonikashah <sonikashah94@gmail.com> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com>
2024-08-02 10:16:14 +05:30
);
await page
.getByTestId('asset-selection-modal')
.getByTestId('searchbar')
.fill(visibleName);
[RbacDomain] RBAC with Domain Restrictions (#16586) * Add domain field to entity jsons * add subdomains ui * Add Domain To create Request * Typo fix * commit progress * allow multiple domains * - add userDomains and teamDomains * - Restrict Api Access * allow multiple domain support * - Add Listing Restricition - Add Search Restrictions * - Field Fix * - Inherit Team Domains * remove glossary filter from ui * - Fix Tag and User Filter * - Id -> FQN in create * - Missing domain on indexes * add domain in creation of team, user and glossary * fix merge conflicts * fix feedbacks * fix tests * add domain playwright * minor changes * fix domain fetching calls * Add Thread Listing with EntityDomain * Fixes for Team Join * Mkae list mutable * Add missing import * Fix Team Test * User Test case fix * Fix User Domain * Minor bug fixes related to sub domains * Fix data retaining in add sub domain modal after closing * fix NavBar unit test * Make Domain Access Work Via Policies * Fix errors introduced after conflict resolutions * update render function in SubDomainsTable.component.tsx to accept an array of owners instead of a single owner * fix java checkstyle * fix py-test * format * Fix the domain e2e owner field type * Fix Failing Tests * fixed pytest list index * update userDomains and teamDomains to domains * Entity Domain to Domain for thread and changeEvent * FIx fields * @Ovveride * FIx * Remove Duplicate Field * Remove Duplicate Field * Fix Failing Test * fix domain related changes * fix subdomains loader * Fix Owners Order * Enforce Domain Permissions * fix domain cleanup * Fix Test * rever owner change --------- Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Aniket Katkar <aniketkatkar97@gmail.com> Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: sonikashah <sonikashah94@gmail.com> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com>
2024-08-02 10:16:14 +05:30
await searchRes;
await page.locator(`[data-testid="table-data-card_${fqn}"] input`).check();
await expect(
page.locator(
`[data-testid="table-data-card_${fqn}"] [data-testid="entity-header-name"]`
)
).toContainText(visibleName);
[RbacDomain] RBAC with Domain Restrictions (#16586) * Add domain field to entity jsons * add subdomains ui * Add Domain To create Request * Typo fix * commit progress * allow multiple domains * - add userDomains and teamDomains * - Restrict Api Access * allow multiple domain support * - Add Listing Restricition - Add Search Restrictions * - Field Fix * - Inherit Team Domains * remove glossary filter from ui * - Fix Tag and User Filter * - Id -> FQN in create * - Missing domain on indexes * add domain in creation of team, user and glossary * fix merge conflicts * fix feedbacks * fix tests * add domain playwright * minor changes * fix domain fetching calls * Add Thread Listing with EntityDomain * Fixes for Team Join * Mkae list mutable * Add missing import * Fix Team Test * User Test case fix * Fix User Domain * Minor bug fixes related to sub domains * Fix data retaining in add sub domain modal after closing * fix NavBar unit test * Make Domain Access Work Via Policies * Fix errors introduced after conflict resolutions * update render function in SubDomainsTable.component.tsx to accept an array of owners instead of a single owner * fix java checkstyle * fix py-test * format * Fix the domain e2e owner field type * Fix Failing Tests * fixed pytest list index * update userDomains and teamDomains to domains * Entity Domain to Domain for thread and changeEvent * FIx fields * @Ovveride * FIx * Remove Duplicate Field * Remove Duplicate Field * Fix Failing Test * fix domain related changes * fix subdomains loader * Fix Owners Order * Enforce Domain Permissions * fix domain cleanup * Fix Test * rever owner change --------- Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Aniket Katkar <aniketkatkar97@gmail.com> Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: sonikashah <sonikashah94@gmail.com> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com>
2024-08-02 10:16:14 +05:30
}
const assetsAddRes = page.waitForResponse(`/api/v1/domains/*/assets/add`);
const searchRes = page.waitForResponse((response) => {
const url = new URL(response.url());
const queryParams = new URLSearchParams(url.search);
const queryFilter = queryParams.get('query_filter');
return (
response
.url()
.includes('/api/v1/search/query?q=&index=all&from=0&size=15') &&
queryFilter !== null &&
queryFilter !== ''
);
});
[RbacDomain] RBAC with Domain Restrictions (#16586) * Add domain field to entity jsons * add subdomains ui * Add Domain To create Request * Typo fix * commit progress * allow multiple domains * - add userDomains and teamDomains * - Restrict Api Access * allow multiple domain support * - Add Listing Restricition - Add Search Restrictions * - Field Fix * - Inherit Team Domains * remove glossary filter from ui * - Fix Tag and User Filter * - Id -> FQN in create * - Missing domain on indexes * add domain in creation of team, user and glossary * fix merge conflicts * fix feedbacks * fix tests * add domain playwright * minor changes * fix domain fetching calls * Add Thread Listing with EntityDomain * Fixes for Team Join * Mkae list mutable * Add missing import * Fix Team Test * User Test case fix * Fix User Domain * Minor bug fixes related to sub domains * Fix data retaining in add sub domain modal after closing * fix NavBar unit test * Make Domain Access Work Via Policies * Fix errors introduced after conflict resolutions * update render function in SubDomainsTable.component.tsx to accept an array of owners instead of a single owner * fix java checkstyle * fix py-test * format * Fix the domain e2e owner field type * Fix Failing Tests * fixed pytest list index * update userDomains and teamDomains to domains * Entity Domain to Domain for thread and changeEvent * FIx fields * @Ovveride * FIx * Remove Duplicate Field * Remove Duplicate Field * Fix Failing Test * fix domain related changes * fix subdomains loader * Fix Owners Order * Enforce Domain Permissions * fix domain cleanup * Fix Test * rever owner change --------- Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Aniket Katkar <aniketkatkar97@gmail.com> Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: sonikashah <sonikashah94@gmail.com> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com>
2024-08-02 10:16:14 +05:30
await page.getByTestId('save-btn').click();
await assetsAddRes;
await searchRes;
await page.reload();
await page.waitForLoadState('networkidle');
[RbacDomain] RBAC with Domain Restrictions (#16586) * Add domain field to entity jsons * add subdomains ui * Add Domain To create Request * Typo fix * commit progress * allow multiple domains * - add userDomains and teamDomains * - Restrict Api Access * allow multiple domain support * - Add Listing Restricition - Add Search Restrictions * - Field Fix * - Inherit Team Domains * remove glossary filter from ui * - Fix Tag and User Filter * - Id -> FQN in create * - Missing domain on indexes * add domain in creation of team, user and glossary * fix merge conflicts * fix feedbacks * fix tests * add domain playwright * minor changes * fix domain fetching calls * Add Thread Listing with EntityDomain * Fixes for Team Join * Mkae list mutable * Add missing import * Fix Team Test * User Test case fix * Fix User Domain * Minor bug fixes related to sub domains * Fix data retaining in add sub domain modal after closing * fix NavBar unit test * Make Domain Access Work Via Policies * Fix errors introduced after conflict resolutions * update render function in SubDomainsTable.component.tsx to accept an array of owners instead of a single owner * fix java checkstyle * fix py-test * format * Fix the domain e2e owner field type * Fix Failing Tests * fixed pytest list index * update userDomains and teamDomains to domains * Entity Domain to Domain for thread and changeEvent * FIx fields * @Ovveride * FIx * Remove Duplicate Field * Remove Duplicate Field * Fix Failing Test * fix domain related changes * fix subdomains loader * Fix Owners Order * Enforce Domain Permissions * fix domain cleanup * Fix Test * rever owner change --------- Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Aniket Katkar <aniketkatkar97@gmail.com> Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: sonikashah <sonikashah94@gmail.com> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com>
2024-08-02 10:16:14 +05:30
await checkAssetsCount(page, assets.length);
};
export const addServicesToDomain = async (
page: Page,
domain: Domain['data'],
assets: EntityClass[]
) => {
await goToAssetsTab(page, domain);
await page.getByTestId('domain-details-add-button').click();
await page.getByRole('menuitem', { name: 'Assets', exact: true }).click();
for (const asset of assets) {
const name = get(asset, 'name');
const fqn = get(asset, 'fullyQualifiedName');
const searchRes = page.waitForResponse(
`/api/v1/search/query?q=${name}&index=all&from=0&size=25&*`
);
await page
.getByTestId('asset-selection-modal')
.getByTestId('searchbar')
.fill(name);
await searchRes;
await page.locator(`[data-testid="table-data-card_${fqn}"] input`).check();
}
const assetsAddRes = page.waitForResponse(
`/api/v1/domains/${encodeURIComponent(
domain.fullyQualifiedName ?? ''
)}/assets/add`
);
await page.getByTestId('save-btn').click();
await assetsAddRes;
};
[RbacDomain] RBAC with Domain Restrictions (#16586) * Add domain field to entity jsons * add subdomains ui * Add Domain To create Request * Typo fix * commit progress * allow multiple domains * - add userDomains and teamDomains * - Restrict Api Access * allow multiple domain support * - Add Listing Restricition - Add Search Restrictions * - Field Fix * - Inherit Team Domains * remove glossary filter from ui * - Fix Tag and User Filter * - Id -> FQN in create * - Missing domain on indexes * add domain in creation of team, user and glossary * fix merge conflicts * fix feedbacks * fix tests * add domain playwright * minor changes * fix domain fetching calls * Add Thread Listing with EntityDomain * Fixes for Team Join * Mkae list mutable * Add missing import * Fix Team Test * User Test case fix * Fix User Domain * Minor bug fixes related to sub domains * Fix data retaining in add sub domain modal after closing * fix NavBar unit test * Make Domain Access Work Via Policies * Fix errors introduced after conflict resolutions * update render function in SubDomainsTable.component.tsx to accept an array of owners instead of a single owner * fix java checkstyle * fix py-test * format * Fix the domain e2e owner field type * Fix Failing Tests * fixed pytest list index * update userDomains and teamDomains to domains * Entity Domain to Domain for thread and changeEvent * FIx fields * @Ovveride * FIx * Remove Duplicate Field * Remove Duplicate Field * Fix Failing Test * fix domain related changes * fix subdomains loader * Fix Owners Order * Enforce Domain Permissions * fix domain cleanup * Fix Test * rever owner change --------- Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Aniket Katkar <aniketkatkar97@gmail.com> Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: sonikashah <sonikashah94@gmail.com> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com>
2024-08-02 10:16:14 +05:30
export const addAssetsToDataProduct = async (
page: Page,
dataProductFqn: string,
[RbacDomain] RBAC with Domain Restrictions (#16586) * Add domain field to entity jsons * add subdomains ui * Add Domain To create Request * Typo fix * commit progress * allow multiple domains * - add userDomains and teamDomains * - Restrict Api Access * allow multiple domain support * - Add Listing Restricition - Add Search Restrictions * - Field Fix * - Inherit Team Domains * remove glossary filter from ui * - Fix Tag and User Filter * - Id -> FQN in create * - Missing domain on indexes * add domain in creation of team, user and glossary * fix merge conflicts * fix feedbacks * fix tests * add domain playwright * minor changes * fix domain fetching calls * Add Thread Listing with EntityDomain * Fixes for Team Join * Mkae list mutable * Add missing import * Fix Team Test * User Test case fix * Fix User Domain * Minor bug fixes related to sub domains * Fix data retaining in add sub domain modal after closing * fix NavBar unit test * Make Domain Access Work Via Policies * Fix errors introduced after conflict resolutions * update render function in SubDomainsTable.component.tsx to accept an array of owners instead of a single owner * fix java checkstyle * fix py-test * format * Fix the domain e2e owner field type * Fix Failing Tests * fixed pytest list index * update userDomains and teamDomains to domains * Entity Domain to Domain for thread and changeEvent * FIx fields * @Ovveride * FIx * Remove Duplicate Field * Remove Duplicate Field * Fix Failing Test * fix domain related changes * fix subdomains loader * Fix Owners Order * Enforce Domain Permissions * fix domain cleanup * Fix Test * rever owner change --------- Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Aniket Katkar <aniketkatkar97@gmail.com> Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: sonikashah <sonikashah94@gmail.com> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com>
2024-08-02 10:16:14 +05:30
assets: EntityClass[]
) => {
await page.getByTestId('assets').click();
await checkAssetsCount(page, 0);
await expect(page.getByTestId('no-data-placeholder')).toContainText(
'Adding a new Asset is easy, just give it a spin!'
);
await page.getByTestId('data-product-details-add-button').click();
for (const asset of assets) {
const name = get(asset, 'entityResponseData.name');
const fqn = get(asset, 'entityResponseData.fullyQualifiedName');
const searchRes = page.waitForResponse(
`/api/v1/search/query?q=${name}&index=all&from=0&size=25&*`
);
await page.getByTestId('searchbar').fill(name);
await searchRes;
await page.locator(`[data-testid="table-data-card_${fqn}"] input`).check();
}
const assetsAddRes = page.waitForResponse(
`/api/v1/dataProducts/*/assets/add`
[RbacDomain] RBAC with Domain Restrictions (#16586) * Add domain field to entity jsons * add subdomains ui * Add Domain To create Request * Typo fix * commit progress * allow multiple domains * - add userDomains and teamDomains * - Restrict Api Access * allow multiple domain support * - Add Listing Restricition - Add Search Restrictions * - Field Fix * - Inherit Team Domains * remove glossary filter from ui * - Fix Tag and User Filter * - Id -> FQN in create * - Missing domain on indexes * add domain in creation of team, user and glossary * fix merge conflicts * fix feedbacks * fix tests * add domain playwright * minor changes * fix domain fetching calls * Add Thread Listing with EntityDomain * Fixes for Team Join * Mkae list mutable * Add missing import * Fix Team Test * User Test case fix * Fix User Domain * Minor bug fixes related to sub domains * Fix data retaining in add sub domain modal after closing * fix NavBar unit test * Make Domain Access Work Via Policies * Fix errors introduced after conflict resolutions * update render function in SubDomainsTable.component.tsx to accept an array of owners instead of a single owner * fix java checkstyle * fix py-test * format * Fix the domain e2e owner field type * Fix Failing Tests * fixed pytest list index * update userDomains and teamDomains to domains * Entity Domain to Domain for thread and changeEvent * FIx fields * @Ovveride * FIx * Remove Duplicate Field * Remove Duplicate Field * Fix Failing Test * fix domain related changes * fix subdomains loader * Fix Owners Order * Enforce Domain Permissions * fix domain cleanup * Fix Test * rever owner change --------- Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Aniket Katkar <aniketkatkar97@gmail.com> Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: sonikashah <sonikashah94@gmail.com> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com>
2024-08-02 10:16:14 +05:30
);
await page.getByTestId('save-btn').click();
await assetsAddRes;
await checkAssetsCount(page, assets.length);
for (const asset of assets) {
const fqn = get(asset, 'entityResponseData.fullyQualifiedName');
await page
.locator(
`[data-testid="table-data-card_${fqn}"] a[data-testid="entity-link"]`
)
.click();
await page.waitForLoadState('networkidle');
await expect(
page
.getByTestId('KnowledgePanel.DataProducts')
.getByTestId('data-products-list')
.getByTestId(`data-product-${dataProductFqn}`)
).toBeVisible();
await page.goBack();
await page.waitForLoadState('networkidle');
}
[RbacDomain] RBAC with Domain Restrictions (#16586) * Add domain field to entity jsons * add subdomains ui * Add Domain To create Request * Typo fix * commit progress * allow multiple domains * - add userDomains and teamDomains * - Restrict Api Access * allow multiple domain support * - Add Listing Restricition - Add Search Restrictions * - Field Fix * - Inherit Team Domains * remove glossary filter from ui * - Fix Tag and User Filter * - Id -> FQN in create * - Missing domain on indexes * add domain in creation of team, user and glossary * fix merge conflicts * fix feedbacks * fix tests * add domain playwright * minor changes * fix domain fetching calls * Add Thread Listing with EntityDomain * Fixes for Team Join * Mkae list mutable * Add missing import * Fix Team Test * User Test case fix * Fix User Domain * Minor bug fixes related to sub domains * Fix data retaining in add sub domain modal after closing * fix NavBar unit test * Make Domain Access Work Via Policies * Fix errors introduced after conflict resolutions * update render function in SubDomainsTable.component.tsx to accept an array of owners instead of a single owner * fix java checkstyle * fix py-test * format * Fix the domain e2e owner field type * Fix Failing Tests * fixed pytest list index * update userDomains and teamDomains to domains * Entity Domain to Domain for thread and changeEvent * FIx fields * @Ovveride * FIx * Remove Duplicate Field * Remove Duplicate Field * Fix Failing Test * fix domain related changes * fix subdomains loader * Fix Owners Order * Enforce Domain Permissions * fix domain cleanup * Fix Test * rever owner change --------- Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Aniket Katkar <aniketkatkar97@gmail.com> Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: sonikashah <sonikashah94@gmail.com> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com>
2024-08-02 10:16:14 +05:30
};
export const removeAssetsFromDataProduct = async (
page: Page,
dataProduct: DataProduct['data'],
assets: EntityClass[]
) => {
await page.getByTestId('assets').click();
for (const asset of assets) {
const fqn = get(asset, 'entityResponseData.fullyQualifiedName');
await page.locator(`[data-testid="table-data-card_${fqn}"] input`).check();
}
const assetsRemoveRes = page.waitForResponse(
`/api/v1/dataProducts/${encodeURIComponent(
dataProduct.fullyQualifiedName ?? ''
)}/assets/remove`
);
await page.getByTestId('delete-all-button').click();
await assetsRemoveRes;
};
export const setupAssetsForDomain = async (page: Page) => {
const { afterAction, apiContext } = await getApiContext(page);
const table = new TableClass();
const topic = new TopicClass();
const dashboard = new DashboardClass();
await Promise.all([
table.create(apiContext),
topic.create(apiContext),
dashboard.create(apiContext),
]);
[RbacDomain] RBAC with Domain Restrictions (#16586) * Add domain field to entity jsons * add subdomains ui * Add Domain To create Request * Typo fix * commit progress * allow multiple domains * - add userDomains and teamDomains * - Restrict Api Access * allow multiple domain support * - Add Listing Restricition - Add Search Restrictions * - Field Fix * - Inherit Team Domains * remove glossary filter from ui * - Fix Tag and User Filter * - Id -> FQN in create * - Missing domain on indexes * add domain in creation of team, user and glossary * fix merge conflicts * fix feedbacks * fix tests * add domain playwright * minor changes * fix domain fetching calls * Add Thread Listing with EntityDomain * Fixes for Team Join * Mkae list mutable * Add missing import * Fix Team Test * User Test case fix * Fix User Domain * Minor bug fixes related to sub domains * Fix data retaining in add sub domain modal after closing * fix NavBar unit test * Make Domain Access Work Via Policies * Fix errors introduced after conflict resolutions * update render function in SubDomainsTable.component.tsx to accept an array of owners instead of a single owner * fix java checkstyle * fix py-test * format * Fix the domain e2e owner field type * Fix Failing Tests * fixed pytest list index * update userDomains and teamDomains to domains * Entity Domain to Domain for thread and changeEvent * FIx fields * @Ovveride * FIx * Remove Duplicate Field * Remove Duplicate Field * Fix Failing Test * fix domain related changes * fix subdomains loader * Fix Owners Order * Enforce Domain Permissions * fix domain cleanup * Fix Test * rever owner change --------- Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Aniket Katkar <aniketkatkar97@gmail.com> Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: sonikashah <sonikashah94@gmail.com> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com>
2024-08-02 10:16:14 +05:30
const assetCleanup = async () => {
await Promise.all([
table.delete(apiContext),
topic.delete(apiContext),
dashboard.delete(apiContext),
]);
[RbacDomain] RBAC with Domain Restrictions (#16586) * Add domain field to entity jsons * add subdomains ui * Add Domain To create Request * Typo fix * commit progress * allow multiple domains * - add userDomains and teamDomains * - Restrict Api Access * allow multiple domain support * - Add Listing Restricition - Add Search Restrictions * - Field Fix * - Inherit Team Domains * remove glossary filter from ui * - Fix Tag and User Filter * - Id -> FQN in create * - Missing domain on indexes * add domain in creation of team, user and glossary * fix merge conflicts * fix feedbacks * fix tests * add domain playwright * minor changes * fix domain fetching calls * Add Thread Listing with EntityDomain * Fixes for Team Join * Mkae list mutable * Add missing import * Fix Team Test * User Test case fix * Fix User Domain * Minor bug fixes related to sub domains * Fix data retaining in add sub domain modal after closing * fix NavBar unit test * Make Domain Access Work Via Policies * Fix errors introduced after conflict resolutions * update render function in SubDomainsTable.component.tsx to accept an array of owners instead of a single owner * fix java checkstyle * fix py-test * format * Fix the domain e2e owner field type * Fix Failing Tests * fixed pytest list index * update userDomains and teamDomains to domains * Entity Domain to Domain for thread and changeEvent * FIx fields * @Ovveride * FIx * Remove Duplicate Field * Remove Duplicate Field * Fix Failing Test * fix domain related changes * fix subdomains loader * Fix Owners Order * Enforce Domain Permissions * fix domain cleanup * Fix Test * rever owner change --------- Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Aniket Katkar <aniketkatkar97@gmail.com> Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: sonikashah <sonikashah94@gmail.com> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com>
2024-08-02 10:16:14 +05:30
await afterAction();
};
return {
assets: [table, topic, dashboard],
assetCleanup,
};
};
export const createDataProduct = async (
page: Page,
dataProduct: DataProduct['data']
) => {
// Safety check to close potential domain not found alert
// Arrived due to parallel testing
await closeFirstPopupAlert(page);
await page.getByTestId('domain-details-add-button').click();
[RbacDomain] RBAC with Domain Restrictions (#16586) * Add domain field to entity jsons * add subdomains ui * Add Domain To create Request * Typo fix * commit progress * allow multiple domains * - add userDomains and teamDomains * - Restrict Api Access * allow multiple domain support * - Add Listing Restricition - Add Search Restrictions * - Field Fix * - Inherit Team Domains * remove glossary filter from ui * - Fix Tag and User Filter * - Id -> FQN in create * - Missing domain on indexes * add domain in creation of team, user and glossary * fix merge conflicts * fix feedbacks * fix tests * add domain playwright * minor changes * fix domain fetching calls * Add Thread Listing with EntityDomain * Fixes for Team Join * Mkae list mutable * Add missing import * Fix Team Test * User Test case fix * Fix User Domain * Minor bug fixes related to sub domains * Fix data retaining in add sub domain modal after closing * fix NavBar unit test * Make Domain Access Work Via Policies * Fix errors introduced after conflict resolutions * update render function in SubDomainsTable.component.tsx to accept an array of owners instead of a single owner * fix java checkstyle * fix py-test * format * Fix the domain e2e owner field type * Fix Failing Tests * fixed pytest list index * update userDomains and teamDomains to domains * Entity Domain to Domain for thread and changeEvent * FIx fields * @Ovveride * FIx * Remove Duplicate Field * Remove Duplicate Field * Fix Failing Test * fix domain related changes * fix subdomains loader * Fix Owners Order * Enforce Domain Permissions * fix domain cleanup * Fix Test * rever owner change --------- Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Aniket Katkar <aniketkatkar97@gmail.com> Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: sonikashah <sonikashah94@gmail.com> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com>
2024-08-02 10:16:14 +05:30
await page.getByRole('menuitem', { name: 'Data Products' }).click();
await expect(page.getByText('Add Data Product')).toBeVisible();
await fillCommonFormItems(page, dataProduct);
const saveRes = page.waitForResponse('/api/v1/dataProducts');
await page.getByTestId('save-data-product').click();
await saveRes;
};
export const verifyDataProductAssetsAfterDelete = async (
page: Page,
{
domain,
dataProduct1,
dataProduct2,
assets,
subDomain,
}: {
domain: Domain;
dataProduct1: DataProduct;
dataProduct2: DataProduct;
assets: EntityClass[];
subDomain?: SubDomain;
}
) => {
const { apiContext } = await getApiContext(page);
Data contracts support for tables & Multi Domain Migration (#22108) * WIP - MINOR - Rule Engine * WIP - MINOR - Rule Engine * WIP - MINOR - Rule Engine * WIP - MINOR - Rule Engine * rules * rules * rules * fix retrieval by entity * test dc * test dc * WIP: Data contract feature * destructure component to it's own files * WIP contract tab * update local * fix test * First iteration for multi domain support * fix inheritance fields * fix inheritance fields * fix create interface * fix few more tests * fix indexing updates * fix domain rel * update domain --> domains * merge * fix merge * fix csv tests and createEntity interface * Update generated TypeScript types * Trigger Build * migrations * fix tests * fix tests * fix tests * Update generated TypeScript types * Trigger Build * handle drive service * fix pg migration * fix domains ref after merge and clean python tests * Update generated TypeScript types * fix merge domains * format * add missing migrations * Update generated TypeScript types * tests * Update generated TypeScript types * Trigger Build * tests * tests * fix py test * migrate domain to domains and fix compilation errors * fix domain assignement * fix domain spec * fix py tests * fix data product creation issue * fix domain tests * fix bulk import * fix tests * fix tests * fix query and domain migration * fix py test * fix playwrights * fix getEntitiesWithDisplayName indexing quotes * fix domain prapogation tests * fix domain propagation * Fix patch api * fix domain schema build edit playwright * fix test * fix test * fix domain selection issue and console errors * quick fix landing page changes * fix remaining tests * fix ui tests * Fix adding data products * format --------- Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Sriharsha Chintalapani <harsha@getcollate.io> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com>
2025-07-22 13:04:50 +05:30
const newDataProduct1 = new DataProduct([domain], 'PW_DataProduct_Sales');
await test.step('Add assets to DataProduct Sales', async () => {
await redirectToHomePage(page);
await sidebarClick(page, SidebarItem.DOMAIN);
if (subDomain) {
await selectSubDomain(page, domain.data, subDomain.data);
await selectDataProductFromTab(page, dataProduct1.data);
} else {
await selectDataProduct(page, domain.data, dataProduct1.data);
}
await addAssetsToDataProduct(
page,
dataProduct1.responseData.fullyQualifiedName ?? '',
assets.slice(0, 2)
);
});
await test.step('Add assets to DataProduct Finance', async () => {
await redirectToHomePage(page);
await sidebarClick(page, SidebarItem.DOMAIN);
if (subDomain) {
await selectSubDomain(page, domain.data, subDomain.data);
await selectDataProductFromTab(page, dataProduct2.data);
} else {
await selectDataProduct(page, domain.data, dataProduct2.data);
}
await addAssetsToDataProduct(
page,
dataProduct2.responseData.fullyQualifiedName ?? '',
[assets[2]]
);
});
await test.step(
'Remove Data Product Sales and Create the same again',
async () => {
// Remove sales data product
await dataProduct1.delete(apiContext);
// Create sales data product again
await redirectToHomePage(page);
await sidebarClick(page, SidebarItem.DOMAIN);
if (subDomain) {
await selectSubDomain(page, domain.data, subDomain.data);
} else {
await selectDomain(page, domain.data);
}
await createDataProduct(page, newDataProduct1.data);
}
);
await test.step(
'Verify assets are not present in the newly created data product',
async () => {
await redirectToHomePage(page);
await sidebarClick(page, SidebarItem.DOMAIN);
if (subDomain) {
await selectSubDomain(page, domain.data, subDomain.data);
await selectDataProductFromTab(page, newDataProduct1.data);
} else {
await selectDataProduct(page, domain.data, newDataProduct1.data);
}
await checkAssetsCount(page, 0);
}
);
};
export const addTagsAndGlossaryToDomain = async (
page: Page,
{
tagFqn,
glossaryTermFqn,
isDomain = true,
}: {
tagFqn: string;
glossaryTermFqn: string;
isDomain?: boolean;
}
) => {
const addTagOrTerm = async (
containerType: 'tags' | 'glossary',
value: string
) => {
const container = `[data-testid="${containerType}-container"]`;
// Click add button
await page.locator(`${container} [data-testid="add-tag"]`).click();
// Fill and select tag/term
const input = page.locator(`${container} #tagsForm_tags`);
await input.click();
await input.fill(value);
const tag = page.getByTestId(`tag-${value}`);
if (containerType === 'glossary') {
// To avoid clicking on white space between checkbox and text
await tag.locator('.ant-select-tree-checkbox').click();
} else {
await tag.click();
}
// Save and wait for response
const updateResponse = page.waitForResponse(
(response) =>
response
.url()
.includes(`/api/v1/${isDomain ? 'domains' : 'dataProducts'}/`) &&
response.request().method() === 'PATCH'
);
await page.getByTestId('saveAssociatedTag').click();
await updateResponse;
};
// Add tag
await addTagOrTerm('tags', tagFqn);
// Add glossary term
await addTagOrTerm('glossary', glossaryTermFqn);
};
/**
* Verifies if the active domain is set to All Domains (DEFAULT_DOMAIN_VALUE)
*/
export const verifyActiveDomainIsDefault = async (page: Page) => {
await expect(page.getByTestId('domain-dropdown')).toContainText(
'All Domains'
);
};
/**
* Sets up a complete environment for domain ownership testing
* Creates user, policy, role, domain, data product and assigns ownership
* Returns all created objects and a cleanup function
*/
export const setupDomainOwnershipTest = async (apiContext: any) => {
// Create all necessary resources
const dataConsumerUser = new UserClass();
const id = uuid();
const domainForTest = new Domain({
name: `PW_Domain_Owner_Rule_Testing-${id}`,
displayName: `PW_Domain_Owner_Rule_Testing-${id}`,
description: 'playwright domain description',
domainType: 'Aggregate',
fullyQualifiedName: `PW_Domain_Owner_Rule_Testing-${id}`,
});
const dataProductForTest = new DataProduct(
Data contracts support for tables & Multi Domain Migration (#22108) * WIP - MINOR - Rule Engine * WIP - MINOR - Rule Engine * WIP - MINOR - Rule Engine * WIP - MINOR - Rule Engine * rules * rules * rules * fix retrieval by entity * test dc * test dc * WIP: Data contract feature * destructure component to it's own files * WIP contract tab * update local * fix test * First iteration for multi domain support * fix inheritance fields * fix inheritance fields * fix create interface * fix few more tests * fix indexing updates * fix domain rel * update domain --> domains * merge * fix merge * fix csv tests and createEntity interface * Update generated TypeScript types * Trigger Build * migrations * fix tests * fix tests * fix tests * Update generated TypeScript types * Trigger Build * handle drive service * fix pg migration * fix domains ref after merge and clean python tests * Update generated TypeScript types * fix merge domains * format * add missing migrations * Update generated TypeScript types * tests * Update generated TypeScript types * Trigger Build * tests * tests * fix py test * migrate domain to domains and fix compilation errors * fix domain assignement * fix domain spec * fix py tests * fix data product creation issue * fix domain tests * fix bulk import * fix tests * fix tests * fix query and domain migration * fix py test * fix playwrights * fix getEntitiesWithDisplayName indexing quotes * fix domain prapogation tests * fix domain propagation * Fix patch api * fix domain schema build edit playwright * fix test * fix test * fix domain selection issue and console errors * quick fix landing page changes * fix remaining tests * fix ui tests * Fix adding data products * format --------- Co-authored-by: Pere Miquel Brull <peremiquelbrull@gmail.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Sriharsha Chintalapani <harsha@getcollate.io> Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com>
2025-07-22 13:04:50 +05:30
[domainForTest],
`PW_DataProduct_Owner_Rule-${id}`
);
await dataConsumerUser.create(apiContext);
await domainForTest.create(apiContext);
// Setup permissions
const dataConsumerPolicy = new PolicyClass();
const dataConsumerRole = new RolesClass();
// Create domain access policy
const domainRule = [
{
name: 'DomainRule',
description: '',
resources: ['dataProduct', 'domain'],
operations: ['All'],
effect: 'allow',
condition: 'isOwner()',
},
];
await dataConsumerPolicy.create(apiContext, domainRule);
await dataConsumerRole.create(apiContext, [
dataConsumerPolicy.responseData.name,
]);
await dataProductForTest.create(apiContext);
// Create team for the user
const dataConsumerTeam = new TeamClass({
name: `PW_data_consumer_team-${id}`,
displayName: `PW Data Consumer Team ${id}`,
description: 'playwright data consumer team description',
teamType: 'Group',
users: [dataConsumerUser.responseData.id ?? ''],
defaultRoles: [dataConsumerRole.responseData.id ?? ''],
});
await dataConsumerTeam.create(apiContext);
// Set domain ownership
await domainForTest.patch({
apiContext,
patchData: [
{
op: 'add',
path: '/owners/0',
value: {
id: dataConsumerUser.responseData.id,
type: 'user',
},
},
],
});
// Return cleanup function and all created resources
const cleanup = async (apiContext1: APIRequestContext) => {
await dataProductForTest.delete(apiContext1);
await domainForTest.delete(apiContext1);
await dataConsumerUser.delete(apiContext1);
await dataConsumerTeam.delete(apiContext1);
await dataConsumerPolicy.delete(apiContext1);
await dataConsumerRole.delete(apiContext1);
};
return {
dataConsumerUser,
domainForTest,
dataProductForTest,
dataConsumerTeam,
dataConsumerPolicy,
dataConsumerRole,
cleanup,
};
};
/**
* Sets up a complete environment for testing hasDomain() rule condition
* Creates user, domain, subdomain, assets, policy with hasDomain(), role, and team
* Returns all created objects and a cleanup function
*/
export const setupDomainHasDomainTest = async (
apiContext: APIRequestContext
) => {
const id = uuid();
// Create test user
const testUser = new UserClass();
await testUser.create(apiContext);
const mainDomain = new Domain();
await mainDomain.create(apiContext);
const subDomain = new SubDomain(mainDomain);
await subDomain.create(apiContext);
// Create assets for domain and subdomain
const domainTable = new TableClass();
const subDomainTable = new TableClass();
await domainTable.create(apiContext);
await subDomainTable.create(apiContext);
// Create policy with hasDomain() rule
const domainPolicy = new PolicyClass();
const domainRule = [
{
name: 'HasDomainRule',
description: '',
resources: ['All'],
operations: ['All'],
effect: 'allow',
condition: 'hasDomain()',
},
];
await domainPolicy.create(apiContext, domainRule);
// Create role with the policy
const domainRole = new RolesClass();
await domainRole.create(apiContext, [domainPolicy.responseData.name]);
// Create team with the user and assign the role
const domainTeam = new TeamClass({
name: `PW_Team_HasDomain_${id}`,
displayName: `PW Team HasDomain ${id}`,
description: 'Team for hasDomain() rule testing',
teamType: 'Group',
users: [testUser.responseData.id ?? ''],
defaultRoles: [domainRole.responseData.id ?? ''],
});
await domainTeam.create(apiContext);
// Add user to domain
await testUser.patch({
apiContext,
patchData: [
{
op: 'add',
path: '/domains/0',
value: {
id: mainDomain.responseData.id,
type: 'domain',
},
},
],
});
// Assign assets to domain and subdomain
await domainTable.patch({
apiContext,
patchData: [
{
op: 'add',
path: '/domains/0',
value: {
id: mainDomain.responseData.id,
type: 'domain',
},
},
],
});
await subDomainTable.patch({
apiContext,
patchData: [
{
op: 'add',
path: '/domains/0',
value: {
id: subDomain.responseData.id,
type: 'domain',
},
},
],
});
// Cleanup function
const cleanup = async (cleanupContext: APIRequestContext) => {
await domainTable.delete(cleanupContext);
await subDomainTable.delete(cleanupContext);
await subDomain.delete(cleanupContext);
await mainDomain.delete(cleanupContext);
await domainTeam.delete(cleanupContext);
await domainRole.delete(cleanupContext);
await domainPolicy.delete(cleanupContext);
await testUser.delete(cleanupContext);
};
return {
testUser,
mainDomain,
subDomain,
domainTable,
subDomainTable,
domainPolicy,
domainRole,
domainTeam,
cleanup,
};
};
export const setupNoDomainRule = async (apiContext: APIRequestContext) => {
const id = uuid();
// Create test user
const testUser = new UserClass();
await testUser.create(apiContext);
const mainDomain = new Domain();
await mainDomain.create(apiContext);
// Create assets for domain
const domainTable = new TableClass();
const noDomainTable = new TableClass();
await domainTable.create(apiContext);
await noDomainTable.create(apiContext);
// Create policy with hasDomain() rule
const domainPolicy = new PolicyClass();
const domainRule = [
{
name: 'NoDomainRule',
description: '',
resources: ['All'],
operations: ['ViewAll'],
effect: 'deny',
condition: 'noDomain()',
},
];
await domainPolicy.create(apiContext, domainRule);
// Create role with the policy
const domainRole = new RolesClass();
await domainRole.create(apiContext, [domainPolicy.responseData.name]);
// Create team with the user and assign the role
const domainTeam = new TeamClass({
name: `PW_Team_NoDomain_${id}`,
displayName: `PW Team NoDomain ${id}`,
description: 'Team for noDomain() rule testing',
teamType: 'Group',
users: [testUser.responseData.id ?? ''],
defaultRoles: [domainRole.responseData.id ?? ''],
});
await domainTeam.create(apiContext);
// Add user to domain
await testUser.patch({
apiContext,
patchData: [
{
op: 'add',
path: '/domains/0',
value: {
id: mainDomain.responseData.id,
type: 'domain',
},
},
],
});
// Assign assets to domain and subdomain
await domainTable.patch({
apiContext,
patchData: [
{
op: 'add',
path: '/domains/0',
value: {
id: mainDomain.responseData.id,
type: 'domain',
},
},
],
});
// Cleanup function
const cleanup = async (cleanupContext: APIRequestContext) => {
await domainTable.delete(cleanupContext);
await noDomainTable.delete(cleanupContext);
await mainDomain.delete(cleanupContext);
await domainTeam.delete(cleanupContext);
await domainRole.delete(cleanupContext);
await domainPolicy.delete(cleanupContext);
await testUser.delete(cleanupContext);
};
return {
testUser,
mainDomain,
domainTable,
noDomainTable,
domainPolicy,
domainRole,
domainTeam,
cleanup,
};
};