chore: fix flaky Entity playwright tests (#21162)

* chore: fix flaky Entity playwright tests

* refactor: remove extra await statements
This commit is contained in:
Pranita Fulsundar 2025-05-14 16:02:48 +05:30 committed by Pranita
parent 6ad8508166
commit 48ac501177
2 changed files with 8 additions and 1 deletions

View File

@ -58,6 +58,7 @@ export const getAuthContext = async (token: string) => {
export const redirectToHomePage = async (page: Page) => { export const redirectToHomePage = async (page: Page) => {
await page.goto('/'); await page.goto('/');
await page.waitForLoadState('networkidle');
await page.waitForURL('**/my-data'); await page.waitForURL('**/my-data');
}; };
@ -120,6 +121,10 @@ export const toastNotification = async (
message: string | RegExp, message: string | RegExp,
timeout?: number timeout?: number
) => { ) => {
await page.waitForSelector('[data-testid="alert-bar"]', {
state: 'visible',
});
await expect(page.getByTestId('alert-bar')).toHaveText(message, { timeout }); await expect(page.getByTestId('alert-bar')).toHaveText(message, { timeout });
await expect(page.getByTestId('alert-icon')).toBeVisible(); await expect(page.getByTestId('alert-icon')).toBeVisible();

View File

@ -41,6 +41,7 @@ export const visitEntityPage = async (data: {
const waitForSearchResponse = page.waitForResponse( const waitForSearchResponse = page.waitForResponse(
'/api/v1/search/query?q=*index=dataAsset*' '/api/v1/search/query?q=*index=dataAsset*'
); );
await page.waitForLoadState('networkidle');
await page.getByTestId('searchBox').fill(searchTerm); await page.getByTestId('searchBox').fill(searchTerm);
await waitForSearchResponse; await waitForSearchResponse;
await page.getByTestId(dataTestId).getByTestId('data-name').click(); await page.getByTestId(dataTestId).getByTestId('data-name').click();
@ -1301,7 +1302,8 @@ export const hardDeleteEntity = async (
endPoint: EntityTypeEndpoint endPoint: EntityTypeEndpoint
) => { ) => {
await page.click('[data-testid="manage-button"]'); await page.click('[data-testid="manage-button"]');
await page.getByTestId('delete-button').click(); await page.waitForSelector('[data-testid="delete-button"]');
await page.click('[data-testid="delete-button"]');
await page.waitForSelector('[role="dialog"].ant-modal'); await page.waitForSelector('[role="dialog"].ant-modal');