diff --git a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/DescriptionSuggestion.spec.ts b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/DescriptionSuggestion.spec.ts index dd2d3fc29ec2..3e79e8bcca26 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/DescriptionSuggestion.spec.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/DescriptionSuggestion.spec.ts @@ -17,7 +17,10 @@ import { UserClass } from '../../support/user/UserClass'; import { performAdminLogin } from '../../utils/admin'; import { redirectToHomePage } from '../../utils/common'; import { waitForAllLoadersToDisappear } from '../../utils/entity'; -import { createTableDescriptionSuggestions } from '../../utils/suggestions'; +import { + createTableDescriptionSuggestions, + expandTableSuggestionColumns, +} from '../../utils/suggestions'; import { performUserLogin } from '../../utils/user'; const table = new TableClass(); @@ -72,6 +75,9 @@ test.describe.serial( // Two users profile will be visible, 3rd one will come after AllFetch is clicked await expect(allAvatarSuggestion).toHaveCount(1); + // Expand nested struct/array columns so their suggestion cards render + await expandTableSuggestionColumns(page, table); + // Click the first avatar await allAvatarSuggestion.nth(0).click(); @@ -135,6 +141,9 @@ test.describe.serial( .getByTestId('asset-description-container') .getByTestId('profile-avatar'); + // Expand nested columns so columnsName[5] row is accessible + await expandTableSuggestionColumns(page, table); + // Click the first avatar await allAvatarSuggestion.nth(0).click(); @@ -153,6 +162,10 @@ test.describe.serial( await page.reload(); await waitForAllLoadersToDisappear(page); + // Re-expand after reload so columnsName[5] row is visible for verification + // and remains expanded for subsequent test steps + await expandTableSuggestionColumns(page, table); + // since we accepted two suggestions, the badge count should be total-2 await expect( page diff --git a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/TagsSuggestion.spec.ts b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/TagsSuggestion.spec.ts index 8d9940d09d85..2011f047fa39 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/TagsSuggestion.spec.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/TagsSuggestion.spec.ts @@ -15,7 +15,10 @@ import { TableClass } from '../../support/entity/TableClass'; import { UserClass } from '../../support/user/UserClass'; import { performAdminLogin } from '../../utils/admin'; import { redirectToHomePage } from '../../utils/common'; -import { createTableTagsSuggestions } from '../../utils/suggestions'; +import { + createTableTagsSuggestions, + expandTableSuggestionColumns, +} from '../../utils/suggestions'; const table = new TableClass(); const table2 = new TableClass(); @@ -73,6 +76,9 @@ test.describe('Tags Suggestions Table Entity', () => { // Two users profile will be visible, 3rd one will come after AllFetch is clicked await expect(allAvatarSuggestion).toHaveCount(1); + // Expand nested struct/array columns so their suggestion cards render + await expandTableSuggestionColumns(page, table); + // Click the first avatar await allAvatarSuggestion.nth(0).click(); diff --git a/openmetadata-ui/src/main/resources/ui/playwright/utils/nestedColumnUpdatesUtils.ts b/openmetadata-ui/src/main/resources/ui/playwright/utils/nestedColumnUpdatesUtils.ts index 3faa7c785355..b2b6a77abbe4 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/utils/nestedColumnUpdatesUtils.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/utils/nestedColumnUpdatesUtils.ts @@ -136,7 +136,7 @@ export const getNestedColumnDetails = (type: string, data: EntityTypes) => { const DUPLICATE_NAME = `name-${uuid()}`; -const expandNestedColumn = async ( +export const expandNestedColumn = async ( page: Page, rowKey: string, childKey: string diff --git a/openmetadata-ui/src/main/resources/ui/playwright/utils/suggestions.ts b/openmetadata-ui/src/main/resources/ui/playwright/utils/suggestions.ts index 49f5b878075a..301a06ed0a50 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/utils/suggestions.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/utils/suggestions.ts @@ -10,7 +10,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { APIRequestContext } from '@playwright/test'; +import { APIRequestContext, Page } from '@playwright/test'; +import { TableClass } from '../support/entity/TableClass'; +import { expandNestedColumn } from './nestedColumnUpdatesUtils'; const SUGGESTION_DESCRIPTION_DATA = { description: 'this is suggested data description', @@ -45,6 +47,25 @@ const SUGGESTION_TIER_TAGS_DATA = { type: 'SuggestTagLabel', }; +export const expandTableSuggestionColumns = async ( + page: Page, + table: TableClass +) => { + const cols = table.entityResponseData.columns ?? []; + const structCol = cols[2]; + const arrayCol = (structCol.children ?? [])[1]; + await expandNestedColumn( + page, + structCol.fullyQualifiedName ?? '', + (structCol.children ?? [])[0].fullyQualifiedName ?? '' + ); + await expandNestedColumn( + page, + arrayCol.fullyQualifiedName ?? '', + (arrayCol.children ?? [])[0].fullyQualifiedName ?? '' + ); +}; + export const createTableDescriptionSuggestions = async ( apiContext: APIRequestContext, entityLink: string diff --git a/openmetadata-ui/src/main/resources/ui/src/components/TestLibrary/TestDefinitionForm/TestDefinitionForm.test.tsx b/openmetadata-ui/src/main/resources/ui/src/components/TestLibrary/TestDefinitionForm/TestDefinitionForm.test.tsx index d4f90f185bb5..f5cf7823914a 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/TestLibrary/TestDefinitionForm/TestDefinitionForm.test.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/TestLibrary/TestDefinitionForm/TestDefinitionForm.test.tsx @@ -352,8 +352,9 @@ describe('TestDefinitionForm Component', () => { }; // testPlatforms defaults to [OpenMetadata] so it never fires an error on empty submit. - // name + entityType are the two required fields without defaults. - it('should show exactly 2 validation errors when create form is submitted empty', async () => { + // supportedDataTypes is required when OpenMetadata is selected. + // name + entityType + supportedDataTypes are the required fields without defaults. + it('should show exactly 3 validation errors when create form is submitted empty', async () => { render( ); @@ -363,7 +364,7 @@ describe('TestDefinitionForm Component', () => { await waitFor(() => { const errors = screen.getAllByText('message.field-text-is-required'); - expect(errors).toHaveLength(2); + expect(errors).toHaveLength(3); }); }); @@ -383,9 +384,9 @@ describe('TestDefinitionForm Component', () => { .getByLabelText('label.name') .closest('.ant-form-item'); - expect(nameFormItem).toHaveTextContent( - 'message.field-text-is-required' - ); + expect( + nameFormItem?.querySelector('.ant-form-item-explain-error') + ).toHaveTextContent('message.field-text-is-required'); }); }); @@ -404,9 +405,9 @@ describe('TestDefinitionForm Component', () => { .getByLabelText('label.entity-type') .closest('.ant-form-item'); - expect(entityTypeFormItem).toHaveTextContent( - 'message.field-text-is-required' - ); + expect( + entityTypeFormItem?.querySelector('.ant-form-item-explain-error') + ).toHaveTextContent('message.field-text-is-required'); }); }); @@ -430,6 +431,29 @@ describe('TestDefinitionForm Component', () => { ).toBeInTheDocument(); }); + it('supportedDataTypes field is required for OpenMetadata tests', async () => { + render( + + ); + + await submitEmptyForm(); + + await waitFor(() => { + const supportedDataTypesFormItem = screen + .getByLabelText('label.supported-data-type-plural') + .closest('.ant-form-item'); + + expect( + supportedDataTypesFormItem?.querySelector( + '.ant-form-item-explain-error' + ) + ).toHaveTextContent('message.field-text-is-required'); + }); + }); + it('parameter name field is required', async () => { render( { await assertNoRequiredError(formItem); }); - it('supportedDataTypes field is optional', async () => { + it('supportedDataTypes field is optional for non-OpenMetadata tests', async () => { render(