Skip to content
Merged
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 @@ -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();
Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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();

Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
>;

export const getNestedColumnDetails = (type: string, data: EntityTypes) => {
const entityData = data.entityResponseData as any;

Check warning on line 30 in openmetadata-ui/src/main/resources/ui/playwright/utils/nestedColumnUpdatesUtils.ts

View workflow job for this annotation

GitHub Actions / lint-playwright

Unexpected any. Specify a different type
const fqn = entityData.fullyQualifiedName;

switch (type) {
Expand Down Expand Up @@ -136,7 +136,7 @@

const DUPLICATE_NAME = `name-${uuid()}`;

const expandNestedColumn = async (
export const expandNestedColumn = async (
page: Page,
rowKey: string,
childKey: string
Expand Down Expand Up @@ -996,7 +996,7 @@
entity,
service,
deleteService: () =>
worksheetClass.delete(apiContext).then(() => ({} as any)),

Check warning on line 999 in openmetadata-ui/src/main/resources/ui/playwright/utils/nestedColumnUpdatesUtils.ts

View workflow job for this annotation

GitHub Actions / lint-playwright

Unexpected any. Specify a different type
visitPage: async (page: Page) => {
await worksheetClass.visitEntityPage(page);
},
Expand Down Expand Up @@ -1064,7 +1064,7 @@
return {
entity,
service,
deleteService: () => fileClass.delete(apiContext).then(() => ({} as any)),

Check warning on line 1067 in openmetadata-ui/src/main/resources/ui/playwright/utils/nestedColumnUpdatesUtils.ts

View workflow job for this annotation

GitHub Actions / lint-playwright

Unexpected any. Specify a different type
visitPage: async (page: Page) => {
await fileClass.visitEntityPage(page);
await page.getByTestId('schema').click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
<TestDefinitionForm onCancel={mockOnCancel} onSuccess={mockOnSuccess} />
);
Expand All @@ -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);
});
});

Expand All @@ -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');
});
});

Expand All @@ -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');
});
});

Expand All @@ -430,6 +431,29 @@ describe('TestDefinitionForm Component', () => {
).toBeInTheDocument();
});

it('supportedDataTypes field is required for OpenMetadata tests', async () => {
render(
<TestDefinitionForm
onCancel={mockOnCancel}
onSuccess={mockOnSuccess}
/>
);

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(
<TestDefinitionForm
Expand Down Expand Up @@ -558,9 +582,14 @@ describe('TestDefinitionForm Component', () => {
await assertNoRequiredError(formItem);
});

it('supportedDataTypes field is optional', async () => {
it('supportedDataTypes field is optional for non-OpenMetadata tests', async () => {
render(
<TestDefinitionForm
initialValues={{
...mockExternalTestDefinition,
testPlatforms: [TestPlatform.Dbt],
supportedDataTypes: [],
}}
onCancel={mockOnCancel}
onSuccess={mockOnSuccess}
/>
Expand Down
Loading