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

playwright: reset the profiler bot token in AUT #19156

Merged
merged 2 commits into from
Dec 20, 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 @@ -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);
};
Loading