Fix: Observablity alert flaky test (#21107)

* fixed observity alert flaky test

* fixed timeout issue

* fixed timeout issue

* fixed comments

(cherry picked from commit 3d2ae8fff6be077a32b56ccc7caf5503bfa7afa7)
This commit is contained in:
Dhruv Parmar 2025-05-19 11:29:12 +05:30 committed by Ashish Gupta
parent 9b8dca394b
commit ebe397d041
4 changed files with 18 additions and 2 deletions

View File

@ -101,6 +101,8 @@ const data = {
};
test.beforeAll(async ({ browser }) => {
test.slow();
const { afterAction, apiContext } = await performAdminLogin(browser);
await commonPrerequisites({
apiContext,
@ -115,6 +117,8 @@ test.beforeAll(async ({ browser }) => {
});
test.afterAll('Cleanup', async ({ browser }) => {
test.slow();
const { afterAction, apiContext } = await performAdminLogin(browser);
await commonCleanup({
apiContext,

View File

@ -99,6 +99,8 @@ const data = {
};
test.beforeAll(async ({ browser }) => {
test.slow();
const { afterAction, apiContext } = await performAdminLogin(browser);
await commonPrerequisites({
apiContext,
@ -135,6 +137,8 @@ test.afterAll(async ({ browser }) => {
});
test.beforeEach(async ({ page }) => {
test.slow();
await visitObservabilityAlertPage(page);
});

View File

@ -158,6 +158,10 @@ export const findPageWithAlert = async (
alertDetails: AlertDetails
) => {
const { id } = alertDetails;
await page.waitForLoadState('networkidle');
await page.waitForSelector('[data-testid="loader"]', {
state: 'detached',
});
const alertRow = page.locator(`[data-row-key="${id}"]`);
const nextButton = page.locator('[data-testid="next"]');
if ((await alertRow.isHidden()) && (await nextButton.isEnabled())) {
@ -829,8 +833,8 @@ export const waitForRecentEventsToFinishExecution = async (
{
// Custom expect message for reporting, optional.
message: 'Wait for pending events to complete',
intervals: [5_000, 10_000, 15_000],
timeout: 600_000,
intervals: [5_000, 10_000, 15_000, 20_000],
timeout: 900_000,
}
)
// Move ahead when the pending events count is 0

View File

@ -41,6 +41,10 @@ import { sidebarClick } from './sidebar';
export const visitObservabilityAlertPage = async (page: Page) => {
await redirectToHomePage(page);
await page.waitForLoadState('networkidle');
await page.waitForSelector('[data-testid="loader"]', {
state: 'detached',
});
const getAlerts = page.waitForResponse(
'/api/v1/events/subscriptions?*alertType=Observability*'
);