Skip to content

Commit 9fdc925

Browse files
aniketkatkar97OpenMetadata Release Bot
authored andcommitted
Chore(UI): Break down the custom property tests for columns in small pieces (#27818)
* break down the custom property tests for columns in small pieces * work on comment (cherry picked from commit 7e7ed3b)
1 parent 057b2fa commit 9fdc925

1 file changed

Lines changed: 50 additions & 27 deletions

File tree

openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/CustomProperties.spec.ts

Lines changed: 50 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
* so cleanup always runs in afterAll even when a test fails mid-way.
2626
*/
2727

28-
import { expect, test } from '@playwright/test';
28+
import { APIRequestContext, expect, test } from '@playwright/test';
2929
import { CUSTOM_PROPERTIES_ENTITIES } from '../../constant/customProperty';
3030
import {
3131
CP_BASE_VALUES,
@@ -72,6 +72,7 @@ import {
7272
import {
7373
addCustomPropertiesForEntity,
7474
createCustomPropertyForEntity,
75+
CustomProperty,
7576
CustomPropertyTypeByName,
7677
deleteCreatedProperty,
7778
editCreatedProperty,
@@ -133,6 +134,21 @@ type CRUDEntity = {
133134
makeInstance: (() => AssetTypes | OtherTypes) | null;
134135
};
135136

137+
type ColumnsTestData = {
138+
customPropertyValue: Record<
139+
string,
140+
{
141+
value: string;
142+
newValue: string;
143+
property: CustomProperty;
144+
}
145+
>;
146+
cleanupUser: (apiContext: APIRequestContext) => Promise<void>;
147+
users: Record<string, string>;
148+
columnFqn: string;
149+
tableFqn: string;
150+
};
151+
136152
const BASIC_PROPERTIES = [
137153
'Integer',
138154
'String',
@@ -3093,43 +3109,50 @@ ALL_ENTITIES.forEach(({ key, makeInstance }) => {
30933109
// ── TableColumn-specific extra test ────────────────────────────────────
30943110

30953111
if (key === 'entity_tableColumn') {
3096-
test('Set & update column-level custom property', async ({ page }) => {
3097-
// 5 minutes timeout for this test since it handles all cp types
3098-
test.setTimeout(300000);
3112+
test.describe('Set & update column-level custom property', async () => {
3113+
const testData: ColumnsTestData = {} as ColumnsTestData;
30993114

3100-
const { apiContext, afterAction } = await getApiContext(page);
3115+
test.beforeAll(async ({ browser }) => {
3116+
const { apiContext, afterAction } = await createNewPage(browser);
31013117

3102-
const data = await createCustomPropertyForEntity(
3103-
apiContext,
3104-
EntityTypeEndpoint.TableColumn
3105-
);
3106-
const customPropertyValue = data.customProperties;
3107-
const cleanupUser = data.cleanupUser;
3108-
const users = data.userNames;
3118+
const data = await createCustomPropertyForEntity(
3119+
apiContext,
3120+
EntityTypeEndpoint.TableColumn
3121+
);
3122+
testData.customPropertyValue = data.customProperties;
3123+
testData.cleanupUser = data.cleanupUser;
3124+
testData.users = data.userNames;
31093125

3110-
const columnFqn =
3111-
tableForColumnTest?.entityResponseData.columns[0]
3112-
.fullyQualifiedName ?? '';
3113-
const tableFqn =
3114-
tableForColumnTest?.entityResponseData.fullyQualifiedName ?? '';
3126+
testData.columnFqn =
3127+
tableForColumnTest?.entityResponseData.columns[0]
3128+
.fullyQualifiedName ?? '';
3129+
testData.tableFqn =
3130+
tableForColumnTest?.entityResponseData.fullyQualifiedName ?? '';
31153131

3116-
const properties = Object.values(CustomPropertyTypeByName);
3132+
await afterAction();
3133+
});
3134+
3135+
test.afterAll(async ({ browser }) => {
3136+
const { apiContext, afterAction } = await createNewPage(browser);
3137+
3138+
await testData.cleanupUser?.(apiContext);
3139+
await afterAction();
3140+
});
31173141

3118-
for (const type of properties) {
3119-
await test.step(`Set ${type} custom property on column and verify in UI`, async () => {
3142+
for (const type of Object.values(CustomPropertyTypeByName)) {
3143+
test(`Set ${type} custom property on column and verify in UI`, async ({
3144+
page,
3145+
}) => {
31203146
await verifyTableColumnCustomPropertyPersistence({
31213147
page,
3122-
columnFqn,
3123-
tableFqn,
3124-
propertyName: customPropertyValue[type].property.name,
3148+
columnFqn: testData.columnFqn,
3149+
tableFqn: testData.tableFqn,
3150+
propertyName: testData.customPropertyValue[type].property.name,
31253151
propertyType: type,
3126-
users,
3152+
users: testData.users,
31273153
});
31283154
});
31293155
}
3130-
3131-
await cleanupUser(apiContext);
3132-
await afterAction();
31333156
});
31343157
}
31353158

0 commit comments

Comments
 (0)