mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-10-31 18:48:35 +00:00
playwright: fixed failing aut test in main (#17818)
* playwright: fixed failing aut test in main * fix myData spec failure --------- Co-authored-by: Ashish Gupta <ashish@getcollate.io> Co-authored-by: Chirag Madlani <12962843+chirag-madlani@users.noreply.github.com>
This commit is contained in:
parent
16e25bc469
commit
fda7e1ecb9
@ -14,8 +14,7 @@ import { expect, Page, test as base } from '@playwright/test';
|
|||||||
import { TableClass } from '../../support/entity/TableClass';
|
import { TableClass } from '../../support/entity/TableClass';
|
||||||
import { UserClass } from '../../support/user/UserClass';
|
import { UserClass } from '../../support/user/UserClass';
|
||||||
import { performAdminLogin } from '../../utils/admin';
|
import { performAdminLogin } from '../../utils/admin';
|
||||||
import { redirectToHomePage } from '../../utils/common';
|
import { redirectToHomePage, removeLandingBanner } from '../../utils/common';
|
||||||
import { addMultiOwner, followEntity } from '../../utils/entity';
|
|
||||||
import { verifyEntities } from '../../utils/myData';
|
import { verifyEntities } from '../../utils/myData';
|
||||||
|
|
||||||
const user = new UserClass();
|
const user = new UserClass();
|
||||||
@ -38,6 +37,25 @@ test.describe('My Data page', () => {
|
|||||||
await user.create(apiContext);
|
await user.create(apiContext);
|
||||||
for (const table of TableEntities) {
|
for (const table of TableEntities) {
|
||||||
await table.create(apiContext);
|
await table.create(apiContext);
|
||||||
|
await table.patch({
|
||||||
|
apiContext,
|
||||||
|
patchData: [
|
||||||
|
{
|
||||||
|
op: 'add',
|
||||||
|
path: '/owners/0',
|
||||||
|
value: {
|
||||||
|
id: user.responseData.id,
|
||||||
|
type: 'user',
|
||||||
|
deleted: false,
|
||||||
|
displayName: user.responseData.displayName,
|
||||||
|
fullyQualifiedName: user.responseData.fullyQualifiedName,
|
||||||
|
href: user.responseData['href'] ?? '',
|
||||||
|
name: user.responseData.name,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
await table.followTable(apiContext, user.responseData.id);
|
||||||
}
|
}
|
||||||
await afterAction();
|
await afterAction();
|
||||||
});
|
});
|
||||||
@ -53,67 +71,40 @@ test.describe('My Data page', () => {
|
|||||||
|
|
||||||
test.beforeEach('Visit entity details page', async ({ page }) => {
|
test.beforeEach('Visit entity details page', async ({ page }) => {
|
||||||
await redirectToHomePage(page);
|
await redirectToHomePage(page);
|
||||||
|
await removeLandingBanner(page);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Verify MyData and Following widget', async ({ page }) => {
|
test('Verify my data widget', async ({ page }) => {
|
||||||
test.slow(true);
|
// Verify total count
|
||||||
|
await expect(
|
||||||
|
page.locator('[data-testid="my-data-total-count"]')
|
||||||
|
).toContainText('(20)');
|
||||||
|
|
||||||
await test.step(
|
await page
|
||||||
'Set user as the Owner of the Table and also Follow it',
|
.locator('[data-testid="my-data-widget"] [data-testid="view-all-link"]')
|
||||||
async () => {
|
.click();
|
||||||
for (const table of TableEntities) {
|
|
||||||
await table.visitEntityPage(page);
|
// Verify entities
|
||||||
await addMultiOwner({
|
await verifyEntities(
|
||||||
page,
|
page,
|
||||||
ownerNames: [user.getUserName()],
|
'/api/v1/search/query?q=*&index=all&from=0&size=25',
|
||||||
activatorBtnDataTestId: 'edit-owner',
|
TableEntities
|
||||||
resultTestId: 'data-assets-header',
|
|
||||||
endpoint: table.endpoint,
|
|
||||||
type: 'Users',
|
|
||||||
});
|
|
||||||
await followEntity(page, table.endpoint);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
|
});
|
||||||
|
|
||||||
await test.step('Verify my data widget', async () => {
|
test('Verify following widget', async ({ page }) => {
|
||||||
await redirectToHomePage(page);
|
// Verify total count
|
||||||
// Verify total count
|
await expect(
|
||||||
const totalCount = await page
|
page.locator('[data-testid="following-data-total-count"]')
|
||||||
.locator('[data-testid="my-data-total-count"]')
|
).toContainText('(20)');
|
||||||
.innerText();
|
|
||||||
|
|
||||||
expect(totalCount).toBe('(20)');
|
await page.locator('[data-testid="following-data"]').click();
|
||||||
|
|
||||||
await page
|
// Verify entities
|
||||||
.locator('[data-testid="my-data-widget"] [data-testid="view-all-link"]')
|
await verifyEntities(
|
||||||
.click();
|
page,
|
||||||
|
'/api/v1/search/query?q=*followers:*&index=all&from=0&size=25',
|
||||||
// Verify entities
|
TableEntities
|
||||||
await verifyEntities(
|
);
|
||||||
page,
|
|
||||||
'/api/v1/search/query?q=*&index=all&from=0&size=25',
|
|
||||||
TableEntities
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
await test.step('Verify following widget', async () => {
|
|
||||||
await redirectToHomePage(page);
|
|
||||||
// Verify total count
|
|
||||||
const totalCount = await page
|
|
||||||
.locator('[data-testid="following-data-total-count"]')
|
|
||||||
.innerText();
|
|
||||||
|
|
||||||
expect(totalCount).toBe('(20)');
|
|
||||||
|
|
||||||
await page.locator('[data-testid="following-data"]').click();
|
|
||||||
|
|
||||||
// Verify entities
|
|
||||||
await verifyEntities(
|
|
||||||
page,
|
|
||||||
'/api/v1/search/query?q=*followers:*&index=all&from=0&size=25',
|
|
||||||
TableEntities
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -53,8 +53,6 @@ const permanentDeleteModal = async (page: Page, entity: string) => {
|
|||||||
await page.click('[data-testid="confirm-button"]');
|
await page.click('[data-testid="confirm-button"]');
|
||||||
};
|
};
|
||||||
|
|
||||||
test.describe.configure({ mode: 'serial' });
|
|
||||||
|
|
||||||
// use the admin user to login
|
// use the admin user to login
|
||||||
test.use({ storageState: 'playwright/.auth/admin.json' });
|
test.use({ storageState: 'playwright/.auth/admin.json' });
|
||||||
|
|
||||||
@ -77,6 +75,8 @@ test.beforeEach(async ({ page }) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('Classification Page', async ({ page }) => {
|
test('Classification Page', async ({ page }) => {
|
||||||
|
test.slow();
|
||||||
|
|
||||||
await test.step('Should render basic elements on page', async () => {
|
await test.step('Should render basic elements on page', async () => {
|
||||||
const getTags = page.waitForResponse('/api/v1/tags*');
|
const getTags = page.waitForResponse('/api/v1/tags*');
|
||||||
await sidebarClick(page, SidebarItem.TAGS);
|
await sidebarClick(page, SidebarItem.TAGS);
|
||||||
|
|||||||
@ -55,6 +55,8 @@ test.beforeEach(async ({ page }) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('Logical TestSuite', async ({ page }) => {
|
test('Logical TestSuite', async ({ page }) => {
|
||||||
|
test.slow();
|
||||||
|
|
||||||
const NEW_TEST_SUITE = {
|
const NEW_TEST_SUITE = {
|
||||||
name: `mysql_matrix-${uuid()}`,
|
name: `mysql_matrix-${uuid()}`,
|
||||||
description: 'mysql critical matrix',
|
description: 'mysql critical matrix',
|
||||||
|
|||||||
@ -302,6 +302,18 @@ export class TableClass extends EntityClass {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async followTable(apiContext: APIRequestContext, userId: string) {
|
||||||
|
await apiContext.put(
|
||||||
|
`/api/v1/tables/${this.entityResponseData?.['id']}/followers`,
|
||||||
|
{
|
||||||
|
data: userId,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
async delete(apiContext: APIRequestContext) {
|
async delete(apiContext: APIRequestContext) {
|
||||||
const serviceResponse = await apiContext.delete(
|
const serviceResponse = await apiContext.delete(
|
||||||
`/api/v1/services/databaseServices/name/${encodeURIComponent(
|
`/api/v1/services/databaseServices/name/${encodeURIComponent(
|
||||||
|
|||||||
@ -57,6 +57,12 @@ export const redirectToHomePage = async (page: Page) => {
|
|||||||
await page.waitForURL('**/my-data');
|
await page.waitForURL('**/my-data');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const removeLandingBanner = async (page: Page) => {
|
||||||
|
const widgetResponse = page.waitForResponse('/api/v1/search/query?q=**');
|
||||||
|
await page.click('[data-testid="welcome-screen-close-btn"]');
|
||||||
|
await widgetResponse;
|
||||||
|
};
|
||||||
|
|
||||||
export const createNewPage = async (browser: Browser) => {
|
export const createNewPage = async (browser: Browser) => {
|
||||||
// create a new page
|
// create a new page
|
||||||
const page = await browser.newPage();
|
const page = await browser.newPage();
|
||||||
|
|||||||
@ -19,8 +19,8 @@ export const verifyEntities = async (
|
|||||||
tables: TableClass[]
|
tables: TableClass[]
|
||||||
) => {
|
) => {
|
||||||
// Change pagination size to 25
|
// Change pagination size to 25
|
||||||
const fetchResponse = page.waitForResponse(url);
|
|
||||||
await page.locator('[data-testid="pagination"] .ant-btn-default').click();
|
await page.locator('[data-testid="pagination"] .ant-btn-default').click();
|
||||||
|
const fetchResponse = page.waitForResponse(url);
|
||||||
await page.locator('[role="menu"] [value="25"]').click();
|
await page.locator('[role="menu"] [value="25"]').click();
|
||||||
await fetchResponse;
|
await fetchResponse;
|
||||||
|
|
||||||
|
|||||||
@ -245,6 +245,7 @@ const TestSuitePipelineTab = ({ testSuite }: Props) => {
|
|||||||
pipelineIdToFetchStatus={pipelineIdToFetchStatus}
|
pipelineIdToFetchStatus={pipelineIdToFetchStatus}
|
||||||
serviceCategory={ServiceCategory.DATABASE_SERVICES}
|
serviceCategory={ServiceCategory.DATABASE_SERVICES}
|
||||||
serviceName={getServiceFromTestSuiteFQN(testSuiteFQN)}
|
serviceName={getServiceFromTestSuiteFQN(testSuiteFQN)}
|
||||||
|
tableClassName="test-suite-pipeline-tab"
|
||||||
triggerIngestion={handleTriggerIngestion}
|
triggerIngestion={handleTriggerIngestion}
|
||||||
onIngestionWorkflowsUpdate={getAllIngestionWorkflows}
|
onIngestionWorkflowsUpdate={getAllIngestionWorkflows}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@ -55,4 +55,5 @@ export interface IngestionListTableProps {
|
|||||||
text: string,
|
text: string,
|
||||||
record: IngestionPipeline
|
record: IngestionPipeline
|
||||||
) => ReactNode;
|
) => ReactNode;
|
||||||
|
tableClassName?: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -79,6 +79,7 @@ function IngestionListTable({
|
|||||||
showDescriptionCol,
|
showDescriptionCol,
|
||||||
triggerIngestion,
|
triggerIngestion,
|
||||||
customRenderNameField,
|
customRenderNameField,
|
||||||
|
tableClassName,
|
||||||
}: Readonly<IngestionListTableProps>) {
|
}: Readonly<IngestionListTableProps>) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { theme } = useApplicationStore();
|
const { theme } = useApplicationStore();
|
||||||
@ -333,6 +334,7 @@ function IngestionListTable({
|
|||||||
<Col span={24}>
|
<Col span={24}>
|
||||||
<Table
|
<Table
|
||||||
bordered
|
bordered
|
||||||
|
className={tableClassName}
|
||||||
columns={tableColumn}
|
columns={tableColumn}
|
||||||
data-testid="ingestion-list-table"
|
data-testid="ingestion-list-table"
|
||||||
dataSource={ingestionData}
|
dataSource={ingestionData}
|
||||||
|
|||||||
@ -808,7 +808,8 @@ a[href].link-text-grey,
|
|||||||
// Right side padding 20 + 64 width of sidebar
|
// Right side padding 20 + 64 width of sidebar
|
||||||
margin-right: 84px;
|
margin-right: 84px;
|
||||||
}
|
}
|
||||||
.test-case-table-container {
|
.test-case-table-container,
|
||||||
|
.test-suite-pipeline-tab {
|
||||||
margin-right: 64px;
|
margin-right: 64px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user