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

782 lines
23 KiB
TypeScript
Raw Normal View History

/*
* Copyright 2024 Collate.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import test, { 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,
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 } from './entity';
import { sidebarClick } from './sidebar';
export const assignDomain = async (page: Page, domain: Domain['data']) => {
await page.getByTestId('add-domain').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();
await expect(page.getByTestId('domain-link')).toContainText(
domain.displayName
);
};
export const updateDomain = async (page: Page, domain: Domain['data']) => {
await page.getByTestId('add-domain').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) => {
await page.getByTestId('add-domain').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);
};
export const selectDomain = async (page: Page, domain: Domain['data']) => {
await page
.getByRole('menuitem', { name: domain.displayName })
.locator('span')
.click();
2025-06-26 19:08:53 +05:30
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 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) {
await menuItem.click();
await page.waitForLoadState('networkidle');
}
await page.getByTestId('subdomains').getByText('Sub Domains').click();
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;
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);
await page.getByTestId('assets').click();
};
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
) => {
await page.locator('[data-testid="name"]').fill(entity.name);
await page.locator('[data-testid="display-name"]').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
}
};
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);
if (isDomain) {
await page.click('[data-testid="domainType"]');
} else {
await page
.getByLabel('Add Sub Domain')
.getByTestId('domainType')
.locator('div')
.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.getByTitle(entity.domainType).locator('div').click();
};
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);
const viewerContainerText = await page.textContent(
'[data-testid="viewer-container"]'
);
await expect(viewerContainerText).toContain(domain.description);
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
) => {
await page.click('[data-testid="add-domain"]');
await page.waitForSelector('[data-testid="form-heading"]');
await expect(page.locator('[data-testid="form-heading"]')).toHaveText(
'Add Domain'
);
await page.click('[data-testid="save-domain"]');
if (validate) {
await validateDomainForm(page);
}
await fillDomainForm(page, domain);
const domainRes = page.waitForResponse('/api/v1/domains');
await page.click('[data-testid="save-domain"]');
await domainRes;
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);
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(
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,
};
};