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

AUT : fix activity feed and teamHierarchy playwright failure #17991

Merged
merged 2 commits into from
Sep 25, 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 @@ -209,9 +209,9 @@ test.describe('Activity feed', () => {

await page.getByText('Accept Suggestion').click();

const waitForCountFetch = page.waitForResponse('/api/v1/feed/count?**');
await toastNotification(page, /Task resolved successfully/);
await waitForCountFetch;

await page.waitForLoadState('networkidle');

await checkTaskCount(page, 0, 2);
});
Expand Down Expand Up @@ -370,9 +370,9 @@ test.describe('Activity feed', () => {

await page.getByText('Accept Suggestion').click();

const waitForCountFetch = page.waitForResponse('/api/v1/feed/count?**');
await toastNotification(page, /Task resolved successfully/);
await waitForCountFetch;

await page.waitForLoadState('networkidle');

await checkTaskCount(page, 0, 2);
});
Expand Down Expand Up @@ -432,9 +432,9 @@ test.describe('Activity feed', () => {
await page.getByRole('menuitem', { name: 'close' }).click();
await commentWithCloseTask;

const waitForCountFetch = page.waitForResponse('/api/v1/feed/count?**');
await toastNotification(page, 'Task closed successfully.');
await waitForCountFetch;

await page.waitForLoadState('networkidle');

await checkTaskCount(page, 0, 1);
});
Expand All @@ -451,12 +451,12 @@ test.describe('Activity feed', () => {
await page.getByTestId('request-description').click();

// create description task
const waitForCountFetch1 = page.waitForResponse('/api/v1/feed/count?**');
const openTaskAfterDescriptionResponse =
page.waitForResponse(TASK_OPEN_FETCH_LINK);
await createDescriptionTask(page, value);
await openTaskAfterDescriptionResponse;
await waitForCountFetch1;

await page.waitForLoadState('networkidle');

// open task count after description
const openTask1 = await page.getByTestId('open-task').textContent();
Expand All @@ -468,11 +468,11 @@ test.describe('Activity feed', () => {
await page.getByTestId('request-entity-tags').click();

// create tag task
const waitForCountFetch2 = page.waitForResponse('/api/v1/feed/count?**');
const openTaskAfterTagResponse = page.waitForResponse(TASK_OPEN_FETCH_LINK);
await createTagTask(page, { ...value, tag: 'PII.None' });
await openTaskAfterTagResponse;
await waitForCountFetch2;

await page.waitForLoadState('networkidle');

// open task count after description
await checkTaskCount(page, 2, 0);
Expand All @@ -492,10 +492,8 @@ test.describe('Activity feed', () => {
await page.getByRole('menuitem', { name: 'close' }).click();
await commentWithCloseTask;

const waitForCountFetch3 = page.waitForResponse('/api/v1/feed/count?**');
await toastNotification(page, 'Task closed successfully.');
await waitForCountFetch3;

await page.waitForLoadState('networkidle');
// open task count after closing one task
await checkTaskCount(page, 1, 1);

Expand Down Expand Up @@ -537,51 +535,58 @@ test.describe('Activity feed', () => {
});

test('Mention should work for the feed reply', async ({ page }) => {
await addMentionCommentInFeed(page, adminUser.responseData.name);
await test.step('Add Mention in Feed', async () => {
await addMentionCommentInFeed(page, adminUser.responseData.name);

// Close drawer
await page.locator('[data-testid="closeDrawer"]').click();
// Close drawer
await page.locator('[data-testid="closeDrawer"]').click();

// Get the feed text
const feedText = await page
.locator(`${FIRST_FEED_SELECTOR} [data-testid="headerText"]`)
.innerText();
// Get the feed text
const feedText = await page
.locator(`${FIRST_FEED_SELECTOR} [data-testid="headerText"]`)
.innerText();

// Click on @Mentions tab
const fetchMentionsFeedResponse = page.waitForResponse(
'/api/v1/feed?filterType=MENTIONS&userId=*'
);
await page
.locator('[data-testid="activity-feed-widget"]')
.locator('text=@Mentions')
.click();
// Click on @Mentions tab
const fetchMentionsFeedResponse = page.waitForResponse(
'/api/v1/feed?filterType=MENTIONS&userId=*'
);
await page
.locator('[data-testid="activity-feed-widget"]')
.locator('text=@Mentions')
.click();

await fetchMentionsFeedResponse;
await fetchMentionsFeedResponse;

const mentionedText = await page
.locator(`${FIRST_FEED_SELECTOR} [data-testid="headerText"]`)
.innerText();
const mentionedText = await page
.locator(`${FIRST_FEED_SELECTOR} [data-testid="headerText"]`)
.innerText();

expect(mentionedText).toContain(feedText);
});
expect(mentionedText).toContain(feedText);
});

test('Mention should work for the feed reply in case of users having dot in their name', async ({
page,
}) => {
await addMentionCommentInFeed(page, 'aaron.warren5');
await test.step(
'Add Mention should work if users having dot in their name',
async () => {
await addMentionCommentInFeed(page, 'aaron.warren5', true);

await expect(
page.locator(
`#feed-panel [data-testid="message-container"] [data-testid="feed-replies"] [data-testid="viewer-container"] [data-testid="markdown-parser"]`
)
).toContainText('Can you resolve this thread for me? @aaron.warren5');
const lastFeedContainer = `#feed-panel [data-testid="message-container"] [data-testid="feed-replies"] .feed-card-v2-container:last-child`;

// Close drawer
await page.locator('[data-testid="closeDrawer"]').click();
await expect(
page
.locator(lastFeedContainer)
.locator(
'[data-testid="viewer-container"] [data-testid="markdown-parser"]'
)
).toContainText('Can you resolve this thread for me? @aaron.warren5');

// Close drawer
await page.locator('[data-testid="closeDrawer"]').click();

expect(
page.locator(`${FIRST_FEED_SELECTOR} [data-testid="reply-count"]`)
).toContainText('1 Reply');
expect(
page.locator(`${FIRST_FEED_SELECTOR} [data-testid="reply-count"]`)
).toContainText('2 Replies');
}
);
});
});

Expand Down Expand Up @@ -744,9 +749,9 @@ base.describe('Activity feed with Data Consumer User', () => {

await page2.getByText('Accept Suggestion').click();

const waitForCountFetch = page2.waitForResponse('/api/v1/feed/count?**');
await toastNotification(page2, /Task resolved successfully/);
await waitForCountFetch;

await page2.waitForLoadState('networkidle');

// 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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,15 @@ test.describe('Add Nested Teams and Test TeamsSelectable', () => {
await settingClick(page, GlobalSettingOptions.USERS);

// Click on add user button
const teamHierarchyResponse = page.waitForResponse(
'/api/v1/teams/hierarchy?isJoinable=false'
);
await page.locator('[data-testid="add-user"]').click();
await teamHierarchyResponse;

// Enter team name
const teamSelect = page.locator(
'[data-testid="team-select"] .ant-select-selector'
);
await teamSelect.click();
await teamSelect.type(businessTeamName);
await page.click('[data-testid="team-select"]');
await page.keyboard.type(businessTeamName);

for (const teamName of teamNames) {
const dropdown = page.locator('.ant-tree-select-dropdown');
Expand All @@ -93,10 +94,10 @@ test.describe('Add Nested Teams and Test TeamsSelectable', () => {
}

for (const teamName of teamNames) {
await expect(teamSelect).toBeVisible();
await expect(page.getByTestId('team-select')).toBeVisible();

await teamSelect.click();
await teamSelect.type(teamName);
await page.click('[data-testid="team-select"]');
await page.keyboard.type(teamName);

await expect(page.locator('.ant-tree-select-dropdown')).toContainText(
teamName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,20 +102,33 @@ export const reactOnFeed = async (page: Page) => {
}
};

export const addMentionCommentInFeed = async (page: Page, user: string) => {
const fetchFeedResponse = page.waitForResponse(
'/api/v1/feed?type=Conversation*'
);
await removeLandingBanner(page);
await fetchFeedResponse;
export const addMentionCommentInFeed = async (
page: Page,
user: string,
isReply = false
) => {
if (!isReply) {
const fetchFeedResponse = page.waitForResponse(
'/api/v1/feed?type=Conversation*'
);
await removeLandingBanner(page);
await fetchFeedResponse;
}

// Click on add reply
const feedResponse = page.waitForResponse('/api/v1/feed/*');
await page
.locator(FIRST_FEED_SELECTOR)
.locator('[data-testid="thread-count"]')
.click();

if (isReply) {
await page
.locator(FIRST_FEED_SELECTOR)
.locator('[data-testid="reply-count"]')
.click();
} else {
await page
.locator(FIRST_FEED_SELECTOR)
.locator('[data-testid="thread-count"]')
.click();
}
Comment on lines +121 to +131
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (isReply) {
await page
.locator(FIRST_FEED_SELECTOR)
.locator('[data-testid="reply-count"]')
.click();
} else {
await page
.locator(FIRST_FEED_SELECTOR)
.locator('[data-testid="thread-count"]')
.click();
}
await page
.locator(FIRST_FEED_SELECTOR)
.locator(`[data-testid=${isReply ? "reply-count" : "thread-count"}]`)
.click();

await feedResponse;

await page.waitForSelector('.ant-drawer-content', {
Expand Down
Loading