Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { Domain } from '../../support/domain/Domain';
import { MetricClass } from '../../support/entity/MetricClass';
import { TableClass } from '../../support/entity/TableClass';
import { TagClass } from '../../support/tag/TagClass';
import { UserClass } from '../../support/user/UserClass';
import {
clickOutside,
createNewPage,
Expand All @@ -39,6 +40,7 @@ const tier = new TagClass({
const tierWithoutAsset = new TagClass({
classification: 'Tier',
});
let user: UserClass;

test.beforeAll('Setup pre-requests', async ({ browser }) => {
test.slow();
Expand All @@ -49,6 +51,8 @@ test.beforeAll('Setup pre-requests', async ({ browser }) => {
await tier.create(apiContext);
// Create second tier but do NOT assign it to any asset
await tierWithoutAsset.create(apiContext);
user = new UserClass();
await user.create(apiContext);

await table.patch({
apiContext,
Expand Down Expand Up @@ -77,11 +81,22 @@ test.beforeAll('Setup pre-requests', async ({ browser }) => {
displayName: domain.responseData.displayName,
},
},
{
op: 'add',
path: '/owners/0',
value: { id: user.responseData.id, type: 'user' },
},
],
});
await afterAction();
});

test.afterAll('Cleanup', async ({ browser }) => {
const { apiContext, afterAction } = await createNewPage(browser);
await user.delete(apiContext);
await afterAction();
});

test.beforeEach(async ({ page }) => {
await redirectToHomePage(page);
await sidebarClick(page, SidebarItem.EXPLORE);
Expand Down Expand Up @@ -436,6 +451,155 @@ test.describe('Filter persistence after bug fixes', () => {
});
});

test.describe('Quick filter options - proper casing from top_hits', () => {
test('domain filter option label uses original casing from _source', async ({
Comment thread
Rohit0301 marked this conversation as resolved.
page,
}) => {
const domainName = domain.responseData.displayName as string;

await test.step('Open Domains filter and wait for aggregate response', async () => {
const aggRes = page.waitForResponse(
'/api/v1/search/aggregate?index=dataAsset&field=domains.displayName.keyword*'
);
await page.click('[data-testid="search-dropdown-Domains"]');
await aggRes;
await waitForAllLoadersToDisappear(page);
});

await test.step('Option label matches original casing, not lowercased bucket key', async () => {
const searchRes = page.waitForResponse(
'/api/v1/search/aggregate?index=dataAsset&field=domains.displayName.keyword*'
);
await page.fill('[data-testid="search-input"]', domainName);
await searchRes;

// The rendered option text must match the original-cased displayName
const optionEl = page.getByTestId(domainName.toLowerCase());

await expect(optionEl).toBeVisible();
await expect(optionEl).toContainText(domainName);
});

await clickOutside(page);
});

test('tier filter option label uses original casing from _source', async ({
page,
}) => {
const tierFqn = tier.responseData.fullyQualifiedName as string;

await test.step('Open Tier filter and wait for aggregate response', async () => {
const aggRes = page.waitForResponse(
'/api/v1/search/aggregate?index=dataAsset&field=tier.tagFQN*'
);
await page.click('[data-testid="search-dropdown-Tier"]');
await aggRes;
await waitForAllLoadersToDisappear(page);
});

await test.step('Option label matches original FQN casing', async () => {
const searchRes = page.waitForResponse(
'/api/v1/search/aggregate?index=dataAsset&field=tier.tagFQN*'
);
await page.fill('[data-testid="search-input"]', tierFqn);
await searchRes;

const optionEl = page.getByTestId(tierFqn.toLowerCase());

await expect(optionEl).toBeVisible();
await expect(optionEl).toContainText(tierFqn);
});

await clickOutside(page);
});

test('tag filter option label uses original casing from _source', async ({
page,
}) => {
const tagFqn = 'PersonalData.Personal';

await test.step('Open Tag filter and search for the tag', async () => {
await page.click('[data-testid="search-dropdown-Tag"]');
const searchRes = page.waitForResponse(
'/api/v1/search/aggregate?index=dataAsset&field=tags.tagFQN*'
);
await page.fill('[data-testid="search-input"]', tagFqn);
await searchRes;
});

await test.step('Option label matches original FQN casing', async () => {
const optionEl = page.getByTestId(tagFqn.toLowerCase());

await expect(optionEl).toBeVisible();
await expect(optionEl).toContainText(tagFqn);
});

await clickOutside(page);
});

test('owner filter option label uses original casing from _source', async ({
page,
}) => {
Comment thread
gitar-bot[bot] marked this conversation as resolved.
const ownerName = (user.responseData.displayName ??
user.responseData.name) as string;

await test.step('Open Owners filter and wait for aggregate response', async () => {
const aggRes = page.waitForResponse(
'/api/v1/search/aggregate?index=dataAsset&field=ownerDisplayName*'
);
await page.click('[data-testid="search-dropdown-Owners"]');
await aggRes;
await waitForAllLoadersToDisappear(page);
});

await test.step('Option label matches original casing, not lowercased bucket key', async () => {
const searchRes = page.waitForResponse(
'/api/v1/search/aggregate?index=dataAsset&field=ownerDisplayName*'
);
await page.fill('[data-testid="search-input"]', ownerName);
await searchRes;

const optionEl = page.getByTestId(ownerName.toLowerCase());

await expect(optionEl).toBeVisible();
await expect(optionEl).toContainText(ownerName);
});

await clickOutside(page);
});

test('service filter option label uses original casing from _source', async ({
page,
}) => {
const serviceName = (table.serviceResponseData.displayName ??
table.serviceResponseData.name) as string;

await test.step('Open Service filter and wait for aggregate response', async () => {
const aggRes = page.waitForResponse(
'/api/v1/search/aggregate?index=dataAsset&field=service.displayName.keyword*'
);
await page.click('[data-testid="search-dropdown-Service"]');
await aggRes;
await waitForAllLoadersToDisappear(page);
});

await test.step('Option label matches original casing', async () => {
const searchRes = page.waitForResponse(
'/api/v1/search/aggregate?index=dataAsset&field=service.displayName.keyword*'
);
await page.fill('[data-testid="search-input"]', serviceName);
await searchRes;

const optionEl = page.getByTestId(serviceName.toLowerCase());

await expect(optionEl).toBeVisible();
await expect(optionEl).toContainText(serviceName);
});

await clickOutside(page);
});
});

test.describe('Metric search result highlight', () => {
const metric = new MetricClass();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ export interface ExploreQuickFilterField {
searchKey?: string;
dropdownClassName?: string;
singleSelect?: boolean;
sourceFields?: string;
}

// Type for all the explore tab entities
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,8 @@ describe('ExploreQuickFilters component', () => {
false,
undefined,
false,
'pets'
'pets',
undefined
);
});
});
Expand All @@ -368,7 +369,8 @@ describe('ExploreQuickFilters component', () => {
false,
undefined,
false,
''
'',
undefined
);
});
});
Expand Down Expand Up @@ -398,7 +400,8 @@ describe('ExploreQuickFilters component', () => {
false,
undefined,
false,
''
'',
undefined
);
});
});
Expand Down Expand Up @@ -434,7 +437,8 @@ describe('ExploreQuickFilters component', () => {
false,
50,
false,
''
'',
undefined
);
});
});
Expand Down Expand Up @@ -464,7 +468,8 @@ describe('ExploreQuickFilters component', () => {
false,
undefined,
false,
''
'',
undefined
);
});
});
Expand Down Expand Up @@ -502,7 +507,8 @@ describe('ExploreQuickFilters component', () => {
false,
undefined,
false,
''
'',
undefined
);
});
});
Expand Down Expand Up @@ -550,7 +556,8 @@ describe('ExploreQuickFilters component', () => {
false,
undefined,
false,
''
'',
undefined
);
});
});
Expand Down Expand Up @@ -579,7 +586,8 @@ describe('ExploreQuickFilters component', () => {
false,
undefined,
true,
''
'',
undefined
);
});
});
Expand Down Expand Up @@ -766,7 +774,8 @@ describe('ExploreQuickFilters component', () => {
expect.anything(),
undefined,
expect.anything(),
expect.any(String)
expect.any(String),
undefined
);
});
});
Expand Down Expand Up @@ -801,7 +810,8 @@ describe('ExploreQuickFilters component', () => {
false,
undefined,
false,
''
'',
undefined
);
});
});
Expand Down Expand Up @@ -925,7 +935,8 @@ describe('ExploreQuickFilters component', () => {
false,
undefined,
false,
''
'',
undefined
);
});
});
Expand Down Expand Up @@ -955,7 +966,8 @@ describe('ExploreQuickFilters component', () => {
false,
undefined,
false,
''
'',
undefined
);
});
});
Expand Down Expand Up @@ -986,7 +998,8 @@ describe('ExploreQuickFilters component', () => {
true,
undefined,
false,
''
'',
undefined
);
});
});
Expand Down
Loading
Loading