Skip to content
Merged
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
51 changes: 47 additions & 4 deletions e2e-playwright/src/steps/KafkaConnect.steps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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) {
Expand All @@ -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) {
Expand Down
Loading