Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

playwright: fixed failing aut test in main #17818

Merged
merged 4 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ import { expect, Page, test as base } from '@playwright/test';
import { TableClass } from '../../support/entity/TableClass';
import { UserClass } from '../../support/user/UserClass';
import { performAdminLogin } from '../../utils/admin';
import { redirectToHomePage } from '../../utils/common';
import { addMultiOwner, followEntity } from '../../utils/entity';
import { redirectToHomePage, removeLandingBanner } from '../../utils/common';
import { verifyEntities } from '../../utils/myData';

const user = new UserClass();
Expand All @@ -38,6 +37,25 @@ test.describe('My Data page', () => {
await user.create(apiContext);
for (const table of TableEntities) {
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();
});
Expand All @@ -53,67 +71,40 @@ test.describe('My Data page', () => {

test.beforeEach('Visit entity details page', async ({ page }) => {
await redirectToHomePage(page);
await removeLandingBanner(page);
});

test('Verify MyData and Following widget', async ({ page }) => {
test.slow(true);
test('Verify my data widget', async ({ page }) => {
// Verify total count
await expect(
page.locator('[data-testid="my-data-total-count"]')
).toContainText('(20)');

await test.step(
'Set user as the Owner of the Table and also Follow it',
async () => {
for (const table of TableEntities) {
await table.visitEntityPage(page);
await addMultiOwner({
page,
ownerNames: [user.getUserName()],
activatorBtnDataTestId: 'edit-owner',
resultTestId: 'data-assets-header',
endpoint: table.endpoint,
type: 'Users',
});
await followEntity(page, table.endpoint);
}
}
);

await test.step('Verify my data widget', async () => {
await redirectToHomePage(page);
// Verify total count
const totalCount = await page
.locator('[data-testid="my-data-total-count"]')
.innerText();

expect(totalCount).toBe('(20)');

await page
.locator('[data-testid="my-data-widget"] [data-testid="view-all-link"]')
.click();
await page
.locator('[data-testid="my-data-widget"] [data-testid="view-all-link"]')
.click();

// Verify entities
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();
// Verify entities
await verifyEntities(
page,
'/api/v1/search/query?q=*&index=all&from=0&size=25',
TableEntities
);
});

expect(totalCount).toBe('(20)');
test('Verify following widget', async ({ page }) => {
// Verify total count
await expect(
page.locator('[data-testid="following-data-total-count"]')
).toContainText('(20)');

await page.locator('[data-testid="following-data"]').click();
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
);
});
// Verify entities
await verifyEntities(
page,
'/api/v1/search/query?q=*followers:*&index=all&from=0&size=25',
TableEntities
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ const permanentDeleteModal = async (page: Page, entity: string) => {
await page.click('[data-testid="confirm-button"]');
};

test.describe.configure({ mode: 'serial' });

// use the admin user to login
test.use({ storageState: 'playwright/.auth/admin.json' });

Expand All @@ -77,6 +75,8 @@ test.beforeEach(async ({ page }) => {
});

test('Classification Page', async ({ page }) => {
test.slow();

await test.step('Should render basic elements on page', async () => {
const getTags = page.waitForResponse('/api/v1/tags*');
await sidebarClick(page, SidebarItem.TAGS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ test.beforeEach(async ({ page }) => {
});

test('Logical TestSuite', async ({ page }) => {
test.slow();

const NEW_TEST_SUITE = {
name: `mysql_matrix-${uuid()}`,
description: 'mysql critical matrix',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
const serviceResponse = await apiContext.delete(
`/api/v1/services/databaseServices/name/${encodeURIComponent(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ export const redirectToHomePage = async (page: Page) => {
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) => {
// create a new page
const page = await browser.newPage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ export const verifyEntities = async (
tables: TableClass[]
) => {
// Change pagination size to 25
const fetchResponse = page.waitForResponse(url);
await page.locator('[data-testid="pagination"] .ant-btn-default').click();
const fetchResponse = page.waitForResponse(url);
await page.locator('[role="menu"] [value="25"]').click();
await fetchResponse;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ const TestSuitePipelineTab = ({ testSuite }: Props) => {
pipelineIdToFetchStatus={pipelineIdToFetchStatus}
serviceCategory={ServiceCategory.DATABASE_SERVICES}
serviceName={getServiceFromTestSuiteFQN(testSuiteFQN)}
tableClassName="test-suite-pipeline-tab"
triggerIngestion={handleTriggerIngestion}
onIngestionWorkflowsUpdate={getAllIngestionWorkflows}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,5 @@ export interface IngestionListTableProps {
text: string,
record: IngestionPipeline
) => ReactNode;
tableClassName?: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ function IngestionListTable({
showDescriptionCol,
triggerIngestion,
customRenderNameField,
tableClassName,
}: Readonly<IngestionListTableProps>) {
const { t } = useTranslation();
const { theme } = useApplicationStore();
Expand Down Expand Up @@ -333,6 +334,7 @@ function IngestionListTable({
<Col span={24}>
<Table
bordered
className={tableClassName}
columns={tableColumn}
data-testid="ingestion-list-table"
dataSource={ingestionData}
Expand Down
3 changes: 2 additions & 1 deletion openmetadata-ui/src/main/resources/ui/src/styles/app.less
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,8 @@ a[href].link-text-grey,
// Right side padding 20 + 64 width of sidebar
margin-right: 84px;
}
.test-case-table-container {
.test-case-table-container,
.test-suite-pipeline-tab {
margin-right: 64px;
}

Expand Down
Loading