Skip to content

Commit

Permalink
playwright: reset the profiler bot token in AUT (#19156)
Browse files Browse the repository at this point in the history
* playwright: reset the profiler bot token in AUT

* addressing comment
  • Loading branch information
ShaileshParmar11 authored Dec 20, 2024
1 parent 06d71f9 commit f87b066
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +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 {
createNewPage,
descriptionBox,
Expand Down Expand Up @@ -47,6 +48,9 @@ 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);

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

// Todo: Remove this patch once the issue is fixed #19140
await resetTokenFromProfilerBotPage(page);

await visitServiceDetailsPage(
page,
{
Expand Down
30 changes: 30 additions & 0 deletions openmetadata-ui/src/main/resources/ui/playwright/utils/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,3 +221,33 @@ export const redirectToBotPage = async (page: Page) => {
await settingClick(page, GlobalSettingOptions.BOTS);
await fetchResponse;
};

export const resetTokenFromProfilerBotPage = async (page: Page) => {
await settingClick(page, GlobalSettingOptions.BOTS);

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

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

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

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

await page.getByTestId('revoke-button').click();

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

await page.getByTestId('save-button').click();

await expect(page.getByTestId('token-expiry').locator('div')).toBeVisible();

await page.getByText('hr').click();
await page.getByText('Unlimited days').click();

await expect(page.getByTestId('save-edit')).toBeVisible();

await page.getByTestId('save-edit').click();

await redirectToHomePage(page);
};

0 comments on commit f87b066

Please sign in to comment.