From 381b06f3b44a5df1099b2ede1a211eb60417faeb Mon Sep 17 00:00:00 2001 From: AspidDark Date: Mon, 13 Oct 2025 17:07:20 +0300 Subject: [PATCH] flacky try --- .../src/steps/KafkaConnect.steps.ts | 51 +++++++++++++++++-- 1 file changed, 47 insertions(+), 4 deletions(-) diff --git a/e2e-playwright/src/steps/KafkaConnect.steps.ts b/e2e-playwright/src/steps/KafkaConnect.steps.ts index 50a3cc3d4..05597839a 100644 --- a/e2e-playwright/src/steps/KafkaConnect.steps.ts +++ b/e2e-playwright/src/steps/KafkaConnect.steps.ts @@ -2,6 +2,7 @@ import { Given, When, Then, setDefaultTimeout } from "@cucumber/cucumber"; import { expectVisibility } from "../services/uiHelper"; import { PlaywrightWorld } from "../support/PlaywrightWorld"; +import { expect } from "@playwright/test"; setDefaultTimeout(60 * 1000 * 2); @@ -25,8 +26,29 @@ Given('KafkaConnect satus is: {string}, type is: {string}', async function(this: }); Given('KafkaConnect row menu menu item {string} is clicked', async function(this: PlaywrightWorld, menuItem: string) { - await this.locators.connectors.rowMenu.click(); - await this.locators.connectors.rowMenuItem(menuItem).click(); + const { page } = this; + const rowMenu = this.locators.connectors.rowMenu; + const rowMenuItem = this.locators.connectors.rowMenuItem(menuItem); + + async function attemptClick() { + await expect(rowMenu).toBeVisible({ timeout: 5000 }); + await expect(rowMenu).toBeEnabled({ timeout: 5000 }); + await rowMenu.scrollIntoViewIfNeeded(); + + await rowMenu.click(); + + await expect(rowMenuItem).toBeVisible({ timeout: 5000 }); + await rowMenuItem.click(); + } + + try { + await attemptClick(); + } catch (firstErr) { + await page.reload({ waitUntil: 'domcontentloaded' }); + await page.waitForLoadState('networkidle', { timeout: 10000 }).catch(() => {}); + + await attemptClick(); + } }); When('KafkaConnect connector named: {string} clicked', async function(this: PlaywrightWorld, name: string) { @@ -42,8 +64,29 @@ Given('KafkaConnect connector page status is: {string}', async function(this: Pl }); When('KafkaConnect connector menu item {string} clicked', async function(this: PlaywrightWorld, menuItem: string) { - await this.locators.connectors.internalMenuButton.click(); - await this.locators.connectors.internalMenuButtonItem(menuItem).click(); + const { page } = this; + const menuButton = this.locators.connectors.internalMenuButton; + const menuItemLocator = this.locators.connectors.internalMenuButtonItem(menuItem); + + async function attemptClick() { + await expect(menuButton).toBeVisible({ timeout: 5000 }); + await expect(menuButton).toBeEnabled({ timeout: 5000 }); + + await menuButton.click(); + + await expect(menuItemLocator).toBeVisible({ timeout: 5000 }); + await menuItemLocator.click(); + } + + try { + await attemptClick(); + } catch (firstErr) { + await page.reload({ waitUntil: 'domcontentloaded' }); + + await page.waitForLoadState('networkidle', { timeout: 10000 }).catch(() => {}); + + await attemptClick(); + } }); Given('KafkaConnect connector page state is: {string}', async function(this: PlaywrightWorld, state: string) {