playwright: reset the profiler bot token in AUT (#19156)

* playwright: reset the profiler bot token in AUT

* addressing comment
This commit is contained in:
Shailesh Parmar 2024-12-20 20:19:11 +05:30 committed by GitHub
parent 06d71f9450
commit f87b0662fa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 39 additions and 0 deletions

View File

@ -15,6 +15,7 @@ import { PLAYWRIGHT_INGESTION_TAG_OBJ } from '../../constant/config';
import { SidebarItem } from '../../constant/sidebar'; import { SidebarItem } from '../../constant/sidebar';
import { TableClass } from '../../support/entity/TableClass'; import { TableClass } from '../../support/entity/TableClass';
import { UserClass } from '../../support/user/UserClass'; import { UserClass } from '../../support/user/UserClass';
import { resetTokenFromProfilerBotPage } from '../../utils/bot';
import { import {
createNewPage, createNewPage,
descriptionBox, descriptionBox,
@ -47,6 +48,9 @@ test.describe('Incident Manager', PLAYWRIGHT_INGESTION_TAG_OBJ, () => {
const { afterAction, apiContext, page } = await createNewPage(browser); 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) { for (const user of users) {
await user.create(apiContext); await user.create(apiContext);
} }

View File

@ -18,6 +18,7 @@ import {
TestType, TestType,
} from '@playwright/test'; } from '@playwright/test';
import { env } from 'process'; import { env } from 'process';
import { resetTokenFromProfilerBotPage } from '../../../utils/bot';
import { import {
getApiContext, getApiContext,
redirectToHomePage, redirectToHomePage,
@ -84,6 +85,10 @@ class MysqlIngestionClass extends ServiceBaseClass {
await test.step('Add Profiler ingestion', async () => { await test.step('Add Profiler ingestion', async () => {
const { apiContext } = await getApiContext(page); const { apiContext } = await getApiContext(page);
await redirectToHomePage(page); await redirectToHomePage(page);
// Todo: Remove this patch once the issue is fixed #19140
await resetTokenFromProfilerBotPage(page);
await visitServiceDetailsPage( await visitServiceDetailsPage(
page, page,
{ {

View File

@ -221,3 +221,33 @@ export const redirectToBotPage = async (page: Page) => {
await settingClick(page, GlobalSettingOptions.BOTS); await settingClick(page, GlobalSettingOptions.BOTS);
await fetchResponse; 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);
};