Skip to content

Commit

Permalink
playwright: fixed failing incident manager test (#19367)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaileshParmar11 authored Jan 15, 2025
1 parent b85883b commit 7d30995
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { PLAYWRIGHT_INGESTION_TAG_OBJ } from '../../constant/config';
import { SidebarItem } from '../../constant/sidebar';
import { TableClass } from '../../support/entity/TableClass';
import { UserClass } from '../../support/user/UserClass';
import { resetTokenFromProfilerBotPage } from '../../utils/bot';
import { resetTokenFromBotPage } from '../../utils/bot';
import {
createNewPage,
descriptionBox,
Expand Down Expand Up @@ -49,7 +49,10 @@ test.describe('Incident Manager', PLAYWRIGHT_INGESTION_TAG_OBJ, () => {
const { afterAction, apiContext, page } = await createNewPage(browser);

// Todo: Remove this patch once the issue is fixed #19140
await resetTokenFromProfilerBotPage(page);
await resetTokenFromBotPage(page, {
name: 'testsuite',
testId: 'bot-link-TestSuiteBot',
});

for (const user of users) {
await user.create(apiContext);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
TestType,
} from '@playwright/test';
import { env } from 'process';
import { resetTokenFromProfilerBotPage } from '../../../utils/bot';
import { resetTokenFromBotPage } from '../../../utils/bot';
import {
getApiContext,
redirectToHomePage,
Expand Down Expand Up @@ -87,7 +87,10 @@ class MysqlIngestionClass extends ServiceBaseClass {
await redirectToHomePage(page);

// Todo: Remove this patch once the issue is fixed #19140
await resetTokenFromProfilerBotPage(page);
await resetTokenFromBotPage(page, {
name: 'profiler',
testId: 'bot-link-ProfilerBot',
});

await visitServiceDetailsPage(
page,
Expand Down
14 changes: 10 additions & 4 deletions openmetadata-ui/src/main/resources/ui/playwright/utils/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,15 +222,21 @@ export const redirectToBotPage = async (page: Page) => {
await fetchResponse;
};

export const resetTokenFromProfilerBotPage = async (page: Page) => {
export const resetTokenFromBotPage = async (
page: Page,
bot: {
name: string;
testId: string;
}
) => {
await settingClick(page, GlobalSettingOptions.BOTS);

await page.getByTestId('searchbar').click();
await page.getByTestId('searchbar').fill('profiler');
await page.getByTestId('searchbar').fill(bot.name);

await expect(page.getByTestId('bot-link-ProfilerBot')).toBeVisible();
await expect(page.getByTestId(bot.testId)).toBeVisible();

await page.getByTestId('bot-link-ProfilerBot').click();
await page.getByTestId(bot.testId).click();

await expect(page.getByTestId('revoke-button')).toBeVisible();

Expand Down

0 comments on commit 7d30995

Please sign in to comment.