PLAYWRIGHT: fix activity feed and Entity spec playwright failure (#17237)

* fix activity feed playwright failure

* fix entity owner spec failing
This commit is contained in:
Ashish Gupta 2024-07-31 15:24:17 +05:30 committed by GitHub
parent fd2b4ec4ac
commit 62c51e284d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 29 additions and 11 deletions

View File

@ -174,7 +174,7 @@ test.describe('Activity feed', () => {
`Reply message ${i}`
);
const sendReply = page.waitForResponse('/api/v1/feed/*/posts');
await page.getByTestId('send-button').click();
await page.getByTestId('send-button').click({ force: true });
await sendReply;
}
@ -321,7 +321,7 @@ test.describe('Activity feed', () => {
'Test comment added'
);
const addComment = page.waitForResponse('/api/v1/feed/*/posts');
await page.getByTestId('comment-button').click();
await page.getByTestId('comment-button').click({ force: true });
await addComment;
// Close the task from the Button.Group, should throw error when no comment is added.

View File

@ -123,14 +123,14 @@ export const clickOutside = async (page: Page) => {
};
export const visitUserProfilePage = async (page: Page) => {
await page.getByTestId('dropdown-profile').click();
await page.locator('[data-testid="dropdown-profile"] svg').click();
await page.waitForSelector('[role="menu"].profile-dropdown', {
state: 'visible',
});
const userResponse = page.waitForResponse(
'/api/v1/users/name/*?fields=*&include=all'
);
await page.getByTestId('user-name').click({ force: true });
await page.getByTestId('user-name').click();
await userResponse;
await clickOutside(page);
};

View File

@ -72,9 +72,18 @@ export const addOwner = async (
await page.waitForResponse(
`/api/v1/search/query?q=*${encodeURIComponent(owner)}*`
);
const patchRequest = page.waitForResponse(`/api/v1/${endpoint}/*`);
await page.getByRole('listitem', { name: owner }).click();
await patchRequest;
if (type === 'Teams') {
const patchRequest = page.waitForResponse(`/api/v1/${endpoint}/*`);
await page.getByRole('listitem', { name: owner, exact: true }).click();
await patchRequest;
} else {
await page.getByRole('listitem', { name: owner, exact: true }).click();
const patchRequest = page.waitForResponse(`/api/v1/${endpoint}/*`);
await page.getByTestId('selectable-list-update-btn').click();
await patchRequest;
}
await expect(page.getByTestId(dataTestId ?? 'owner-link')).toContainText(
owner
@ -98,9 +107,17 @@ export const updateOwner = async (
`/api/v1/search/query?q=*${encodeURIComponent(owner)}*`
);
const patchRequest = page.waitForResponse(`/api/v1/${endpoint}/*`);
await page.getByRole('listitem', { name: owner }).click();
await patchRequest;
if (type === 'Teams') {
const patchRequest = page.waitForResponse(`/api/v1/${endpoint}/*`);
await page.getByRole('listitem', { name: owner, exact: true }).click();
await patchRequest;
} else {
await page.getByRole('listitem', { name: owner, exact: true }).click();
const patchRequest = page.waitForResponse(`/api/v1/${endpoint}/*`);
await page.getByTestId('selectable-list-update-btn').click();
await patchRequest;
}
await expect(page.getByTestId(dataTestId ?? 'owner-link')).toContainText(
owner
@ -175,7 +192,8 @@ export const addMultiOwner = async (data: {
await page.fill('[data-testid="owner-select-users-search-bar"]', ownerName);
await searchOwner;
await page.waitForSelector('[data-testid="loader"]', { state: 'detached' });
await page.getByRole('listitem', { name: ownerName }).click();
await page.getByRole('listitem', { name: ownerName, exact: true }).click();
}
if (isMultipleOwners) {