fix myData and ActivityFeed playwright test 1.5.5 (#17886)

(cherry picked from commit a679625f7b4f7e7a3d6714356fdd16c7fbce9c12)
This commit is contained in:
Ashish Gupta 2024-09-18 17:09:11 +05:30
parent d38f49b034
commit 14ef913943
2 changed files with 20 additions and 10 deletions

View File

@ -159,7 +159,9 @@ test.describe('Activity feed', () => {
await page.getByText('Accept Suggestion').click(); await page.getByText('Accept Suggestion').click();
const waitForCountFetch = page.waitForResponse('/api/v1/feed/count?**');
await toastNotification(page, /Task resolved successfully/); await toastNotification(page, /Task resolved successfully/);
await waitForCountFetch;
await checkTaskCount(page, 0, 2); await checkTaskCount(page, 0, 2);
}); });
@ -316,7 +318,9 @@ test.describe('Activity feed', () => {
await page.getByText('Accept Suggestion').click(); await page.getByText('Accept Suggestion').click();
const waitForCountFetch = page.waitForResponse('/api/v1/feed/count?**');
await toastNotification(page, /Task resolved successfully/); await toastNotification(page, /Task resolved successfully/);
await waitForCountFetch;
await checkTaskCount(page, 0, 2); await checkTaskCount(page, 0, 2);
}); });
@ -378,7 +382,9 @@ test.describe('Activity feed', () => {
await page.getByRole('menuitem', { name: 'close' }).click(); await page.getByRole('menuitem', { name: 'close' }).click();
await commentWithCloseTask; await commentWithCloseTask;
const waitForCountFetch = page.waitForResponse('/api/v1/feed/count?**');
await toastNotification(page, 'Task closed successfully.'); await toastNotification(page, 'Task closed successfully.');
await waitForCountFetch;
await checkTaskCount(page, 0, 1); await checkTaskCount(page, 0, 1);
}); });
@ -410,9 +416,11 @@ test.describe('Activity feed', () => {
await page.getByTestId('request-entity-tags').click(); await page.getByTestId('request-entity-tags').click();
// create tag task // create tag task
const waitForCountFetch = page.waitForResponse('/api/v1/feed/count?**');
const openTaskAfterTagResponse = page.waitForResponse(TASK_OPEN_FETCH_LINK); const openTaskAfterTagResponse = page.waitForResponse(TASK_OPEN_FETCH_LINK);
await createTagTask(page, { ...value, tag: 'PII.None' }); await createTagTask(page, { ...value, tag: 'PII.None' });
await openTaskAfterTagResponse; await openTaskAfterTagResponse;
await waitForCountFetch;
// open task count after description // open task count after description
await checkTaskCount(page, 2, 0); await checkTaskCount(page, 2, 0);
@ -432,11 +440,9 @@ test.describe('Activity feed', () => {
await page.getByRole('menuitem', { name: 'close' }).click(); await page.getByRole('menuitem', { name: 'close' }).click();
await commentWithCloseTask; await commentWithCloseTask;
const waitForCountFetch = page.waitForResponse('/api/v1/feed/count?*'); const waitForCountFetch2 = page.waitForResponse('/api/v1/feed/count?**');
await toastNotification(page, 'Task closed successfully.'); await toastNotification(page, 'Task closed successfully.');
await waitForCountFetch2;
await waitForCountFetch;
// open task count after closing one task // open task count after closing one task
await checkTaskCount(page, 1, 1); await checkTaskCount(page, 1, 1);
@ -660,7 +666,9 @@ base.describe('Activity feed with Data Consumer User', () => {
await page2.getByText('Accept Suggestion').click(); await page2.getByText('Accept Suggestion').click();
const waitForCountFetch = page2.waitForResponse('/api/v1/feed/count?**');
await toastNotification(page2, /Task resolved successfully/); await toastNotification(page2, /Task resolved successfully/);
await waitForCountFetch;
// TODO: Ashish - Enable them once issue is resolved from Backend https://github.com/open-metadata/OpenMetadata/issues/17059 // TODO: Ashish - Enable them once issue is resolved from Backend https://github.com/open-metadata/OpenMetadata/issues/17059
// const openTask = await page2.getByTestId('open-task').textContent(); // const openTask = await page2.getByTestId('open-task').textContent();

View File

@ -31,11 +31,11 @@ const test = base.extend<{ page: Page }>({
}, },
}); });
test.describe('My Data page', () => { test.describe.serial('My Data page', () => {
test.beforeAll('Setup pre-requests', async ({ browser }) => { test.beforeAll('Setup pre-requests', async ({ browser }) => {
const { apiContext, afterAction } = await performAdminLogin(browser); const { apiContext, afterAction } = await performAdminLogin(browser);
await user.create(apiContext); await user.create(apiContext);
for (const table of TableEntities) { const tablePromises = TableEntities.map(async (table) => {
await table.create(apiContext); await table.create(apiContext);
await table.patch({ await table.patch({
apiContext, apiContext,
@ -56,16 +56,18 @@ test.describe('My Data page', () => {
], ],
}); });
await table.followTable(apiContext, user.responseData.id); await table.followTable(apiContext, user.responseData.id);
} });
await Promise.all(tablePromises);
await afterAction(); await afterAction();
}); });
test.afterAll('Cleanup', async ({ browser }) => { test.afterAll('Cleanup', async ({ browser }) => {
const { apiContext, afterAction } = await performAdminLogin(browser); const { apiContext, afterAction } = await performAdminLogin(browser);
await user.delete(apiContext); await user.delete(apiContext);
for (const table of TableEntities) {
await table.delete(apiContext); await Promise.all(TableEntities.map((table) => table.delete(apiContext)));
}
await afterAction(); await afterAction();
}); });