feat: add created by for test case entities (#20304)

* feat: add created by for test case entities

* migration: createdBy sql migration
This commit is contained in:
Teddy 2025-03-24 13:13:01 +01:00 committed by GitHub
parent 3684a2661b
commit 5a3fc2cfa4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 130 additions and 115 deletions

View File

@ -0,0 +1,3 @@
UPDATE test_case
SET json = json_set(json, '$.createdBy', json->>'$.updatedBy')
WHERE json->>'$.createdBy' IS NULL;

View File

@ -0,0 +1,3 @@
UPDATE test_case
SET json = json || jsonb_build_object('createdBy', json->>'updatedBy')
WHERE json->>'createdBy' IS NULL;

View File

@ -22,6 +22,7 @@ public class TestCaseMapper implements EntityMapper<TestCase, CreateTestCase> {
.withUseDynamicAssertion(create.getUseDynamicAssertion())
.withEntityFQN(entityLink.getFullyQualifiedFieldValue())
.withTestSuite(getEntityReference(Entity.TEST_SUITE, create.getTestSuite()))
.withTestDefinition(getEntityReference(Entity.TEST_DEFINITION, create.getTestDefinition()));
.withTestDefinition(getEntityReference(Entity.TEST_DEFINITION, create.getTestDefinition()))
.withCreatedBy(user);
}
}

View File

@ -89,6 +89,10 @@
"$ref": "../type/entityReferenceList.json",
"default": null
},
"createdBy": {
"description": "User who made the update.",
"type": "string"
},
"updatedAt": {
"description": "Last update time corresponding to the new version of the entity in Unix epoch time milliseconds.",
"$ref": "../type/basic.json#/definitions/timestamp"

View File

@ -328,58 +328,57 @@ test('Conversation source alert', async ({ page }) => {
});
});
test.fixme('Alert operations for a user with and without permissions', async ({
page,
userWithPermissionsPage,
userWithoutPermissionsPage,
}) => {
test.slow();
test.fixme(
'Alert operations for a user with and without permissions',
async ({ page, userWithPermissionsPage, userWithoutPermissionsPage }) => {
test.slow();
const ALERT_NAME = generateAlertName();
const { apiContext } = await getApiContext(page);
await visitNotificationAlertPage(userWithPermissionsPage);
const ALERT_NAME = generateAlertName();
const { apiContext } = await getApiContext(page);
await visitNotificationAlertPage(userWithPermissionsPage);
await test.step('Create and trigger alert', async () => {
data.alertDetails = await createAlertForRecentEventsCheck({
page: userWithPermissionsPage,
alertName: ALERT_NAME,
sourceName: SOURCE_NAME_5,
sourceDisplayName: SOURCE_DISPLAY_NAME_5,
user: user1,
table,
});
// Trigger alert
await table.deleteTable(apiContext, false);
await table.restore(apiContext);
});
await test.step('Checks for user without permission', async () => {
await checkAlertFlowForWithoutPermissionUser({
page: userWithoutPermissionsPage,
alertDetails: data.alertDetails,
sourceName: SOURCE_NAME_5,
table,
});
});
await test.step(
'Check alert details page and Recent Events tab',
async () => {
await checkAlertDetailsForWithPermissionUser({
await test.step('Create and trigger alert', async () => {
data.alertDetails = await createAlertForRecentEventsCheck({
page: userWithPermissionsPage,
alertName: ALERT_NAME,
sourceName: SOURCE_NAME_5,
sourceDisplayName: SOURCE_DISPLAY_NAME_5,
user: user1,
table,
});
// Trigger alert
await table.deleteTable(apiContext, false);
await table.restore(apiContext);
});
await test.step('Checks for user without permission', async () => {
await checkAlertFlowForWithoutPermissionUser({
page: userWithoutPermissionsPage,
alertDetails: data.alertDetails,
sourceName: SOURCE_NAME_5,
table,
user: user2,
});
}
);
});
await test.step('Delete alert', async () => {
await deleteAlert(userWithPermissionsPage, data.alertDetails);
});
});
await test.step(
'Check alert details page and Recent Events tab',
async () => {
await checkAlertDetailsForWithPermissionUser({
page: userWithPermissionsPage,
alertDetails: data.alertDetails,
sourceName: SOURCE_NAME_5,
table,
user: user2,
});
}
);
await test.step('Delete alert', async () => {
await deleteAlert(userWithPermissionsPage, data.alertDetails);
});
}
);
test('destination should work properly', async ({ page }) => {
await visitNotificationAlertPage(page);

View File

@ -124,83 +124,86 @@ test.describe('Explore Tree scenarios ', () => {
);
});
test.fixme('Verify Database and Database schema after rename', async ({ page }) => {
const { apiContext, afterAction } = await getApiContext(page);
const table = new TableClass();
await table.create(apiContext);
await table.visitEntityPage(page);
const schemaName = get(table.schemaResponseData, 'name', '');
const dbName = get(table.databaseResponseData, 'name', '');
const serviceName = get(table.serviceResponseData, 'name', '');
const updatedSchemaName = `Test ${schemaName} updated`;
const updatedDbName = `Test ${dbName} updated`;
test.fixme(
'Verify Database and Database schema after rename',
async ({ page }) => {
const { apiContext, afterAction } = await getApiContext(page);
const table = new TableClass();
await table.create(apiContext);
await table.visitEntityPage(page);
const schemaName = get(table.schemaResponseData, 'name', '');
const dbName = get(table.databaseResponseData, 'name', '');
const serviceName = get(table.serviceResponseData, 'name', '');
const updatedSchemaName = `Test ${schemaName} updated`;
const updatedDbName = `Test ${dbName} updated`;
const schemaRes = page.waitForResponse('/api/v1/databaseSchemas/name/*');
await page.getByRole('link', { name: schemaName }).click();
// Rename Schema Page
await schemaRes;
await updateDisplayNameForEntity(
page,
updatedSchemaName,
EntityTypeEndpoint.DatabaseSchema
);
const schemaRes = page.waitForResponse('/api/v1/databaseSchemas/name/*');
await page.getByRole('link', { name: schemaName }).click();
// Rename Schema Page
await schemaRes;
await updateDisplayNameForEntity(
page,
updatedSchemaName,
EntityTypeEndpoint.DatabaseSchema
);
const dbRes = page.waitForResponse('/api/v1/databases/name/*');
await page.getByRole('link', { name: dbName }).click();
// Rename Database Page
await dbRes;
await updateDisplayNameForEntity(
page,
updatedDbName,
EntityTypeEndpoint.Database
);
const dbRes = page.waitForResponse('/api/v1/databases/name/*');
await page.getByRole('link', { name: dbName }).click();
// Rename Database Page
await dbRes;
await updateDisplayNameForEntity(
page,
updatedDbName,
EntityTypeEndpoint.Database
);
await sidebarClick(page, SidebarItem.EXPLORE);
await page.waitForLoadState('networkidle');
const serviceNameRes = page.waitForResponse(
'/api/v1/search/query?q=&index=database_search_index&from=0&size=0*mysql*'
);
await page
.locator('div')
.filter({ hasText: /^mysql$/ })
.locator('svg')
.first()
.click();
await serviceNameRes;
await sidebarClick(page, SidebarItem.EXPLORE);
await page.waitForLoadState('networkidle');
const serviceNameRes = page.waitForResponse(
'/api/v1/search/query?q=&index=database_search_index&from=0&size=0*mysql*'
);
await page
.locator('div')
.filter({ hasText: /^mysql$/ })
.locator('svg')
.first()
.click();
await serviceNameRes;
const databaseRes = page.waitForResponse(
'/api/v1/search/query?q=&index=dataAsset*serviceType*'
);
const databaseRes = page.waitForResponse(
'/api/v1/search/query?q=&index=dataAsset*serviceType*'
);
await page
.locator('.ant-tree-treenode')
.filter({ hasText: serviceName })
.locator('.ant-tree-switcher svg')
.click();
await databaseRes;
await page
.locator('.ant-tree-treenode')
.filter({ hasText: serviceName })
.locator('.ant-tree-switcher svg')
.click();
await databaseRes;
await expect(
page.getByTestId(`explore-tree-title-${updatedDbName}`)
).toBeVisible();
await expect(
page.getByTestId(`explore-tree-title-${updatedDbName}`)
).toBeVisible();
const databaseSchemaRes = page.waitForResponse(
'/api/v1/search/query?q=&index=dataAsset*database.displayName*'
);
const databaseSchemaRes = page.waitForResponse(
'/api/v1/search/query?q=&index=dataAsset*database.displayName*'
);
await page
.locator('.ant-tree-treenode')
.filter({ hasText: updatedDbName })
.locator('.ant-tree-switcher svg')
.click();
await databaseSchemaRes;
await page
.locator('.ant-tree-treenode')
.filter({ hasText: updatedDbName })
.locator('.ant-tree-switcher svg')
.click();
await databaseSchemaRes;
await expect(
page.getByTestId(`explore-tree-title-${updatedSchemaName}`)
).toBeVisible();
await expect(
page.getByTestId(`explore-tree-title-${updatedSchemaName}`)
).toBeVisible();
await table.delete(apiContext);
await afterAction();
});
await table.delete(apiContext);
await afterAction();
}
);
});
test.describe('Explore page', () => {

View File

@ -46,9 +46,7 @@ export const visitServiceDetailsPage = async (
await page.waitForLoadState('networkidle');
if (verifyHeader) {
const text = await page.textContent(
`[data-testid="entity-header-name"]`
);
const text = await page.textContent(`[data-testid="entity-header-name"]`);
expect(text).toBe(service.displayName);
}

View File

@ -23,6 +23,10 @@ export interface TestCase {
* Compute the passed and failed row count for the test case.
*/
computePassedFailedRowCount?: boolean;
/**
* User who made the update.
*/
createdBy?: string;
/**
* When `true` indicates the entity has been soft deleted.
*/