-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix the search for custom properties in advance search for some types (…
…#19113) * fix the search in advance search custom properties * modify v1/metadata/types/customProperties api to get customPropertyConfig along with name and type * added config list in the entity ref list * fix type of duration, timestamp and other types * minor ui changes * remove customProperty type which are not supported for now * added playwright test around the duration type property * fix flaky test --------- Co-authored-by: sonikashah <[email protected]>
- Loading branch information
1 parent
17ceb63
commit 2179b43
Showing
13 changed files
with
377 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
140 changes: 140 additions & 0 deletions
140
...data-ui/src/main/resources/ui/playwright/e2e/Features/AdvanceSearchCustomProperty.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
/* | ||
* Copyright 2025 Collate. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
import test, { expect } from '@playwright/test'; | ||
import { CUSTOM_PROPERTIES_ENTITIES } from '../../constant/customProperty'; | ||
import { GlobalSettingOptions } from '../../constant/settings'; | ||
import { SidebarItem } from '../../constant/sidebar'; | ||
import { TableClass } from '../../support/entity/TableClass'; | ||
import { | ||
selectOption, | ||
showAdvancedSearchDialog, | ||
} from '../../utils/advancedSearch'; | ||
import { advanceSearchSaveFilter } from '../../utils/advancedSearchCustomProperty'; | ||
import { createNewPage, redirectToHomePage, uuid } from '../../utils/common'; | ||
import { addCustomPropertiesForEntity } from '../../utils/customProperty'; | ||
import { settingClick, sidebarClick } from '../../utils/sidebar'; | ||
|
||
// use the admin user to login | ||
test.use({ storageState: 'playwright/.auth/admin.json' }); | ||
|
||
test.describe('Advanced Search Custom Property', () => { | ||
const table = new TableClass(); | ||
const durationPropertyName = `pwCustomPropertyDurationTest${uuid()}`; | ||
const durationPropertyValue = 'PT1H30M'; | ||
|
||
test.beforeAll('Setup pre-requests', async ({ browser }) => { | ||
const { apiContext, afterAction } = await createNewPage(browser); | ||
await table.create(apiContext); | ||
await afterAction(); | ||
}); | ||
|
||
test.afterAll('Cleanup', async ({ browser }) => { | ||
const { apiContext, afterAction } = await createNewPage(browser); | ||
await table.delete(apiContext); | ||
await afterAction(); | ||
}); | ||
|
||
test('Create, Assign and Test Advance Search for Duration', async ({ | ||
page, | ||
}) => { | ||
test.slow(true); | ||
|
||
await redirectToHomePage(page); | ||
|
||
await test.step('Create and Assign Custom Property Value', async () => { | ||
await settingClick(page, GlobalSettingOptions.TABLES, true); | ||
|
||
await addCustomPropertiesForEntity({ | ||
page, | ||
propertyName: durationPropertyName, | ||
customPropertyData: CUSTOM_PROPERTIES_ENTITIES['entity_table'], | ||
customType: 'Duration', | ||
}); | ||
|
||
await table.visitEntityPage(page); | ||
|
||
await page.getByTestId('custom_properties').click(); // Tab Click | ||
|
||
await page | ||
.getByTestId(`custom-property-${durationPropertyName}-card`) | ||
.locator('svg') | ||
.click(); // Add Custom Property Value | ||
|
||
await page.getByTestId('duration-input').fill(durationPropertyValue); | ||
|
||
const saveResponse = page.waitForResponse('/api/v1/tables/*'); | ||
await page.getByTestId('inline-save-btn').click(); | ||
await saveResponse; | ||
}); | ||
|
||
await test.step('Verify Duration Type in Advance Search ', async () => { | ||
await sidebarClick(page, SidebarItem.EXPLORE); | ||
|
||
await showAdvancedSearchDialog(page); | ||
|
||
const ruleLocator = page.locator('.rule').nth(0); | ||
|
||
// Perform click on rule field | ||
await selectOption( | ||
page, | ||
ruleLocator.locator('.rule--field .ant-select'), | ||
'Custom Properties' | ||
); | ||
|
||
// Perform click on custom property type to filter | ||
await selectOption( | ||
page, | ||
ruleLocator.locator('.rule--field .ant-select'), | ||
durationPropertyName | ||
); | ||
|
||
const inputElement = ruleLocator.locator( | ||
'.rule--widget--TEXT input[type="text"]' | ||
); | ||
|
||
await inputElement.fill(durationPropertyValue); | ||
|
||
await advanceSearchSaveFilter(page, durationPropertyValue); | ||
|
||
await expect( | ||
page.getByTestId( | ||
`table-data-card_${table.entityResponseData.fullyQualifiedName}` | ||
) | ||
).toBeVisible(); | ||
|
||
// Check around the Partial Search Value | ||
const partialSearchValue = durationPropertyValue.slice(0, 3); | ||
|
||
await page.getByTestId('advance-search-filter-btn').click(); | ||
|
||
await expect(page.locator('[role="dialog"].ant-modal')).toBeVisible(); | ||
|
||
// Perform click on operator | ||
await selectOption( | ||
page, | ||
ruleLocator.locator('.rule--operator .ant-select'), | ||
'Contains' | ||
); | ||
|
||
await inputElement.fill(partialSearchValue); | ||
|
||
await advanceSearchSaveFilter(page, partialSearchValue); | ||
|
||
await expect( | ||
page.getByTestId( | ||
`table-data-card_${table.entityResponseData.fullyQualifiedName}` | ||
) | ||
).toBeVisible(); | ||
}); | ||
}); | ||
}); |
28 changes: 28 additions & 0 deletions
28
openmetadata-ui/src/main/resources/ui/playwright/utils/advancedSearchCustomProperty.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Copyright 2025 Collate. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
import { expect, Page } from '@playwright/test'; | ||
|
||
export const advanceSearchSaveFilter = async ( | ||
page: Page, | ||
propertyValue: string | ||
) => { | ||
const searchResponse = page.waitForResponse( | ||
'/api/v1/search/query?*index=dataAsset&from=0&size=10*' | ||
); | ||
await page.getByTestId('apply-btn').click(); | ||
|
||
const res = await searchResponse; | ||
const json = await res.json(); | ||
|
||
expect(JSON.stringify(json)).toContain(propertyValue); | ||
}; |
Oops, something went wrong.