mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-10-19 12:50:20 +00:00
fix schema table playwright test (#22918)
(cherry picked from commit a0b05dacf421efcb097c836691a29f871991b082)
This commit is contained in:
parent
05853b832b
commit
d64ed2324e
@ -13,49 +13,17 @@
|
|||||||
import { expect, Page } from '@playwright/test';
|
import { expect, Page } from '@playwright/test';
|
||||||
import { test } from '../fixtures/pages';
|
import { test } from '../fixtures/pages';
|
||||||
|
|
||||||
|
import { get } from 'lodash';
|
||||||
import { EntityTypeEndpoint } from '../../support/entity/Entity.interface';
|
import { EntityTypeEndpoint } from '../../support/entity/Entity.interface';
|
||||||
|
import { TableClass } from '../../support/entity/TableClass';
|
||||||
|
import { performAdminLogin } from '../../utils/admin';
|
||||||
import { redirectToHomePage } from '../../utils/common';
|
import { redirectToHomePage } from '../../utils/common';
|
||||||
import {
|
import {
|
||||||
addOwner,
|
addOwner,
|
||||||
updateDisplayNameForEntityChildren,
|
updateDisplayNameForEntityChildren,
|
||||||
} from '../../utils/entity';
|
} from '../../utils/entity';
|
||||||
|
|
||||||
test.beforeEach(
|
const table = new TableClass();
|
||||||
async ({ editDescriptionPage, editTagsPage, editGlossaryTermPage }) => {
|
|
||||||
await redirectToHomePage(editDescriptionPage);
|
|
||||||
await redirectToHomePage(editTagsPage);
|
|
||||||
await redirectToHomePage(editGlossaryTermPage);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
// Setup owner for the table
|
|
||||||
test.beforeAll(async ({ ownerPage, page }) => {
|
|
||||||
// Get logged in user
|
|
||||||
const loggedInUserRequest = ownerPage.waitForResponse(
|
|
||||||
`/api/v1/users/loggedInUser*`
|
|
||||||
);
|
|
||||||
|
|
||||||
await redirectToHomePage(ownerPage);
|
|
||||||
const loggedInUserResponse = await loggedInUserRequest;
|
|
||||||
const loggedInUser = await loggedInUserResponse.json();
|
|
||||||
|
|
||||||
// User admin page to assign owner to the table
|
|
||||||
await page.goto(
|
|
||||||
'/table/sample_data.ecommerce_db.shopify.performance_test_table'
|
|
||||||
);
|
|
||||||
await page.waitForLoadState('networkidle');
|
|
||||||
|
|
||||||
await addOwner({
|
|
||||||
page,
|
|
||||||
owner: loggedInUser.displayName,
|
|
||||||
type: 'Users',
|
|
||||||
endpoint: EntityTypeEndpoint.Table,
|
|
||||||
dataTestId: 'data-assets-header',
|
|
||||||
});
|
|
||||||
|
|
||||||
await page.close();
|
|
||||||
await ownerPage.close();
|
|
||||||
});
|
|
||||||
|
|
||||||
const crudColumnDisplayName = async (
|
const crudColumnDisplayName = async (
|
||||||
page: Page,
|
page: Page,
|
||||||
@ -64,7 +32,7 @@ const crudColumnDisplayName = async (
|
|||||||
rowSelector: string
|
rowSelector: string
|
||||||
) => {
|
) => {
|
||||||
const searchResponse = page.waitForResponse(
|
const searchResponse = page.waitForResponse(
|
||||||
`/api/v1/tables/name/sample_data.ecommerce_db.shopify.performance_test_table/columns/search?q=${columnName}&limit=50&offset=0&fields=tags%2CcustomMetrics&include=all`
|
`/api/v1/tables/name/*/columns/search?q=${columnName}&**`
|
||||||
);
|
);
|
||||||
await page.getByTestId('searchbar').fill(columnName);
|
await page.getByTestId('searchbar').fill(columnName);
|
||||||
await searchResponse;
|
await searchResponse;
|
||||||
@ -104,26 +72,79 @@ const crudColumnDisplayName = async (
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
test.beforeEach(
|
||||||
|
async ({ editDescriptionPage, editTagsPage, editGlossaryTermPage }) => {
|
||||||
|
await redirectToHomePage(editDescriptionPage);
|
||||||
|
await redirectToHomePage(editTagsPage);
|
||||||
|
await redirectToHomePage(editGlossaryTermPage);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
test.beforeAll(async ({ browser }) => {
|
||||||
|
const { apiContext, afterAction } = await performAdminLogin(browser);
|
||||||
|
await table.create(apiContext);
|
||||||
|
await afterAction();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll('Cleanup', async ({ browser }) => {
|
||||||
|
const { apiContext, afterAction } = await performAdminLogin(browser);
|
||||||
|
await table.delete(apiContext);
|
||||||
|
|
||||||
|
await afterAction();
|
||||||
|
});
|
||||||
|
|
||||||
test('schema table test', async ({ dataStewardPage, ownerPage, page }) => {
|
test('schema table test', async ({ dataStewardPage, ownerPage, page }) => {
|
||||||
test.slow();
|
test.slow();
|
||||||
|
|
||||||
const pages = [dataStewardPage, page, ownerPage];
|
await test.step('set owner', async () => {
|
||||||
const tableUrl =
|
const loggedInUserRequest = ownerPage.waitForResponse(
|
||||||
'/table/sample_data.ecommerce_db.shopify.performance_test_table';
|
`/api/v1/users/loggedInUser*`
|
||||||
const columnFqn =
|
|
||||||
'sample_data.ecommerce_db.shopify.performance_test_table.test_col_2000';
|
|
||||||
const columnName = 'test_col_2000';
|
|
||||||
|
|
||||||
for (const currentPage of pages) {
|
|
||||||
await currentPage.goto(tableUrl);
|
|
||||||
await currentPage.waitForLoadState('networkidle');
|
|
||||||
await crudColumnDisplayName(
|
|
||||||
currentPage,
|
|
||||||
columnFqn,
|
|
||||||
columnName,
|
|
||||||
'data-row-key'
|
|
||||||
);
|
);
|
||||||
}
|
await redirectToHomePage(ownerPage);
|
||||||
|
const loggedInUserResponse = await loggedInUserRequest;
|
||||||
|
const loggedInUser = await loggedInUserResponse.json();
|
||||||
|
|
||||||
|
await redirectToHomePage(page);
|
||||||
|
|
||||||
|
await table.visitEntityPage(page);
|
||||||
|
await page.waitForLoadState('networkidle');
|
||||||
|
await page.waitForSelector('[data-testid="loader"]', { state: 'detached' });
|
||||||
|
|
||||||
|
await addOwner({
|
||||||
|
page,
|
||||||
|
owner: loggedInUser.displayName,
|
||||||
|
type: 'Users',
|
||||||
|
endpoint: EntityTypeEndpoint.Table,
|
||||||
|
dataTestId: 'data-assets-header',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
await test.step('set the description', async () => {
|
||||||
|
const pages = [dataStewardPage, page, ownerPage];
|
||||||
|
|
||||||
|
const columnFqn = get(
|
||||||
|
table,
|
||||||
|
'entityResponseData.columns[2].fullyQualifiedName'
|
||||||
|
);
|
||||||
|
|
||||||
|
const columnName = table.columnsName[2];
|
||||||
|
|
||||||
|
for (const currentPage of pages) {
|
||||||
|
await redirectToHomePage(currentPage);
|
||||||
|
|
||||||
|
await table.visitEntityPage(currentPage);
|
||||||
|
await currentPage.waitForLoadState('networkidle');
|
||||||
|
await page.waitForSelector('[data-testid="loader"]', {
|
||||||
|
state: 'detached',
|
||||||
|
});
|
||||||
|
await crudColumnDisplayName(
|
||||||
|
currentPage,
|
||||||
|
columnFqn,
|
||||||
|
columnName,
|
||||||
|
'data-row-key'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Schema Table Pagination should work Properly', async ({ page }) => {
|
test('Schema Table Pagination should work Properly', async ({ page }) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user