Skip to content

Commit 7e7ed3b

Browse files
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
1 parent 8b0f4a7 commit 7e7ed3b

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',
@@ -3340,43 +3356,50 @@ ALL_ENTITIES.forEach(({ key, makeInstance }) => {
33403356
// ── TableColumn-specific extra test ────────────────────────────────────
33413357

33423358
if (key === 'entity_tableColumn') {
3343-
test('Set & update column-level custom property', async ({ page }) => {
3344-
// 5 minutes timeout for this test since it handles all cp types
3345-
test.setTimeout(300000);
3359+
test.describe('Set & update column-level custom property', async () => {
3360+
const testData: ColumnsTestData = {} as ColumnsTestData;
33463361

3347-
const { apiContext, afterAction } = await getApiContext(page);
3362+
test.beforeAll(async ({ browser }) => {
3363+
const { apiContext, afterAction } = await createNewPage(browser);
33483364

3349-
const data = await createCustomPropertyForEntity(
3350-
apiContext,
3351-
EntityTypeEndpoint.TableColumn
3352-
);
3353-
const customPropertyValue = data.customProperties;
3354-
const cleanupUser = data.cleanupUser;
3355-
const users = data.userNames;
3365+
const data = await createCustomPropertyForEntity(
3366+
apiContext,
3367+
EntityTypeEndpoint.TableColumn
3368+
);
3369+
testData.customPropertyValue = data.customProperties;
3370+
testData.cleanupUser = data.cleanupUser;
3371+
testData.users = data.userNames;
33563372

3357-
const columnFqn =
3358-
tableForColumnTest?.entityResponseData.columns[0]
3359-
.fullyQualifiedName ?? '';
3360-
const tableFqn =
3361-
tableForColumnTest?.entityResponseData.fullyQualifiedName ?? '';
3373+
testData.columnFqn =
3374+
tableForColumnTest?.entityResponseData.columns[0]
3375+
.fullyQualifiedName ?? '';
3376+
testData.tableFqn =
3377+
tableForColumnTest?.entityResponseData.fullyQualifiedName ?? '';
33623378

3363-
const properties = Object.values(CustomPropertyTypeByName);
3379+
await afterAction();
3380+
});
3381+
3382+
test.afterAll(async ({ browser }) => {
3383+
const { apiContext, afterAction } = await createNewPage(browser);
3384+
3385+
await testData.cleanupUser?.(apiContext);
3386+
await afterAction();
3387+
});
33643388

3365-
for (const type of properties) {
3366-
await test.step(`Set ${type} custom property on column and verify in UI`, async () => {
3389+
for (const type of Object.values(CustomPropertyTypeByName)) {
3390+
test(`Set ${type} custom property on column and verify in UI`, async ({
3391+
page,
3392+
}) => {
33673393
await verifyTableColumnCustomPropertyPersistence({
33683394
page,
3369-
columnFqn,
3370-
tableFqn,
3371-
propertyName: customPropertyValue[type].property.name,
3395+
columnFqn: testData.columnFqn,
3396+
tableFqn: testData.tableFqn,
3397+
propertyName: testData.customPropertyValue[type].property.name,
33723398
propertyType: type,
3373-
users,
3399+
users: testData.users,
33743400
});
33753401
});
33763402
}
3377-
3378-
await cleanupUser(apiContext);
3379-
await afterAction();
33803403
});
33813404
}
33823405

0 commit comments

Comments
 (0)