Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
karanh37 committed Jan 14, 2025
1 parent e313b14 commit d828250
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,61 @@ test.describe('Domains', () => {
await afterAction();
}
});

test('Should inherit owners and experts from parent domain', async ({
page,
}) => {
const { afterAction, apiContext } = await getApiContext(page);
const user1 = new UserClass();
const user2 = new UserClass();
let domain;
let dataProduct;
try {
await user1.create(apiContext);
await user2.create(apiContext);

domain = new Domain({
name: 'PW_Domain_Inherit_Testing',
displayName: 'PW_Domain_Inherit_Testing',
description: 'playwright domain description',
domainType: 'Aggregate',
fullyQualifiedName: 'PW_Domain_Inherit_Testing',
owners: [
{
name: user1.responseData.name,
type: 'user',
fullyQualifiedName: user1.responseData.fullyQualifiedName ?? '',
id: user1.responseData.id,
},
],
experts: [user2.responseData.name],
});
dataProduct = new DataProduct(domain);
await domain.create(apiContext);
await dataProduct.create(apiContext);

await page.reload();
await redirectToHomePage(page);

await sidebarClick(page, SidebarItem.DOMAIN);
await selectDomain(page, domain.data);
await selectDataProduct(page, domain.data, dataProduct.data);

await expect(
page.getByTestId('domain-owner-name').getByTestId('owner-label')
).toContainText(user1.responseData.displayName);

await expect(
page.getByTestId('domain-expert-name').getByTestId('owner-label')
).toContainText(user2.responseData.displayName);
} finally {
await dataProduct?.delete(apiContext);
await domain?.delete(apiContext);
await user1.delete(apiContext);
await user2.delete(apiContext);
await afterAction();
}
});
});

test.describe('Domains Rbac', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import { uuid } from '../../utils/common';
type UserTeamRef = {
name: string;
type: string;
fullyQualifiedName?: string;
id?: string;
};

type ResponseDataType = {
Expand All @@ -26,7 +28,7 @@ type ResponseDataType = {
id?: string;
fullyQualifiedName?: string;
owners?: UserTeamRef[];
experts?: UserTeamRef[];
experts?: string[];
};

export class Domain {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import { Domain } from './Domain';
type UserTeamRef = {
name: string;
type: string;
fullyQualifiedName?: string;
id?: string;
};

type ResponseDataType = {
Expand All @@ -27,7 +29,7 @@ type ResponseDataType = {
id?: string;
fullyQualifiedName?: string;
owners?: UserTeamRef[];
experts?: UserTeamRef[];
experts?: string[];
parent?: string;
};

Expand Down

0 comments on commit d828250

Please sign in to comment.