diff --git a/bootstrap/sql/migrations/native/1.7.0/mysql/postDataMigrationSQLScript.sql b/bootstrap/sql/migrations/native/1.7.0/mysql/postDataMigrationSQLScript.sql index e69de29bb2d..b0b73d947fc 100644 --- a/bootstrap/sql/migrations/native/1.7.0/mysql/postDataMigrationSQLScript.sql +++ b/bootstrap/sql/migrations/native/1.7.0/mysql/postDataMigrationSQLScript.sql @@ -0,0 +1,3 @@ +UPDATE test_case +SET json = json_set(json, '$.createdBy', json->>'$.updatedBy') +WHERE json->>'$.createdBy' IS NULL; \ No newline at end of file diff --git a/bootstrap/sql/migrations/native/1.7.0/postgres/postDataMigrationSQLScript.sql b/bootstrap/sql/migrations/native/1.7.0/postgres/postDataMigrationSQLScript.sql index e69de29bb2d..459728b5b11 100644 --- a/bootstrap/sql/migrations/native/1.7.0/postgres/postDataMigrationSQLScript.sql +++ b/bootstrap/sql/migrations/native/1.7.0/postgres/postDataMigrationSQLScript.sql @@ -0,0 +1,3 @@ +UPDATE test_case +SET json = json || jsonb_build_object('createdBy', json->>'updatedBy') +WHERE json->>'createdBy' IS NULL; \ No newline at end of file diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/dqtests/TestCaseMapper.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/dqtests/TestCaseMapper.java index a23a1348630..71ae804bbf4 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/dqtests/TestCaseMapper.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/dqtests/TestCaseMapper.java @@ -22,6 +22,7 @@ public class TestCaseMapper implements EntityMapper { .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); } } diff --git a/openmetadata-spec/src/main/resources/json/schema/tests/testCase.json b/openmetadata-spec/src/main/resources/json/schema/tests/testCase.json index 33df22b9498..fe78d10f824 100644 --- a/openmetadata-spec/src/main/resources/json/schema/tests/testCase.json +++ b/openmetadata-spec/src/main/resources/json/schema/tests/testCase.json @@ -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" diff --git a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Flow/NotificationAlerts.spec.ts b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Flow/NotificationAlerts.spec.ts index 0532e157d6e..08fb123a3f4 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Flow/NotificationAlerts.spec.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Flow/NotificationAlerts.spec.ts @@ -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); diff --git a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/ExploreTree.spec.ts b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/ExploreTree.spec.ts index 2987d57d9d0..83e0e779bba 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/ExploreTree.spec.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/ExploreTree.spec.ts @@ -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', () => { diff --git a/openmetadata-ui/src/main/resources/ui/playwright/utils/service.ts b/openmetadata-ui/src/main/resources/ui/playwright/utils/service.ts index 486c7284732..70e6023f09a 100644 --- a/openmetadata-ui/src/main/resources/ui/playwright/utils/service.ts +++ b/openmetadata-ui/src/main/resources/ui/playwright/utils/service.ts @@ -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); } diff --git a/openmetadata-ui/src/main/resources/ui/src/generated/tests/testCase.ts b/openmetadata-ui/src/main/resources/ui/src/generated/tests/testCase.ts index 2b0829c6ad8..7a7b46b1b63 100644 --- a/openmetadata-ui/src/main/resources/ui/src/generated/tests/testCase.ts +++ b/openmetadata-ui/src/main/resources/ui/src/generated/tests/testCase.ts @@ -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. */