From e7cadb64270f28f1aa7d173a1ad662ce3828a217 Mon Sep 17 00:00:00 2001 From: AspidDark Date: Tue, 20 May 2025 22:56:14 +0300 Subject: [PATCH 01/14] scenarioContext added --- e2e-playwright/src/hooks/hooks.ts | 52 ++++-------- e2e-playwright/src/hooks/locatorsFactory.ts | 63 +++++++++++++++ e2e-playwright/src/hooks/pageFixture.ts | 37 +-------- e2e-playwright/src/hooks/scenarioContext.ts | 23 ++++++ e2e-playwright/src/steps/Topics.steps.ts | 50 +++++------- .../src/steps/TopicsCreate.steps.ts | 73 ++++++++--------- e2e-playwright/src/steps/navigation.steps.ts | 80 +++++++++---------- 7 files changed, 190 insertions(+), 188 deletions(-) create mode 100644 e2e-playwright/src/hooks/locatorsFactory.ts create mode 100644 e2e-playwright/src/hooks/scenarioContext.ts diff --git a/e2e-playwright/src/hooks/hooks.ts b/e2e-playwright/src/hooks/hooks.ts index 3a4d9a2ff..bdefc8124 100644 --- a/e2e-playwright/src/hooks/hooks.ts +++ b/e2e-playwright/src/hooks/hooks.ts @@ -1,20 +1,13 @@ import '../helper/env/env'; import { BeforeAll, AfterAll, Before, After, Status, setDefaultTimeout } from "@cucumber/cucumber"; import { Browser, BrowserContext } from "@playwright/test"; -import { fixture } from "./pageFixture"; +import { stepsContext } from "./pageFixture"; import { invokeBrowser } from "../helper/browsers/browserManager"; import { createLogger } from "winston"; import { options } from "../helper/util/logger"; -import PanelLocators from "../pages/Panel/PanelLocators"; -import BrokersLocators from "../pages/Brokers/BrokersLocators"; -import TopicsLocators from "../pages/Topics/TopicsLocators"; -import ConsumersLocators from "../pages/Consumers/ConsumersLocators"; -import SchemaRegistryLocators from "../pages/SchemaRegistry/SchemaRegistryLocators"; -import ConnectorsLocators from "../pages/Connectors/ConnectorsLocators"; -import ksqlDbLocators from "../pages/KSQLDB/ksqldbLocators"; -import DashboardLocators from '../pages/Dashboard/DashboardLocators'; -import TopicCreateLocators from "../pages/Topics/TopicsCreateLocators"; import fs from 'fs'; +import { scenarioContext } from "./scenarioContext"; +import { locatorsFactory } from './locatorsFactory'; let browser: Browser; let context: BrowserContext; @@ -38,28 +31,11 @@ Before(async function ({ pickle }) { screenshots: true, snapshots: true }); const page = await context.newPage(); - - fixture.page = page; - - fixture.logger = createLogger(options(scenarioName)); - - fixture.navigationPanel = new PanelLocators(page); - - fixture.brokers = new BrokersLocators(page); - - fixture.topics = new TopicsLocators(page); - fixture.topicsCreate = new TopicCreateLocators(page); - - fixture.consumers = new ConsumersLocators(page); - - fixture.schemaRegistry = new SchemaRegistryLocators(page); - - fixture.connectors = new ConnectorsLocators(page); - - fixture.ksqlDb = new ksqlDbLocators(page); - - fixture.dashboard = new DashboardLocators(page); - + + stepsContext.page = page; + stepsContext.logger = createLogger(options(scenarioName)); + + Object.assign(scenarioContext, locatorsFactory.initAll(page)); }); After({ timeout: 30000 }, async function ({ pickle, result }) { @@ -68,15 +44,15 @@ After({ timeout: 30000 }, async function ({ pickle, result }) { try { if (result?.status === Status.FAILED) { - img = await fixture.page.screenshot({ + img = await stepsContext.page.screenshot({ path: `./test-results/screenshots/${pickle.name}.png`, type: "png" }); - const video = await fixture.page.video(); + const video = stepsContext.page.video(); if (video) { const videoPath = await video.path(); const videoFile = fs.readFileSync(videoPath); - await this.attach(videoFile, 'video/webm'); + this.attach(videoFile, 'video/webm'); } } } catch (e) { @@ -90,7 +66,7 @@ After({ timeout: 30000 }, async function ({ pickle, result }) { } try { - await fixture.page.close(); + await stepsContext.page.close(); } catch (e) { console.error("Error closing page:", e); } @@ -103,10 +79,10 @@ After({ timeout: 30000 }, async function ({ pickle, result }) { try { if (result?.status === Status.FAILED && img) { - await this.attach(img, "image/png"); + this.attach(img, "image/png"); const traceFileLink = `Open ${path}`; - await this.attach(`Trace file: ${traceFileLink}`, "text/html"); + this.attach(`Trace file: ${traceFileLink}`, "text/html"); } } catch (e) { console.error("Error attaching screenshot or trace:", e); diff --git a/e2e-playwright/src/hooks/locatorsFactory.ts b/e2e-playwright/src/hooks/locatorsFactory.ts new file mode 100644 index 000000000..80043dc54 --- /dev/null +++ b/e2e-playwright/src/hooks/locatorsFactory.ts @@ -0,0 +1,63 @@ +import { Page } from "@playwright/test"; + +import PanelLocators from "../pages/Panel/PanelLocators"; +import BrokersLocators from "../pages/Brokers/BrokersLocators"; +import TopicsLocators from "../pages/Topics/TopicsLocators"; +import TopicCreateLocators from "../pages/Topics/TopicsCreateLocators"; +import ConsumersLocators from "../pages/Consumers/ConsumersLocators"; +import SchemaRegistryLocators from "../pages/SchemaRegistry/SchemaRegistryLocators"; +import ConnectorsLocators from "../pages/Connectors/ConnectorsLocators"; +import ksqlDbLocators from "../pages/KSQLDB/ksqldbLocators"; +import DashboardLocators from "../pages/Dashboard/DashboardLocators"; + +export class locatorsFactory { + static panel(page: Page) { + return new PanelLocators(page); + } + + static brokers(page: Page) { + return new BrokersLocators(page); + } + + static topics(page: Page) { + return new TopicsLocators(page); + } + + static topicsCreate(page: Page) { + return new TopicCreateLocators(page); + } + + static consumers(page: Page) { + return new ConsumersLocators(page); + } + + static schemaRegistry(page: Page) { + return new SchemaRegistryLocators(page); + } + + static connectors(page: Page) { + return new ConnectorsLocators(page); + } + + static ksqlDb(page: Page) { + return new ksqlDbLocators(page); + } + + static dashboard(page: Page) { + return new DashboardLocators(page); + } + + static initAll(page: Page) { + return { + panel: this.panel(page), + brokers: this.brokers(page), + topics: this.topics(page), + topicsCreate: this.topicsCreate(page), + consumers: this.consumers(page), + schemaRegistry: this.schemaRegistry(page), + connectors: this.connectors(page), + ksqlDb: this.ksqlDb(page), + dashboard: this.dashboard(page) + }; + } +} diff --git a/e2e-playwright/src/hooks/pageFixture.ts b/e2e-playwright/src/hooks/pageFixture.ts index 5b6b02938..16333ddca 100644 --- a/e2e-playwright/src/hooks/pageFixture.ts +++ b/e2e-playwright/src/hooks/pageFixture.ts @@ -1,45 +1,10 @@ import { Page } from "@playwright/test"; import { Logger } from "winston"; -import PanelLocators from "../pages/Panel/PanelLocators"; -import BrokersLocators from "../pages/Brokers/BrokersLocators"; -import TopicsLocators from "../pages/Topics/TopicsLocators"; -import ConsumersLocators from "../pages/Consumers/ConsumersLocators"; -import SchemaRegistryLocators from "../pages/SchemaRegistry/SchemaRegistryLocators"; -import ConnectorsLocators from "../pages/Connectors/ConnectorsLocators"; -import ksqlDbLocators from "../pages/KSQLDB/ksqldbLocators"; -import DashboardLocators from "../pages/Dashboard/DashboardLocators"; -import TopicCreateLocators from "../pages/Topics/TopicsCreateLocators"; -export const fixture = { +export const stepsContext = { // @ts-ignore page: undefined as Page, // @ts-ignore logger: undefined as Logger, - - // @ts-ignore - navigationPanel: undefined as PanelLocators, - - // @ts-ignore - brokers: undefined as BrokersLocators, - - // @ts-ignore - topics: undefined as TopicsLocators, - // @ts-ignore - topicsCreate: undefined as TopicCreateLocators, - - // @ts-ignore - consumers: undefined as ConsumersLocators, - - // @ts-ignore - schemaRegistry: undefined as SchemaRegistryLocators, - - // @ts-ignore - connectors: undefined as ConnectorsLocators, - - // @ts-ignore - ksqlDb: undefined as ksqlDbLocators, - - // @ts-ignore - dashboard: undefined as DashboardLocators } \ No newline at end of file diff --git a/e2e-playwright/src/hooks/scenarioContext.ts b/e2e-playwright/src/hooks/scenarioContext.ts new file mode 100644 index 000000000..e9034d82f --- /dev/null +++ b/e2e-playwright/src/hooks/scenarioContext.ts @@ -0,0 +1,23 @@ +import PanelLocators from "../pages/Panel/PanelLocators"; +import BrokersLocators from "../pages/Brokers/BrokersLocators"; +import TopicsLocators from "../pages/Topics/TopicsLocators"; +import TopicCreateLocators from "../pages/Topics/TopicsCreateLocators"; +import ConsumersLocators from "../pages/Consumers/ConsumersLocators"; +import SchemaRegistryLocators from "../pages/SchemaRegistry/SchemaRegistryLocators"; +import ConnectorsLocators from "../pages/Connectors/ConnectorsLocators"; +import ksqlDbLocators from "../pages/KSQLDB/ksqldbLocators"; +import DashboardLocators from "../pages/Dashboard/DashboardLocators"; + +export const scenarioContext: Partial<{ + panel: PanelLocators; + brokers: BrokersLocators; + + topics: TopicsLocators; + topicsCreate: TopicCreateLocators; + + consumers: ConsumersLocators; + schemaRegistry: SchemaRegistryLocators; + connectors: ConnectorsLocators; + ksqlDb: ksqlDbLocators; + dashboard: DashboardLocators; +}> = {}; \ No newline at end of file diff --git a/e2e-playwright/src/steps/Topics.steps.ts b/e2e-playwright/src/steps/Topics.steps.ts index 442103eda..3b7cf52b2 100644 --- a/e2e-playwright/src/steps/Topics.steps.ts +++ b/e2e-playwright/src/steps/Topics.steps.ts @@ -1,86 +1,72 @@ import { Given, When, Then, setDefaultTimeout } from "@cucumber/cucumber"; import { expect } from "@playwright/test"; -import { fixture } from "../hooks/pageFixture"; +import { scenarioContext } from "../hooks/scenarioContext"; import { expectVisibility, ensureCheckboxState } from "../services/uiHelper"; setDefaultTimeout(60 * 1000 * 2); Given('Topics Serchfield visible', async () => { - await expect(fixture.topics.topicSearchField()).toBeVisible(); + await expect(scenarioContext.topics!.topicSearchField()).toBeVisible(); }); Given('Topics ShowInternalTopics visible', async () => { - await expect(fixture.topics.topicShowInternalTopics()).toBeVisible(); + await expect(scenarioContext.topics!.topicShowInternalTopics()).toBeVisible(); }); - Given('Topics AddATopic visible', async () => { - await expect(fixture.topics.topicAddTopicButton()).toBeVisible(); + await expect(scenarioContext.topics!.topicAddTopicButton()).toBeVisible(); }); - Given('Topics DeleteSelectedTopics active is: {string}', async (state: string) => { - const isEnabled = await fixture.topics.topicDeleteSelectedTopicsButton().isEnabled(); - + const isEnabled = await scenarioContext.topics!.topicDeleteSelectedTopicsButton().isEnabled(); expect(isEnabled.toString()).toBe(state); }); - Given('Topics CopySelectedTopic active is: {string}', async (state: string) => { - const isEnabled = await fixture.topics.topicCopySelectedTopicButton().isEnabled(); - + const isEnabled = await scenarioContext.topics!.topicCopySelectedTopicButton().isEnabled(); expect(isEnabled.toString()).toBe(state); }); - Given('Topics PurgeMessagesOfSelectedTopics active is: {string}', async (state: string) => { - const isEnabled = await fixture.topics.topicPurgeMessagesOfSelectedTopicsButton().isEnabled(); - + const isEnabled = await scenarioContext.topics!.topicPurgeMessagesOfSelectedTopicsButton().isEnabled(); expect(isEnabled.toString()).toBe(state); }); When('Topic SelectAllTopic visible is: {string}', async (visible: string) => { - await expectVisibility(fixture.topics.topicSelectAllCheckBox(), visible) + await expectVisibility(scenarioContext.topics!.topicSelectAllCheckBox(), visible); }); - Then('Topic SelectAllTopic checked is: {string}', async (state: string) => { - const checkbox = fixture.topics.topicSelectAllCheckBox(); + const checkbox = scenarioContext.topics!.topicSelectAllCheckBox(); await ensureCheckboxState(checkbox, state); const actual = await checkbox.isChecked(); expect(actual.toString()).toBe(state); }); When('Topics serchfield input {string}', async (topicName: string) => { - const textBox = fixture.topics.topicSearchField(); - - await textBox.fill(topicName); - - const actual = await textBox.inputValue(); - expect(actual, topicName) + const textBox = scenarioContext.topics!.topicSearchField(); + await textBox.fill(topicName); + const actual = await textBox.inputValue(); + expect(actual).toBe(topicName); }); Then('Topic named: {string} visible is: {string}', async (topicName: string, visible: string) => { - await expectVisibility(fixture.topics.topicNameLink(topicName), visible); + await expectVisibility(scenarioContext.topics!.topicNameLink(topicName), visible); }); When('Topic serchfield input cleared', async () => { - const textBox = fixture.topics.topicSearchField(); - + const textBox = scenarioContext.topics!.topicSearchField(); await textBox.fill(''); - const text = await textBox.inputValue(); expect(text).toBe(''); }); When('Topics ShowInternalTopics switched is: {string}', async (state: string) => { - const checkBox = fixture.topics.topicShowInternalTopics(); - + const checkBox = scenarioContext.topics!.topicShowInternalTopics(); await ensureCheckboxState(checkBox, state); }); When('Topic row named: {string} checked is: {string}', async (topicName: string, state: string) => { - const checkbox = fixture.topics.topicRowCheckBox(topicName); - + const checkbox = scenarioContext.topics!.topicRowCheckBox(topicName); await ensureCheckboxState(checkbox, state); -}); +}); \ No newline at end of file diff --git a/e2e-playwright/src/steps/TopicsCreate.steps.ts b/e2e-playwright/src/steps/TopicsCreate.steps.ts index 65f8a4a3c..4cd975b71 100644 --- a/e2e-playwright/src/steps/TopicsCreate.steps.ts +++ b/e2e-playwright/src/steps/TopicsCreate.steps.ts @@ -1,5 +1,6 @@ import { Given, When, Then, setDefaultTimeout } from "@cucumber/cucumber"; -import { fixture } from "../hooks/pageFixture"; +import { scenarioContext } from "../hooks/scenarioContext"; +import { stepsContext } from "../hooks/pageFixture"; import { expectVisibility } from "../services/uiHelper"; import { CustomWorld } from "../support/customWorld"; import { generateName } from "../services/commonFunctions"; @@ -7,137 +8,131 @@ import expect from "../helper/util/expect"; setDefaultTimeout(60 * 1000 * 2); - Given('Topics AddATopic clicked', async () => { - const button = fixture.topics.topicAddTopicButton(); + const button = scenarioContext.topics!.topicAddTopicButton(); await expect(button).toBeVisible(); await button.click(); }); Given('TopicCreate heading visible is: {string}', async (visible: string) => { - await expectVisibility(fixture.topicsCreate.topicsCreateHeading(), visible); + await expectVisibility(scenarioContext.topicsCreate!.topicsCreateHeading(), visible); }); Given('TopicCreate TopicName input visible is: {string}', async (visible: string) => { - await expectVisibility(fixture.topicsCreate.topicsCreateTopicName(), visible); + await expectVisibility(scenarioContext.topicsCreate!.topicsCreateTopicName(), visible); }); Given('TopicCreate NumberOfPartitions input visible is: {string}', async (visible: string) => { - await expectVisibility(fixture.topicsCreate.topicsCreateNumberOfPartitions(), visible); + await expectVisibility(scenarioContext.topicsCreate!.topicsCreateNumberOfPartitions(), visible); }); Given('TopicCreate CleanupPolicy select visible is: {string}', async (visible: string) => { - await expectVisibility(fixture.topicsCreate.topicsCreateCleanupPolicy(), visible); + await expectVisibility(scenarioContext.topicsCreate!.topicsCreateCleanupPolicy(), visible); }); Given('TopicCreate MinInSyncReplicas input visible is: {string}', async (visible: string) => { - await expectVisibility(fixture.topicsCreate.topicsCreateMinInSyncReplicas(), visible); + await expectVisibility(scenarioContext.topicsCreate!.topicsCreateMinInSyncReplicas(), visible); }); Given('TopicCreate ReplicationFactor input visible is: {string}', async (visible: string) => { - await expectVisibility(fixture.topicsCreate.topicsCreateReplicationFactor(), visible); + await expectVisibility(scenarioContext.topicsCreate!.topicsCreateReplicationFactor(), visible); }); Given('TopicCreate TimeToRetainData input visible is: {string}', async (visible: string) => { - await expectVisibility(fixture.topicsCreate.topicsCreateTimeToRetainData(), visible); + await expectVisibility(scenarioContext.topicsCreate!.topicsCreateTimeToRetainData(), visible); }); Given('TopicCreate 12Hours button visible is: {string}', async (visible: string) => { - await expectVisibility(fixture.topicsCreate.topicsCreate12Hours(), visible); + await expectVisibility(scenarioContext.topicsCreate!.topicsCreate12Hours(), visible); }); Given('TopicCreate 1Day button visible is: {string}', async (visible: string) => { - await expectVisibility(fixture.topicsCreate.topicsCreate1Day(), visible); + await expectVisibility(scenarioContext.topicsCreate!.topicsCreate1Day(), visible); }); Given('TopicCreate 2Day button visible is: {string}', async (visible: string) => { - await expectVisibility(fixture.topicsCreate.topicsCreate2Day(), visible); + await expectVisibility(scenarioContext.topicsCreate!.topicsCreate2Day(), visible); }); Given('TopicCreate 7Day button visible is: {string}', async (visible: string) => { - await expectVisibility(fixture.topicsCreate.topicsCreate7Day(), visible); + await expectVisibility(scenarioContext.topicsCreate!.topicsCreate7Day(), visible); }); Given('TopicCreate 4Weeks button visible is: {string}', async (visible: string) => { - await expectVisibility(fixture.topicsCreate.topicsCreate4Weeks(), visible); + await expectVisibility(scenarioContext.topicsCreate!.topicsCreate4Weeks(), visible); }); Given('TopicCreate MaxPartitionSize select visible is: {string}', async (visible: string) => { - await expectVisibility(fixture.topicsCreate.topicsCreateMaxPartitionSize(), visible); + await expectVisibility(scenarioContext.topicsCreate!.topicsCreateMaxPartitionSize(), visible); }); Given('TopicCreate MaxMessageSize input visible is: {string}', async (visible: string) => { - await expectVisibility(fixture.topicsCreate.topicsCreateMaxMessageSize(), visible); + await expectVisibility(scenarioContext.topicsCreate!.topicsCreateMaxMessageSize(), visible); }); Given('TopicCreate AddCustomParameter button visible is: {string}', async (visible: string) => { - await expectVisibility(fixture.topicsCreate.topicsCreateAddCustomParameter(), visible); + await expectVisibility(scenarioContext.topicsCreate!.topicsCreateAddCustomParameter(), visible); }); Given('TopicCreate Cancel button visible is: {string}', async (visible: string) => { - await expectVisibility(fixture.topicsCreate.topicsCreateCancel(), visible); + await expectVisibility(scenarioContext.topicsCreate!.topicsCreateCancel(), visible); }); Given('TopicCreate CreateTopic button visible is: {string}', async (visible: string) => { - await expectVisibility(fixture.topicsCreate.topicCreateCreateTopicButton(), visible); + await expectVisibility(scenarioContext.topicsCreate!.topicCreateCreateTopicButton(), visible); }); - When('TopicCreate Topic name starts with: {string}', async function (this: CustomWorld, prefix: string) { const topicName = generateName(prefix); this.setValue(`topicName-${prefix}`, topicName); - await fixture.topicsCreate.topicsCreateTopicName().fill(topicName); + await scenarioContext.topicsCreate!.topicsCreateTopicName().fill(topicName); }); When('TopicCreate Number of partitons: {int}', async function (this: CustomWorld, count: number) { - const input = fixture.topicsCreate.topicsCreateNumberOfPartitions(); - await input.fill(count.toString()); + await scenarioContext.topicsCreate!.topicsCreateNumberOfPartitions().fill(count.toString()); }); -When('TopicCreate Time to retain data one day', async function (this: CustomWorld) { - const button = fixture.topicsCreate.topicsCreate1Day(); - await button.click(); +When('TopicCreate Time to retain data one day', async function () { + await scenarioContext.topicsCreate!.topicsCreate1Day().click(); }); -When('TopicCreate Create topic clicked', async function (this: CustomWorld) { - const button = fixture.topicsCreate.topicCreateCreateTopicButton(); - await button.click(); +When('TopicCreate Create topic clicked', async function () { + await scenarioContext.topicsCreate!.topicCreateCreateTopicButton().click(); }); Then('Header starts with: {string}', async function (this: CustomWorld, prefix: string) { const topicName = this.getValue(`topicName-${prefix}`); - const header = fixture.page.getByRole('heading', { name: topicName }); - + const header = stepsContext.page.getByRole('heading', { name: topicName }); await expect(header).toBeVisible(); }); Then('Topic name started with: {string} visible is: {string}', async function (this: CustomWorld, prefix: string, visible: string) { const topicName = this.getValue(`topicName-${prefix}`); - await expectVisibility(fixture.topics.topicNameLink(topicName), visible); + await expectVisibility(scenarioContext.topics!.topicNameLink(topicName), visible); }); Then('TopicCreate TimeToRetainData value is: {string}', async (expectedValue: string) => { - const input = fixture.topicsCreate.topicsCreateTimeToRetainData(); + const input = scenarioContext.topicsCreate!.topicsCreateTimeToRetainData(); const actualValue = await input.inputValue(); expect(actualValue).toBe(expectedValue); }); When('TopicCreate 12Hours button clicked', async () => { - await fixture.topicsCreate.topicsCreate12Hours().click(); + await scenarioContext.topicsCreate!.topicsCreate12Hours().click(); }); When('TopicCreate 1Day button clicked', async () => { - await fixture.topicsCreate.topicsCreate1Day().click(); + await scenarioContext.topicsCreate!.topicsCreate1Day().click(); }); When('TopicCreate 2Day button clicked', async () => { - await fixture.topicsCreate.topicsCreate2Day().click(); + await scenarioContext.topicsCreate!.topicsCreate2Day().click(); }); When('TopicCreate 7Day button clicked', async () => { - await fixture.topicsCreate.topicsCreate7Day().click(); + await scenarioContext.topicsCreate!.topicsCreate7Day().click(); }); When('TopicCreate 4Weeks button clicked', async () => { - await fixture.topicsCreate.topicsCreate4Weeks().click(); + await scenarioContext.topicsCreate!.topicsCreate4Weeks().click(); }); diff --git a/e2e-playwright/src/steps/navigation.steps.ts b/e2e-playwright/src/steps/navigation.steps.ts index eb9b442c6..b55b32d37 100644 --- a/e2e-playwright/src/steps/navigation.steps.ts +++ b/e2e-playwright/src/steps/navigation.steps.ts @@ -1,115 +1,109 @@ import { Given, When, Then, setDefaultTimeout } from "@cucumber/cucumber"; -import { fixture } from "../hooks/pageFixture"; +import { stepsContext } from "../hooks/pageFixture"; import expect from "../helper/util/expect"; +import { scenarioContext } from "../hooks/scenarioContext"; setDefaultTimeout(60 * 1000 * 2); Given('Brokers is visible', async () => { - await fixture.page.goto(process.env.BASEURL!); - await expect(fixture.navigationPanel.brokersLink()).toBeVisible(); - }); + await stepsContext.page.goto(process.env.BASEURL!); + await expect(scenarioContext.panel!.brokersLink()).toBeVisible(); +}); When('click on Brokers link', async () => { - await fixture.navigationPanel.brokersLink().click(); + await scenarioContext.panel!.brokersLink().click(); }); Then('Brokers heading visible', async () => { - await fixture.brokers.brokersHeading().waitFor({ state: 'visible' }); + await scenarioContext.brokers!.brokersHeading().waitFor({ state: 'visible' }); }); - Given('Topics is visible', async () => { - await fixture.page.goto(process.env.BASEURL!); - await expect(fixture.navigationPanel.topicsLink()).toBeVisible(); + await stepsContext.page.goto(process.env.BASEURL!); + await expect(scenarioContext.panel!.topicsLink()).toBeVisible(); }); When('click on Topics link', async () => { - await fixture.navigationPanel.topicsLink().click(); + await scenarioContext.panel!.topicsLink().click(); }); Then('Topics heading visible', async () => { - await fixture.topics.topicsHeading().waitFor({ state: 'visible' }); + await scenarioContext.topics!.topicsHeading().waitFor({ state: 'visible' }); }); - Given('Consumers is visible', async () => { - await fixture.page.goto(process.env.BASEURL!); - await expect(fixture.navigationPanel.consumersLink()).toBeVisible(); + await stepsContext.page.goto(process.env.BASEURL!); + await expect(scenarioContext.panel!.consumersLink()).toBeVisible(); }); When('click on Consumers link', async () => { - await fixture.navigationPanel.consumersLink().click(); + await scenarioContext.panel!.consumersLink().click(); }); Then('Consumers heading visible', async () => { - await fixture.consumers.consumersHeading().waitFor({ state: 'visible' }); + await scenarioContext.consumers!.consumersHeading().waitFor({ state: 'visible' }); }); - Given('Schema Registry is visible', async () => { - await fixture.page.goto(process.env.BASEURL!); - await expect(fixture.navigationPanel.schemaRegistryLink()).toBeVisible(); + await stepsContext.page.goto(process.env.BASEURL!); + await expect(scenarioContext.panel!.schemaRegistryLink()).toBeVisible(); }); When('click on Schema Registry link', async () => { - await fixture.navigationPanel.schemaRegistryLink().click(); + await scenarioContext.panel!.schemaRegistryLink().click(); }); Then('Schema Registry heading visible', async () => { - await fixture.schemaRegistry.schemaRegistryHeading().waitFor({ state: 'visible' }); + await scenarioContext.schemaRegistry!.schemaRegistryHeading().waitFor({ state: 'visible' }); }); - Given('Kafka Connect is visible', async () => { - await fixture.page.goto(process.env.BASEURL!); - await expect(fixture.navigationPanel.kafkaConnectLink()).toBeVisible(); + await stepsContext.page.goto(process.env.BASEURL!); + await expect(scenarioContext.panel!.kafkaConnectLink()).toBeVisible(); }); When('click on Kafka Connect link', async () => { - await fixture.navigationPanel.kafkaConnectLink().click(); + await scenarioContext.panel!.kafkaConnectLink().click(); }); Then('Kafka Connect heading visible', async () => { - await fixture.connectors.connectorsHeading().waitFor({ state: 'visible' }); + await scenarioContext.connectors!.connectorsHeading().waitFor({ state: 'visible' }); }); Given('KSQL DB is visible', async () => { - await fixture.page.goto(process.env.BASEURL!); - await expect(fixture.navigationPanel.ksqlDbLink()).toBeVisible(); + await stepsContext.page.goto(process.env.BASEURL!); + await expect(scenarioContext.panel!.ksqlDbLink()).toBeVisible(); }); When('click on KSQL DB link', async () => { - await fixture.navigationPanel.ksqlDbLink().click(); + await scenarioContext.panel!.ksqlDbLink().click(); }); Then('KSQL DB heading visible', async () => { - await fixture.ksqlDb.ksqlDbHeading().waitFor({ state: 'visible' }); + await scenarioContext.ksqlDb!.ksqlDbHeading().waitFor({ state: 'visible' }); }); - Given('Dashboard is visible', async () => { - await fixture.page.goto(process.env.BASEURL!); - var tmp = fixture.navigationPanel.getDashboardLink(); - await expect(fixture.navigationPanel.getDashboardLink()).toBeVisible(); + await stepsContext.page.goto(process.env.BASEURL!); + await expect(scenarioContext.panel!.getDashboardLink()).toBeVisible(); }); When('click on Dashboard link', async () => { - const dashboard = fixture.navigationPanel.getDashboardLink() - await dashboard.isVisible(); - await dashboard.click(); + const dashboard = scenarioContext.panel!.getDashboardLink(); + await dashboard.isVisible(); + await dashboard.click(); }); Then('Dashboard heading visible', async () => { - await fixture.dashboard.dashboardHeading().waitFor({ state: 'visible' }); + await scenarioContext.dashboard!.dashboardHeading().waitFor({ state: 'visible' }); }); - Then('the end of current URL should be {string}', async (expected: string) => { - const actual = new URL(fixture.page.url()).pathname; + const actual = new URL(stepsContext.page.url()).pathname; expect(actual.endsWith(expected)).toBeTruthy(); }); Then('the part of current URL should be {string}', async (expected: string) => { - const actual = new URL(fixture.page.url()).pathname; - expect(actual.includes(expected)).toBeTruthy(); - }); + const actual = new URL(stepsContext.page.url()).pathname; + expect(actual.includes(expected)).toBeTruthy(); +}); \ No newline at end of file From 5a4d798c508151509b5cbf539b7981004dc7b5f2 Mon Sep 17 00:00:00 2001 From: AspidDark Date: Thu, 22 May 2025 19:30:53 +0300 Subject: [PATCH 02/14] refactoring --- e2e-playwright/.eslintrc.json | 42 + e2e-playwright/eslint.config.js | 12 + e2e-playwright/package-lock.json | 1445 ++++++++++++++++- e2e-playwright/package.json | 9 +- e2e-playwright/src/features/Topics.feature | 3 +- .../src/features/TopicsCreate.feature | 58 +- .../src/features/navigation.feature | 2 +- .../src/helper/browsers/browserManager.ts | 1 + .../src/helper/wrapper/PlaywrightWrappers.ts | 28 - e2e-playwright/src/hooks/hooks.ts | 37 +- e2e-playwright/src/hooks/locatorsFactory.ts | 63 - e2e-playwright/src/hooks/pageFixture.ts | 10 - e2e-playwright/src/hooks/scenarioContext.ts | 23 - e2e-playwright/src/pages/Locators.ts | 64 + .../src/pages/Panel/PanelLocators.ts | 19 +- .../src/services/commonFunctions.ts | 1 - e2e-playwright/src/services/uiHelper.ts | 2 +- e2e-playwright/src/steps/Topics.steps.ts | 56 +- .../src/steps/TopicsCreate.steps.ts | 126 +- e2e-playwright/src/steps/navigation.steps.ts | 113 +- .../src/support/PlaywrightCustomWorld.ts | 63 + e2e-playwright/src/support/customWorld.ts | 25 - 22 files changed, 1835 insertions(+), 367 deletions(-) create mode 100644 e2e-playwright/.eslintrc.json create mode 100644 e2e-playwright/eslint.config.js delete mode 100644 e2e-playwright/src/helper/wrapper/PlaywrightWrappers.ts delete mode 100644 e2e-playwright/src/hooks/locatorsFactory.ts delete mode 100644 e2e-playwright/src/hooks/pageFixture.ts delete mode 100644 e2e-playwright/src/hooks/scenarioContext.ts create mode 100644 e2e-playwright/src/pages/Locators.ts create mode 100644 e2e-playwright/src/support/PlaywrightCustomWorld.ts delete mode 100644 e2e-playwright/src/support/customWorld.ts diff --git a/e2e-playwright/.eslintrc.json b/e2e-playwright/.eslintrc.json new file mode 100644 index 000000000..cdd8c5f0a --- /dev/null +++ b/e2e-playwright/.eslintrc.json @@ -0,0 +1,42 @@ +{ + "env": { + "browser": true, + "node": true + }, + "parser": "@typescript-eslint/parser", + "parserOptions": { + "project": "tsconfig.json", + "sourceType": "module" + }, + "plugins": ["import", "simple-import-sort", "n", "@typescript-eslint"], + "extends": [ + "eslint:recommended", + "plugin:import/typescript", + "plugin:@typescript-eslint/eslint-recommended", + "plugin:@typescript-eslint/recommended", + "plugin:prettier/recommended" + ], + "rules": { + "import/no-cycle": "error", + "n/no-extraneous-import": "error", + "@typescript-eslint/ban-ts-ignore": "off", + "@typescript-eslint/ban-ts-comment": "off", + "@typescript-eslint/explicit-module-boundary-types": "off", + "@typescript-eslint/explicit-function-return-type": "off", + "@typescript-eslint/no-use-before-define": "off", + "@typescript-eslint/interface-name-prefix": "off", + "@typescript-eslint/member-delimiter-style": "off", + "@typescript-eslint/no-explicit-any": "error", + "@typescript-eslint/no-non-null-assertion": "error", + "simple-import-sort/imports": "error", + "simple-import-sort/exports": "error" + }, + "overrides": [ + { + "files": ["test/**"], + "rules": { + "@typescript-eslint/no-non-null-assertion": "off" + } + } + ] +} \ No newline at end of file diff --git a/e2e-playwright/eslint.config.js b/e2e-playwright/eslint.config.js new file mode 100644 index 000000000..d86c9b1e9 --- /dev/null +++ b/e2e-playwright/eslint.config.js @@ -0,0 +1,12 @@ +import js from "@eslint/js"; +import globals from "globals"; +import tseslint from "typescript-eslint"; +import { defineConfig } from "eslint/config"; + + +export default defineConfig([ + { files: ["**/*.{js,mjs,cjs,ts,mts,cts}"], plugins: { js }, extends: ["js/recommended"] }, + { files: ["**/*.{js,mjs,cjs,ts,mts,cts}"], languageOptions: { globals: globals.browser } }, + { files: ["**/*.{ts,tsx}"], ...tseslint.configs.recommendedTypeChecked, languageOptions: { parserOptions: {project: "./tsconfig.json" } } }, + tseslint.configs.recommended, +]); diff --git a/e2e-playwright/package-lock.json b/e2e-playwright/package-lock.json index 0ced03933..1a881775b 100644 --- a/e2e-playwright/package-lock.json +++ b/e2e-playwright/package-lock.json @@ -13,14 +13,20 @@ }, "devDependencies": { "@cucumber/cucumber": "^11.2.0", + "@eslint/js": "^9.27.0", "@playwright/test": "^1.48.2", "@types/node": "^22.15.3", + "@typescript-eslint/eslint-plugin": "^8.32.1", + "@typescript-eslint/parser": "^8.32.1", "cross-env": "^7.0.3", "dotenv": "^16.5.0", + "eslint": "^9.27.0", "fs-extra": "^11.3.0", + "globals": "^16.1.0", "multiple-cucumber-html-reporter": "^3.9.2", "ts-node": "^10.9.2", "typescript": "^5.8.3", + "typescript-eslint": "^8.32.1", "winston": "^3.17.0" } }, @@ -399,6 +405,271 @@ "kuler": "^2.0.0" } }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.7.0.tgz", + "integrity": "sha512-dyybb3AcajC7uha6CvhdVRJqaKyn7w2YKqKyAN37NKYgZT36w+iRb0Dymmc5qEJ549c/S31cMMSFd75bteCpCw==", + "dev": true, + "license": "MIT", + "dependencies": { + "eslint-visitor-keys": "^3.4.3" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.1.tgz", + "integrity": "sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/config-array": { + "version": "0.20.0", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.20.0.tgz", + "integrity": "sha512-fxlS1kkIjx8+vy2SjuCB94q3htSNrufYTXubwiBFeaQHbH6Ipi43gFJq2zCMt6PHhImH3Xmr0NksKDvchWlpQQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/object-schema": "^2.1.6", + "debug": "^4.3.1", + "minimatch": "^3.1.2" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/config-array/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/@eslint/config-array/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/@eslint/config-helpers": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.2.2.tgz", + "integrity": "sha512-+GPzk8PlG0sPpzdU5ZvIRMPidzAnZDl/s9L+y13iodqvb8leL53bTannOrQ/Im7UkpsmFU5Ily5U60LWixnmLg==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/core": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.14.0.tgz", + "integrity": "sha512-qIbV0/JZr7iSDjqAc60IqbLdsj9GDt16xQtWD+B78d/HAlvysGdZZ6rpJHGAc2T0FQx1X6thsSPdnoiGKdNtdg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@types/json-schema": "^7.0.15" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.1.tgz", + "integrity": "sha512-gtF186CXhIl1p4pJNGZw8Yc6RlshoePRvE0X91oPGb3vZ8pM3qOS9W9NGPat9LziaBV7XrJWGylNQXkGcnM3IQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^10.0.1", + "globals": "^14.0.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/eslintrc/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/@eslint/eslintrc/node_modules/globals": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", + "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@eslint/eslintrc/node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/@eslint/eslintrc/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/@eslint/js": { + "version": "9.27.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.27.0.tgz", + "integrity": "sha512-G5JD9Tu5HJEu4z2Uo4aHY2sLV64B7CDMXxFzqzjl3NKd6RVzSXNoE80jk7Y0lJkTTkjiIhBAqmlYwjuBY3tvpA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://eslint.org/donate" + } + }, + "node_modules/@eslint/object-schema": { + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.6.tgz", + "integrity": "sha512-RBMg5FRL0I0gs51M/guSAj5/e14VQ4tpZnQNWwuDT66P14I43ItmPfIZRhO9fUVIPOAQXU47atlywZ/czoqFPA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/plugin-kit": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.3.1.tgz", + "integrity": "sha512-0J+zgWxHN+xXONWIyPWKFMgVuJoZuGiIFu8yxk7RJjxkzpGmyja5wRFqZIVtjDVOQpV+Rw0iOAjYPE2eQyjr0w==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^0.14.0", + "levn": "^0.4.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@humanfs/core": { + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", + "integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/node": { + "version": "0.16.6", + "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.6.tgz", + "integrity": "sha512-YuI2ZHQL78Q5HbhDiBA1X4LmYdXCKCMQIfw0pw7piHJwyREFebJUvrQN4cMssyES6x+vfUbx1CIpaQUKYdQZOw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@humanfs/core": "^0.19.1", + "@humanwhocodes/retry": "^0.3.0" + }, + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/node/node_modules/@humanwhocodes/retry": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.3.1.tgz", + "integrity": "sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/retry": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.3.tgz", + "integrity": "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, "node_modules/@isaacs/cliui": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", @@ -470,6 +741,44 @@ "@jridgewell/sourcemap-codec": "^1.4.10" } }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/@pkgjs/parseargs": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", @@ -535,6 +844,20 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/estree": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.7.tgz", + "integrity": "sha512-w28IoSUCJpidD/TGviZwwMJckNESJZXFu7NBZ5YJ4mEUnNraUn9Pm8HSZm/jDF1pDWYKspWE7oVphigUPRakIQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/node": { "version": "22.15.3", "resolved": "https://registry.npmjs.org/@types/node/-/node-22.15.3.tgz", @@ -566,6 +889,212 @@ "dev": true, "license": "MIT" }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "8.32.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.32.1.tgz", + "integrity": "sha512-6u6Plg9nP/J1GRpe/vcjjabo6Uc5YQPAMxsgQyGC/I0RuukiG1wIe3+Vtg3IrSCVJDmqK3j8adrtzXSENRtFgg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/regexpp": "^4.10.0", + "@typescript-eslint/scope-manager": "8.32.1", + "@typescript-eslint/type-utils": "8.32.1", + "@typescript-eslint/utils": "8.32.1", + "@typescript-eslint/visitor-keys": "8.32.1", + "graphemer": "^1.4.0", + "ignore": "^7.0.0", + "natural-compare": "^1.4.0", + "ts-api-utils": "^2.1.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^8.0.0 || ^8.0.0-alpha.0", + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.9.0" + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "8.32.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.32.1.tgz", + "integrity": "sha512-LKMrmwCPoLhM45Z00O1ulb6jwyVr2kr3XJp+G+tSEZcbauNnScewcQwtJqXDhXeYPDEjZ8C1SjXm015CirEmGg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/scope-manager": "8.32.1", + "@typescript-eslint/types": "8.32.1", + "@typescript-eslint/typescript-estree": "8.32.1", + "@typescript-eslint/visitor-keys": "8.32.1", + "debug": "^4.3.4" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.9.0" + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "8.32.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.32.1.tgz", + "integrity": "sha512-7IsIaIDeZn7kffk7qXC3o6Z4UblZJKV3UBpkvRNpr5NSyLji7tvTcvmnMNYuYLyh26mN8W723xpo3i4MlD33vA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.32.1", + "@typescript-eslint/visitor-keys": "8.32.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "8.32.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.32.1.tgz", + "integrity": "sha512-mv9YpQGA8iIsl5KyUPi+FGLm7+bA4fgXaeRcFKRDRwDMu4iwrSHeDPipwueNXhdIIZltwCJv+NkxftECbIZWfA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/typescript-estree": "8.32.1", + "@typescript-eslint/utils": "8.32.1", + "debug": "^4.3.4", + "ts-api-utils": "^2.1.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.9.0" + } + }, + "node_modules/@typescript-eslint/types": { + "version": "8.32.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.32.1.tgz", + "integrity": "sha512-YmybwXUJcgGqgAp6bEsgpPXEg6dcCyPyCSr0CAAueacR/CCBi25G3V8gGQ2kRzQRBNol7VQknxMs9HvVa9Rvfg==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "8.32.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.32.1.tgz", + "integrity": "sha512-Y3AP9EIfYwBb4kWGb+simvPaqQoT5oJuzzj9m0i6FCY6SPvlomY2Ei4UEMm7+FXtlNJbor80ximyslzaQF6xhg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.32.1", + "@typescript-eslint/visitor-keys": "8.32.1", + "debug": "^4.3.4", + "fast-glob": "^3.3.2", + "is-glob": "^4.0.3", + "minimatch": "^9.0.4", + "semver": "^7.6.0", + "ts-api-utils": "^2.1.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <5.9.0" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { + "version": "7.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", + "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/utils": { + "version": "8.32.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.32.1.tgz", + "integrity": "sha512-DsSFNIgLSrc89gpq1LJB7Hm1YpuhK086DRDJSNrewcGvYloWW1vZLHBTIvarKZDcAORIy/uWNx8Gad+4oMpkSA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.7.0", + "@typescript-eslint/scope-manager": "8.32.1", + "@typescript-eslint/types": "8.32.1", + "@typescript-eslint/typescript-estree": "8.32.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.9.0" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "8.32.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.32.1.tgz", + "integrity": "sha512-ar0tjQfObzhSaW3C3QNmTc5ofj0hDoNQ5XWrCy6zDyabdr0TWhCkClp+rywGNj/odAFBVzzJrK4tEq5M4Hmu4w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.32.1", + "eslint-visitor-keys": "^4.2.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/visitor-keys/node_modules/eslint-visitor-keys": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz", + "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, "node_modules/acorn": { "version": "8.14.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.1.tgz", @@ -579,6 +1108,16 @@ "node": ">=0.4.0" } }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, "node_modules/acorn-walk": { "version": "8.3.4", "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz", @@ -592,6 +1131,23 @@ "node": ">=0.4.0" } }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, "node_modules/ansi-regex": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz", @@ -630,7 +1186,14 @@ "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", "dev": true, - "license": "MIT" + "license": "MIT" + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true, + "license": "Python-2.0" }, "node_modules/assertion-error-formatter": { "version": "3.0.0", @@ -668,6 +1231,19 @@ "balanced-match": "^1.0.0" } }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/buffer-from": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", @@ -675,6 +1251,16 @@ "dev": true, "license": "MIT" }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/capital-case": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/capital-case/-/capital-case-1.0.4.tgz", @@ -820,6 +1406,13 @@ "node": ">=14" } }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true, + "license": "MIT" + }, "node_modules/create-require": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", @@ -879,6 +1472,13 @@ } } }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true, + "license": "MIT" + }, "node_modules/define-lazy-prop": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz", @@ -953,6 +1553,295 @@ "node": ">=0.8.0" } }, + "node_modules/eslint": { + "version": "9.27.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.27.0.tgz", + "integrity": "sha512-ixRawFQuMB9DZ7fjU3iGGganFDp3+45bPOdaRurcFHSXO1e/sYwUX/FtQZpLZJR6SjMoJH8hR2pPEAfDyCoU2Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.12.1", + "@eslint/config-array": "^0.20.0", + "@eslint/config-helpers": "^0.2.1", + "@eslint/core": "^0.14.0", + "@eslint/eslintrc": "^3.3.1", + "@eslint/js": "9.27.0", + "@eslint/plugin-kit": "^0.3.1", + "@humanfs/node": "^0.16.6", + "@humanwhocodes/module-importer": "^1.0.1", + "@humanwhocodes/retry": "^0.4.2", + "@types/estree": "^1.0.6", + "@types/json-schema": "^7.0.15", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.6", + "debug": "^4.3.2", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^8.3.0", + "eslint-visitor-keys": "^4.2.0", + "espree": "^10.3.0", + "esquery": "^1.5.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^8.0.0", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "jiti": "*" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + } + } + }, + "node_modules/eslint-scope": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.3.0.tgz", + "integrity": "sha512-pUNxi75F8MJ/GdeKtVLSbYg4ZI34J6C0C7sbL4YOp2exGwen7ZsuBqKzUhXd0qMQ362yET3z+uPwKeg/0C2XCQ==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/eslint/node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/eslint-visitor-keys": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz", + "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint/node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/eslint/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/espree": { + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-10.3.0.tgz", + "integrity": "sha512-0QYC8b24HWY8zjRnDTL6RiHfDbAWn63qb4LMj1Z4b076A4une81+z03Kg7l7mn/48PUTqoLptSXez8oknU8Clg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "acorn": "^8.14.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^4.2.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/espree/node_modules/eslint-visitor-keys": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz", + "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esquery": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", + "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-glob": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", + "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.8" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fast-glob/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fastq": { + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.1.tgz", + "integrity": "sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "reusify": "^1.0.4" + } + }, "node_modules/fecha": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/fecha/-/fecha-4.2.3.tgz", @@ -976,6 +1865,32 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/file-entry-cache": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", + "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "flat-cache": "^4.0.0" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/find": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/find/-/find-0.3.0.tgz", @@ -986,6 +1901,23 @@ "traverse-chain": "~0.1.0" } }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/find-up-simple": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/find-up-simple/-/find-up-simple-1.0.1.tgz", @@ -999,6 +1931,27 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/flat-cache": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", + "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", + "dev": true, + "license": "MIT", + "dependencies": { + "flatted": "^3.2.9", + "keyv": "^4.5.4" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/flatted": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.3.tgz", + "integrity": "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==", + "dev": true, + "license": "ISC" + }, "node_modules/fn.name": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/fn.name/-/fn.name-1.1.0.tgz", @@ -1074,6 +2027,19 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, "node_modules/global-dirs": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-3.0.1.tgz", @@ -1090,6 +2056,19 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/globals": { + "version": "16.1.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-16.1.0.tgz", + "integrity": "sha512-aibexHNbb/jiUSObBgpHLj+sIuUmJnYcgXBlrfsiDZ9rt4aF2TFRbyLgZ2iFQuVZ1K5Mx3FVkbKRSgKrbK3K2g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/graceful-fs": { "version": "4.2.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", @@ -1097,6 +2076,13 @@ "dev": true, "license": "ISC" }, + "node_modules/graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", + "dev": true, + "license": "MIT" + }, "node_modules/has-ansi": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-4.0.1.tgz", @@ -1130,7 +2116,54 @@ "lru-cache": "^10.0.1" }, "engines": { - "node": "^16.14.0 || >=18.0.0" + "node": "^16.14.0 || >=18.0.0" + } + }, + "node_modules/ignore": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.4.tgz", + "integrity": "sha512-gJzzk+PQNznz8ysRrC0aOkBNVRBDtE1n53IqyqEf3PXrYwomFs5q4pGMizBMJF+ykh03insJ27hB8gSrD2Hn8A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/import-fresh": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", + "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/import-fresh/node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.19" } }, "node_modules/indent-string": { @@ -1196,6 +2229,16 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", @@ -1206,6 +2249,19 @@ "node": ">=8" } }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/is-installed-globally": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/is-installed-globally/-/is-installed-globally-0.4.0.tgz", @@ -1223,6 +2279,16 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, "node_modules/is-path-inside": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", @@ -1289,6 +2355,40 @@ "dev": true, "license": "MIT" }, + "node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true, + "license": "MIT" + }, "node_modules/jsonfile": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", @@ -1302,6 +2402,16 @@ "graceful-fs": "^4.1.6" } }, + "node_modules/keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "license": "MIT", + "dependencies": { + "json-buffer": "3.0.1" + } + }, "node_modules/knuth-shuffle-seeded": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/knuth-shuffle-seeded/-/knuth-shuffle-seeded-1.0.6.tgz", @@ -1319,6 +2429,36 @@ "dev": true, "license": "MIT" }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/lodash": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", @@ -1402,6 +2542,30 @@ "dev": true, "license": "ISC" }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromatch": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "dev": true, + "license": "MIT", + "dependencies": { + "braces": "^3.0.3", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, "node_modules/mime": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz", @@ -1502,6 +2666,13 @@ "thenify-all": "^1.0.0" } }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true, + "license": "MIT" + }, "node_modules/no-case": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/no-case/-/no-case-3.0.4.tgz", @@ -1566,6 +2737,56 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/optionator": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.5" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/package-json-from-dist": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", @@ -1586,6 +2807,19 @@ "node": ">=0.10.0" } }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "license": "MIT", + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/parse-json": { "version": "8.3.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-8.3.0.tgz", @@ -1604,6 +2838,16 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/path-key": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", @@ -1638,6 +2882,19 @@ "dev": true, "license": "ISC" }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/playwright": { "version": "1.52.0", "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.52.0.tgz", @@ -1670,6 +2927,16 @@ "node": ">=18" } }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/progress": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", @@ -1687,6 +2954,37 @@ "dev": true, "license": "MIT" }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, "node_modules/read-package-up": { "version": "11.0.0", "resolved": "https://registry.npmjs.org/read-package-up/-/read-package-up-11.0.0.tgz", @@ -1800,6 +3098,41 @@ "node": ">=8" } }, + "node_modules/reusify": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", + "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==", + "dev": true, + "license": "MIT", + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -2137,6 +3470,19 @@ "url": "https://github.com/chalk/ansi-regex?sponsor=1" } }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/supports-color": { "version": "8.1.1", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", @@ -2200,6 +3546,19 @@ "node": ">=14.14" } }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, "node_modules/toposort": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/toposort/-/toposort-2.0.2.tgz", @@ -2224,6 +3583,19 @@ "node": ">= 14.0.0" } }, + "node_modules/ts-api-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.1.0.tgz", + "integrity": "sha512-CUgTZL1irw8u29bzrOD/nH85jqyc74D6SshFgujOIA7osm2Rz7dYH77agkx7H4FBNxDq7Cjf+IjaX/8zwFW+ZQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.12" + }, + "peerDependencies": { + "typescript": ">=4.8.4" + } + }, "node_modules/ts-node": { "version": "10.9.2", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", @@ -2275,6 +3647,19 @@ "dev": true, "license": "0BSD" }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/type-fest": { "version": "4.40.1", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.40.1.tgz", @@ -2302,6 +3687,29 @@ "node": ">=14.17" } }, + "node_modules/typescript-eslint": { + "version": "8.32.1", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.32.1.tgz", + "integrity": "sha512-D7el+eaDHAmXvrZBy1zpzSNIRqnCOrkwTgZxTu3MUqRWk8k0q9m9Ho4+vPf7iHtgUfrK/o8IZaEApsxPlHTFCg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/eslint-plugin": "8.32.1", + "@typescript-eslint/parser": "8.32.1", + "@typescript-eslint/utils": "8.32.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.9.0" + } + }, "node_modules/undici-types": { "version": "6.21.0", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", @@ -2342,6 +3750,16 @@ "tslib": "^2.0.3" } }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "punycode": "^2.1.0" + } + }, "node_modules/util-arity": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/util-arity/-/util-arity-1.1.0.tgz", @@ -2451,6 +3869,16 @@ "node": ">=0.1.90" } }, + "node_modules/word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/wrap-ansi": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", @@ -2589,6 +4017,19 @@ "node": ">=6" } }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/yup": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/yup/-/yup-1.2.0.tgz", diff --git a/e2e-playwright/package.json b/e2e-playwright/package.json index 320bb6ece..bc84432c7 100644 --- a/e2e-playwright/package.json +++ b/e2e-playwright/package.json @@ -8,7 +8,8 @@ "test": "cross-env ENV=prod FORCE_COLOR=0 cucumber-js --config=config/cucumber.js", "test:stage": "cross-env ENV=stage FORCE_COLOR=0 cucumber-js --config=config/cucumber.js", "posttest": "npx ts-node src/helper/report/report.ts", - "test:failed": "cucumber-js -p rerun @rerun.txt" + "test:failed": "cucumber-js -p rerun @rerun.txt", + "lint": "eslint 'src/**/*.ts' --fix" }, "keywords": [], "author": "", @@ -16,14 +17,20 @@ "description": "", "devDependencies": { "@cucumber/cucumber": "^11.2.0", + "@eslint/js": "^9.27.0", "@playwright/test": "^1.48.2", "@types/node": "^22.15.3", + "@typescript-eslint/eslint-plugin": "^8.32.1", + "@typescript-eslint/parser": "^8.32.1", "cross-env": "^7.0.3", "dotenv": "^16.5.0", + "eslint": "^9.27.0", "fs-extra": "^11.3.0", + "globals": "^16.1.0", "multiple-cucumber-html-reporter": "^3.9.2", "ts-node": "^10.9.2", "typescript": "^5.8.3", + "typescript-eslint": "^8.32.1", "winston": "^3.17.0" }, "dependencies": { diff --git a/e2e-playwright/src/features/Topics.feature b/e2e-playwright/src/features/Topics.feature index fae1f05cd..b241fb000 100644 --- a/e2e-playwright/src/features/Topics.feature +++ b/e2e-playwright/src/features/Topics.feature @@ -31,7 +31,7 @@ Feature: Topics page visibility and functions And Topics CopySelectedTopic active is: "false" And Topics PurgeMessagesOfSelectedTopics active is: "false" - Scenario: Topics serchfield and ShowInternalTopics + Scenario: Topics serchfield and ShowInternalTopics Given Topics is visible When click on Topics link And Topics Serchfield visible @@ -43,4 +43,3 @@ Feature: Topics page visibility and functions Then Topic named: "__consumer_offsets" visible is: "true" When Topics serchfield input "users" Then Topic named: "users" visible is: "true" - diff --git a/e2e-playwright/src/features/TopicsCreate.feature b/e2e-playwright/src/features/TopicsCreate.feature index 397173163..5e663857f 100644 --- a/e2e-playwright/src/features/TopicsCreate.feature +++ b/e2e-playwright/src/features/TopicsCreate.feature @@ -1,6 +1,6 @@ Feature: TopicsCreate page - Scenario: TopicCreate elemets visible + Scenario: TopicCreate elemets visible Given Topics is visible When click on Topics link Given Topics AddATopic clicked @@ -22,32 +22,32 @@ Feature: TopicsCreate page Given TopicCreate Cancel button visible is: "true" Given TopicCreate CreateTopic button visible is: "true" -Scenario: TopicCreate ui functions - Given Topics is visible - When click on Topics link - Given Topics AddATopic clicked - Given TopicCreate heading visible is: "true" - When TopicCreate Topic name starts with: "NewAutoTopic" - When TopicCreate Number of partitons: 2 - When TopicCreate Time to retain data one day - When TopicCreate Create topic clicked - Then Header starts with: "NewAutoTopic" - When click on Topics link - Then Topic name started with: "NewAutoTopic" visible is: "true" + Scenario: TopicCreate ui functions + Given Topics is visible + When click on Topics link + Given Topics AddATopic clicked + Given TopicCreate heading visible is: "true" + When TopicCreate Topic name starts with: "NewAutoTopic" + When TopicCreate Number of partitons: 2 + When TopicCreate Time to retain data one day + When TopicCreate Create topic clicked + Then Header starts with: "NewAutoTopic" + When click on Topics link + Then Topic name started with: "NewAutoTopic" visible is: "true" -Scenario: TopicCreate time to retain data functions - Given Topics is visible - When click on Topics link - Given Topics AddATopic clicked - Given TopicCreate TimeToRetainData input visible is: "true" - Then TopicCreate TimeToRetainData value is: "" - When TopicCreate 12Hours button clicked - Then TopicCreate TimeToRetainData value is: "43200000" - When TopicCreate 1Day button clicked - Then TopicCreate TimeToRetainData value is: "86400000" - When TopicCreate 2Day button clicked - Then TopicCreate TimeToRetainData value is: "172800000" - When TopicCreate 7Day button clicked - Then TopicCreate TimeToRetainData value is: "604800000" - When TopicCreate 4Weeks button clicked - Then TopicCreate TimeToRetainData value is: "2419200000" \ No newline at end of file + Scenario: TopicCreate time to retain data functions + Given Topics is visible + When click on Topics link + Given Topics AddATopic clicked + Given TopicCreate TimeToRetainData input visible is: "true" + Then TopicCreate TimeToRetainData value is: "" + When TopicCreate 12Hours button clicked + Then TopicCreate TimeToRetainData value is: "43200000" + When TopicCreate 1Day button clicked + Then TopicCreate TimeToRetainData value is: "86400000" + When TopicCreate 2Day button clicked + Then TopicCreate TimeToRetainData value is: "172800000" + When TopicCreate 7Day button clicked + Then TopicCreate TimeToRetainData value is: "604800000" + When TopicCreate 4Weeks button clicked + Then TopicCreate TimeToRetainData value is: "2419200000" diff --git a/e2e-playwright/src/features/navigation.feature b/e2e-playwright/src/features/navigation.feature index 1f51ab1ff..645f8e81e 100644 --- a/e2e-playwright/src/features/navigation.feature +++ b/e2e-playwright/src/features/navigation.feature @@ -39,4 +39,4 @@ Feature: Navigation panel links Scenario: Navigate to Dashboard Given Dashboard is visible When click on Dashboard link - Then Dashboard heading visible \ No newline at end of file + Then Dashboard heading visible diff --git a/e2e-playwright/src/helper/browsers/browserManager.ts b/e2e-playwright/src/helper/browsers/browserManager.ts index b51bab645..b30ab8dac 100644 --- a/e2e-playwright/src/helper/browsers/browserManager.ts +++ b/e2e-playwright/src/helper/browsers/browserManager.ts @@ -4,6 +4,7 @@ const options: LaunchOptions = { headless: process.env.HEAD !== "true", args: ['--lang=en-US'], } + export const invokeBrowser = () => { const browserType = process.env.npm_config_BROWSER || "chrome"; diff --git a/e2e-playwright/src/helper/wrapper/PlaywrightWrappers.ts b/e2e-playwright/src/helper/wrapper/PlaywrightWrappers.ts deleted file mode 100644 index e4c420167..000000000 --- a/e2e-playwright/src/helper/wrapper/PlaywrightWrappers.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { Page } from "@playwright/test"; - -export default class PlaywrightWrapper { - - constructor(private page: Page) { } - - async goto(url: string) { - await this.page.goto(url, { - waitUntil: "domcontentloaded" - }); - } - - async waitAndClick(locator: string) { - const element = this.page.locator(locator); - await element.waitFor({ - state: "visible" - }); - await element.click(); - } - - async navigateTo(link: string) { - await Promise.all([ - this.page.waitForNavigation(), - this.page.click(link) - ]) - } - -} \ No newline at end of file diff --git a/e2e-playwright/src/hooks/hooks.ts b/e2e-playwright/src/hooks/hooks.ts index bdefc8124..a5851993a 100644 --- a/e2e-playwright/src/hooks/hooks.ts +++ b/e2e-playwright/src/hooks/hooks.ts @@ -1,16 +1,11 @@ import '../helper/env/env'; -import { BeforeAll, AfterAll, Before, After, Status, setDefaultTimeout } from "@cucumber/cucumber"; -import { Browser, BrowserContext } from "@playwright/test"; -import { stepsContext } from "./pageFixture"; +import { BeforeAll, AfterAll, Before, After, Status, setDefaultTimeout, setWorldConstructor } from "@cucumber/cucumber"; +import { Browser } from "@playwright/test"; import { invokeBrowser } from "../helper/browsers/browserManager"; -import { createLogger } from "winston"; -import { options } from "../helper/util/logger"; import fs from 'fs'; -import { scenarioContext } from "./scenarioContext"; -import { locatorsFactory } from './locatorsFactory'; +import { PlaywrightCustomWorld } from '../support/PlaywrightCustomWorld'; let browser: Browser; -let context: BrowserContext; BeforeAll(async function () { browser = await invokeBrowser(); @@ -18,9 +13,11 @@ BeforeAll(async function () { setDefaultTimeout(60 * 1000); -Before(async function ({ pickle }) { +setWorldConstructor(PlaywrightCustomWorld); + +Before(async function (this: PlaywrightCustomWorld, { pickle }) { const scenarioName = pickle.name + pickle.id - context = await browser.newContext({ + const context = await browser.newContext({ recordVideo: { dir: 'test-results/videos/' }, locale: 'en-US' }); @@ -30,25 +27,19 @@ Before(async function ({ pickle }) { sources: true, screenshots: true, snapshots: true }); - const page = await context.newPage(); - - stepsContext.page = page; - stepsContext.logger = createLogger(options(scenarioName)); - - Object.assign(scenarioContext, locatorsFactory.initAll(page)); + await this.init(context, scenarioName); }); -After({ timeout: 30000 }, async function ({ pickle, result }) { +After({ timeout: 30000 }, async function (this: PlaywrightCustomWorld, { pickle, result }) { let img: Buffer | undefined; const path = `./test-results/trace/${pickle.id}.zip`; - try { if (result?.status === Status.FAILED) { - img = await stepsContext.page.screenshot({ + img = await this.page?.screenshot({ path: `./test-results/screenshots/${pickle.name}.png`, type: "png" }); - const video = stepsContext.page.video(); + const video = this.page?.video(); if (video) { const videoPath = await video.path(); const videoFile = fs.readFileSync(videoPath); @@ -60,19 +51,19 @@ After({ timeout: 30000 }, async function ({ pickle, result }) { } try { - await context.tracing.stop({ path }); + await this.browserContext?.tracing.stop({ path }); } catch (e) { console.error("Error stopping tracing:", e); } try { - await stepsContext.page.close(); + await this.page?.close(); } catch (e) { console.error("Error closing page:", e); } try { - await context.close(); + await this.browserContext?.close(); } catch (e) { console.error("Error closing context:", e); } diff --git a/e2e-playwright/src/hooks/locatorsFactory.ts b/e2e-playwright/src/hooks/locatorsFactory.ts deleted file mode 100644 index 80043dc54..000000000 --- a/e2e-playwright/src/hooks/locatorsFactory.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { Page } from "@playwright/test"; - -import PanelLocators from "../pages/Panel/PanelLocators"; -import BrokersLocators from "../pages/Brokers/BrokersLocators"; -import TopicsLocators from "../pages/Topics/TopicsLocators"; -import TopicCreateLocators from "../pages/Topics/TopicsCreateLocators"; -import ConsumersLocators from "../pages/Consumers/ConsumersLocators"; -import SchemaRegistryLocators from "../pages/SchemaRegistry/SchemaRegistryLocators"; -import ConnectorsLocators from "../pages/Connectors/ConnectorsLocators"; -import ksqlDbLocators from "../pages/KSQLDB/ksqldbLocators"; -import DashboardLocators from "../pages/Dashboard/DashboardLocators"; - -export class locatorsFactory { - static panel(page: Page) { - return new PanelLocators(page); - } - - static brokers(page: Page) { - return new BrokersLocators(page); - } - - static topics(page: Page) { - return new TopicsLocators(page); - } - - static topicsCreate(page: Page) { - return new TopicCreateLocators(page); - } - - static consumers(page: Page) { - return new ConsumersLocators(page); - } - - static schemaRegistry(page: Page) { - return new SchemaRegistryLocators(page); - } - - static connectors(page: Page) { - return new ConnectorsLocators(page); - } - - static ksqlDb(page: Page) { - return new ksqlDbLocators(page); - } - - static dashboard(page: Page) { - return new DashboardLocators(page); - } - - static initAll(page: Page) { - return { - panel: this.panel(page), - brokers: this.brokers(page), - topics: this.topics(page), - topicsCreate: this.topicsCreate(page), - consumers: this.consumers(page), - schemaRegistry: this.schemaRegistry(page), - connectors: this.connectors(page), - ksqlDb: this.ksqlDb(page), - dashboard: this.dashboard(page) - }; - } -} diff --git a/e2e-playwright/src/hooks/pageFixture.ts b/e2e-playwright/src/hooks/pageFixture.ts deleted file mode 100644 index 16333ddca..000000000 --- a/e2e-playwright/src/hooks/pageFixture.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Page } from "@playwright/test"; -import { Logger } from "winston"; - -export const stepsContext = { - // @ts-ignore - page: undefined as Page, - - // @ts-ignore - logger: undefined as Logger, -} \ No newline at end of file diff --git a/e2e-playwright/src/hooks/scenarioContext.ts b/e2e-playwright/src/hooks/scenarioContext.ts deleted file mode 100644 index e9034d82f..000000000 --- a/e2e-playwright/src/hooks/scenarioContext.ts +++ /dev/null @@ -1,23 +0,0 @@ -import PanelLocators from "../pages/Panel/PanelLocators"; -import BrokersLocators from "../pages/Brokers/BrokersLocators"; -import TopicsLocators from "../pages/Topics/TopicsLocators"; -import TopicCreateLocators from "../pages/Topics/TopicsCreateLocators"; -import ConsumersLocators from "../pages/Consumers/ConsumersLocators"; -import SchemaRegistryLocators from "../pages/SchemaRegistry/SchemaRegistryLocators"; -import ConnectorsLocators from "../pages/Connectors/ConnectorsLocators"; -import ksqlDbLocators from "../pages/KSQLDB/ksqldbLocators"; -import DashboardLocators from "../pages/Dashboard/DashboardLocators"; - -export const scenarioContext: Partial<{ - panel: PanelLocators; - brokers: BrokersLocators; - - topics: TopicsLocators; - topicsCreate: TopicCreateLocators; - - consumers: ConsumersLocators; - schemaRegistry: SchemaRegistryLocators; - connectors: ConnectorsLocators; - ksqlDb: ksqlDbLocators; - dashboard: DashboardLocators; -}> = {}; \ No newline at end of file diff --git a/e2e-playwright/src/pages/Locators.ts b/e2e-playwright/src/pages/Locators.ts new file mode 100644 index 000000000..924762740 --- /dev/null +++ b/e2e-playwright/src/pages/Locators.ts @@ -0,0 +1,64 @@ +import { Page } from "@playwright/test"; +import PanelLocators from "./Panel/PanelLocators"; +import BrokersLocators from "./Brokers/BrokersLocators"; +import TopicsLocators from "./Topics/TopicsLocators"; +import TopicCreateLocators from "./Topics/TopicsCreateLocators"; +import ConsumersLocators from "./Consumers/ConsumersLocators"; +import SchemaRegistryLocators from "./SchemaRegistry/SchemaRegistryLocators"; +import ConnectorsLocators from "./Connectors/ConnectorsLocators"; +import ksqlDbLocators from "./KSQLDB/ksqldbLocators"; +import DashboardLocators from "./Dashboard/DashboardLocators"; + +export class Locators { + private readonly page: Page; + + private _panel?: PanelLocators; + private _brokers?: BrokersLocators; + private _topics?: TopicsLocators; + private _topicsCreate?: TopicCreateLocators; + private _consumers?: ConsumersLocators; + private _schemaRegistry?: SchemaRegistryLocators; + private _connectors?: ConnectorsLocators; + private _ksqlDb?: ksqlDbLocators; + private _dashboard?: DashboardLocators; + + constructor(page: Page) { + this.page = page; + } + + get panel() { + return (this._panel ??= new PanelLocators(this.page)); + } + + get brokers() { + return (this._brokers ??= new BrokersLocators(this.page)); + } + + get topics() { + return (this._topics ??= new TopicsLocators(this.page)); + } + + get topicsCreate() { + return (this._topicsCreate ??= new TopicCreateLocators(this.page)); + } + + get consumers() { + return (this._consumers ??= new ConsumersLocators(this.page)); + } + + get schemaRegistry() { + return (this._schemaRegistry ??= new SchemaRegistryLocators(this.page)); + } + + get connectors() { + return (this._connectors ??= new ConnectorsLocators(this.page)); + } + + get ksqlDb() { + return (this._ksqlDb ??= new ksqlDbLocators(this.page)); + } + + get dashboard() { + return (this._dashboard ??= new DashboardLocators(this.page)); + } +} diff --git a/e2e-playwright/src/pages/Panel/PanelLocators.ts b/e2e-playwright/src/pages/Panel/PanelLocators.ts index 05e136167..750e14449 100644 --- a/e2e-playwright/src/pages/Panel/PanelLocators.ts +++ b/e2e-playwright/src/pages/Panel/PanelLocators.ts @@ -7,14 +7,15 @@ export default class PanelLocators{ this.page = page; } - private linkByName = (name: string): Locator => - this.page.getByRole('link', { name }); + linkByName(name: string): Locator{ + return this.page.getByRole('link', { name }); + } - brokersLink = (): Locator => this.linkByName('Brokers'); - topicsLink = (): Locator => this.page.getByTitle('Topics'); - consumersLink = (): Locator => this.linkByName('Consumers'); - schemaRegistryLink = (): Locator => this.linkByName('Schema Registry'); - ksqlDbLink = (): Locator => this.linkByName('KSQL DB'); - getDashboardLink = (): Locator => this.linkByName('Dashboard'); - kafkaConnectLink = (): Locator => this.linkByName('Kafka Connect'); + brokersLink(): Locator { return this.linkByName('Brokers');} + topicsLink(): Locator { return this.page.getByTitle('Topics');} + consumersLink(): Locator { return this.linkByName('Consumers');} + schemaRegistryLink(): Locator { return this.linkByName('Schema Registry');} + ksqlDbLink(): Locator { return this.linkByName('KSQL DB');} + getDashboardLink(): Locator { return this.linkByName('Dashboard');} + kafkaConnectLink(): Locator { return this.linkByName('Kafka Connect');} } \ No newline at end of file diff --git a/e2e-playwright/src/services/commonFunctions.ts b/e2e-playwright/src/services/commonFunctions.ts index 359cf40af..f99fec670 100644 --- a/e2e-playwright/src/services/commonFunctions.ts +++ b/e2e-playwright/src/services/commonFunctions.ts @@ -1,5 +1,4 @@ import { v4 as uuidv4 } from 'uuid'; -import { Locator} from '@playwright/test'; export const generateName = (prefix: string): string => { return `${prefix}-${uuidv4().slice(0, 8)}`; diff --git a/e2e-playwright/src/services/uiHelper.ts b/e2e-playwright/src/services/uiHelper.ts index 2e1ed05ad..a423a6a6b 100644 --- a/e2e-playwright/src/services/uiHelper.ts +++ b/e2e-playwright/src/services/uiHelper.ts @@ -1,7 +1,7 @@ import { Locator } from '@playwright/test'; import expect from "../helper/util/expect"; -export const expectVisibility = async (locator: Locator, visibleString: string): Promise => { + export const expectVisibility = async (locator: Locator, visibleString: string): Promise => { if (visibleString === "true") { await expect(locator).toBeVisible(); } else { diff --git a/e2e-playwright/src/steps/Topics.steps.ts b/e2e-playwright/src/steps/Topics.steps.ts index 3b7cf52b2..bfa77eb4b 100644 --- a/e2e-playwright/src/steps/Topics.steps.ts +++ b/e2e-playwright/src/steps/Topics.steps.ts @@ -1,72 +1,72 @@ import { Given, When, Then, setDefaultTimeout } from "@cucumber/cucumber"; import { expect } from "@playwright/test"; -import { scenarioContext } from "../hooks/scenarioContext"; import { expectVisibility, ensureCheckboxState } from "../services/uiHelper"; +import { PlaywrightCustomWorld } from "../support/PlaywrightCustomWorld"; setDefaultTimeout(60 * 1000 * 2); -Given('Topics Serchfield visible', async () => { - await expect(scenarioContext.topics!.topicSearchField()).toBeVisible(); +Given('Topics Serchfield visible', async function (this: PlaywrightCustomWorld) { + await expect(this.locators.topics.topicSearchField()).toBeVisible(); }); -Given('Topics ShowInternalTopics visible', async () => { - await expect(scenarioContext.topics!.topicShowInternalTopics()).toBeVisible(); +Given('Topics ShowInternalTopics visible', async function (this: PlaywrightCustomWorld) { + await expect(this.locators.topics.topicShowInternalTopics()).toBeVisible(); }); -Given('Topics AddATopic visible', async () => { - await expect(scenarioContext.topics!.topicAddTopicButton()).toBeVisible(); +Given('Topics AddATopic visible', async function (this: PlaywrightCustomWorld) { + await expect(this.locators.topics.topicAddTopicButton()).toBeVisible(); }); -Given('Topics DeleteSelectedTopics active is: {string}', async (state: string) => { - const isEnabled = await scenarioContext.topics!.topicDeleteSelectedTopicsButton().isEnabled(); +Given('Topics DeleteSelectedTopics active is: {string}', async function (this: PlaywrightCustomWorld, state: string) { + const isEnabled = await this.locators.topics.topicDeleteSelectedTopicsButton().isEnabled(); expect(isEnabled.toString()).toBe(state); }); -Given('Topics CopySelectedTopic active is: {string}', async (state: string) => { - const isEnabled = await scenarioContext.topics!.topicCopySelectedTopicButton().isEnabled(); +Given('Topics CopySelectedTopic active is: {string}', async function (this: PlaywrightCustomWorld, state: string) { + const isEnabled = await this.locators.topics.topicCopySelectedTopicButton().isEnabled(); expect(isEnabled.toString()).toBe(state); }); -Given('Topics PurgeMessagesOfSelectedTopics active is: {string}', async (state: string) => { - const isEnabled = await scenarioContext.topics!.topicPurgeMessagesOfSelectedTopicsButton().isEnabled(); +Given('Topics PurgeMessagesOfSelectedTopics active is: {string}', async function (this: PlaywrightCustomWorld, state: string) { + const isEnabled = await this.locators.topics.topicPurgeMessagesOfSelectedTopicsButton().isEnabled(); expect(isEnabled.toString()).toBe(state); }); -When('Topic SelectAllTopic visible is: {string}', async (visible: string) => { - await expectVisibility(scenarioContext.topics!.topicSelectAllCheckBox(), visible); +When('Topic SelectAllTopic visible is: {string}', async function (this: PlaywrightCustomWorld, visible: string) { + await expectVisibility(this.locators.topics.topicSelectAllCheckBox(), visible); }); -Then('Topic SelectAllTopic checked is: {string}', async (state: string) => { - const checkbox = scenarioContext.topics!.topicSelectAllCheckBox(); +Then('Topic SelectAllTopic checked is: {string}', async function (this: PlaywrightCustomWorld, state: string) { + const checkbox = this.locators.topics.topicSelectAllCheckBox(); await ensureCheckboxState(checkbox, state); const actual = await checkbox.isChecked(); expect(actual.toString()).toBe(state); }); -When('Topics serchfield input {string}', async (topicName: string) => { - const textBox = scenarioContext.topics!.topicSearchField(); +When('Topics serchfield input {string}', async function (this: PlaywrightCustomWorld, topicName: string) { + const textBox = this.locators.topics.topicSearchField(); await textBox.fill(topicName); const actual = await textBox.inputValue(); expect(actual).toBe(topicName); }); -Then('Topic named: {string} visible is: {string}', async (topicName: string, visible: string) => { - await expectVisibility(scenarioContext.topics!.topicNameLink(topicName), visible); +Then('Topic named: {string} visible is: {string}', async function (this: PlaywrightCustomWorld, topicName: string, visible: string) { + await expectVisibility(this.locators.topics.topicNameLink(topicName), visible); }); -When('Topic serchfield input cleared', async () => { - const textBox = scenarioContext.topics!.topicSearchField(); +When('Topic serchfield input cleared', async function (this: PlaywrightCustomWorld) { + const textBox = this.locators.topics.topicSearchField(); await textBox.fill(''); const text = await textBox.inputValue(); expect(text).toBe(''); }); -When('Topics ShowInternalTopics switched is: {string}', async (state: string) => { - const checkBox = scenarioContext.topics!.topicShowInternalTopics(); +When('Topics ShowInternalTopics switched is: {string}', async function (this: PlaywrightCustomWorld, state: string) { + const checkBox = this.locators.topics.topicShowInternalTopics(); await ensureCheckboxState(checkBox, state); }); -When('Topic row named: {string} checked is: {string}', async (topicName: string, state: string) => { - const checkbox = scenarioContext.topics!.topicRowCheckBox(topicName); +When('Topic row named: {string} checked is: {string}', async function (this: PlaywrightCustomWorld, topicName: string, state: string) { + const checkbox = this.locators.topics.topicRowCheckBox(topicName); await ensureCheckboxState(checkbox, state); -}); \ No newline at end of file +}); diff --git a/e2e-playwright/src/steps/TopicsCreate.steps.ts b/e2e-playwright/src/steps/TopicsCreate.steps.ts index 4cd975b71..33e7837b5 100644 --- a/e2e-playwright/src/steps/TopicsCreate.steps.ts +++ b/e2e-playwright/src/steps/TopicsCreate.steps.ts @@ -1,138 +1,136 @@ import { Given, When, Then, setDefaultTimeout } from "@cucumber/cucumber"; -import { scenarioContext } from "../hooks/scenarioContext"; -import { stepsContext } from "../hooks/pageFixture"; +import { expect } from "@playwright/test"; +import { PlaywrightCustomWorld } from "../support/PlaywrightCustomWorld"; import { expectVisibility } from "../services/uiHelper"; -import { CustomWorld } from "../support/customWorld"; import { generateName } from "../services/commonFunctions"; -import expect from "../helper/util/expect"; setDefaultTimeout(60 * 1000 * 2); -Given('Topics AddATopic clicked', async () => { - const button = scenarioContext.topics!.topicAddTopicButton(); +Given('Topics AddATopic clicked', async function (this: PlaywrightCustomWorld) { + const button = this.locators.topics.topicAddTopicButton(); await expect(button).toBeVisible(); await button.click(); }); -Given('TopicCreate heading visible is: {string}', async (visible: string) => { - await expectVisibility(scenarioContext.topicsCreate!.topicsCreateHeading(), visible); +Given('TopicCreate heading visible is: {string}', async function (this: PlaywrightCustomWorld, visible: string) { + await expectVisibility(this.locators.topicsCreate.topicsCreateHeading(), visible); }); -Given('TopicCreate TopicName input visible is: {string}', async (visible: string) => { - await expectVisibility(scenarioContext.topicsCreate!.topicsCreateTopicName(), visible); +Given('TopicCreate TopicName input visible is: {string}', async function (this: PlaywrightCustomWorld, visible: string) { + await expectVisibility(this.locators.topicsCreate.topicsCreateTopicName(), visible); }); -Given('TopicCreate NumberOfPartitions input visible is: {string}', async (visible: string) => { - await expectVisibility(scenarioContext.topicsCreate!.topicsCreateNumberOfPartitions(), visible); +Given('TopicCreate NumberOfPartitions input visible is: {string}', async function (this: PlaywrightCustomWorld, visible: string) { + await expectVisibility(this.locators.topicsCreate.topicsCreateNumberOfPartitions(), visible); }); -Given('TopicCreate CleanupPolicy select visible is: {string}', async (visible: string) => { - await expectVisibility(scenarioContext.topicsCreate!.topicsCreateCleanupPolicy(), visible); +Given('TopicCreate CleanupPolicy select visible is: {string}', async function (this: PlaywrightCustomWorld, visible: string) { + await expectVisibility(this.locators.topicsCreate.topicsCreateCleanupPolicy(), visible); }); -Given('TopicCreate MinInSyncReplicas input visible is: {string}', async (visible: string) => { - await expectVisibility(scenarioContext.topicsCreate!.topicsCreateMinInSyncReplicas(), visible); +Given('TopicCreate MinInSyncReplicas input visible is: {string}', async function (this: PlaywrightCustomWorld, visible: string) { + await expectVisibility(this.locators.topicsCreate.topicsCreateMinInSyncReplicas(), visible); }); -Given('TopicCreate ReplicationFactor input visible is: {string}', async (visible: string) => { - await expectVisibility(scenarioContext.topicsCreate!.topicsCreateReplicationFactor(), visible); +Given('TopicCreate ReplicationFactor input visible is: {string}', async function (this: PlaywrightCustomWorld, visible: string) { + await expectVisibility(this.locators.topicsCreate.topicsCreateReplicationFactor(), visible); }); -Given('TopicCreate TimeToRetainData input visible is: {string}', async (visible: string) => { - await expectVisibility(scenarioContext.topicsCreate!.topicsCreateTimeToRetainData(), visible); +Given('TopicCreate TimeToRetainData input visible is: {string}', async function (this: PlaywrightCustomWorld, visible: string) { + await expectVisibility(this.locators.topicsCreate.topicsCreateTimeToRetainData(), visible); }); -Given('TopicCreate 12Hours button visible is: {string}', async (visible: string) => { - await expectVisibility(scenarioContext.topicsCreate!.topicsCreate12Hours(), visible); +Given('TopicCreate 12Hours button visible is: {string}', async function (this: PlaywrightCustomWorld, visible: string) { + await expectVisibility(this.locators.topicsCreate.topicsCreate12Hours(), visible); }); -Given('TopicCreate 1Day button visible is: {string}', async (visible: string) => { - await expectVisibility(scenarioContext.topicsCreate!.topicsCreate1Day(), visible); +Given('TopicCreate 1Day button visible is: {string}', async function (this: PlaywrightCustomWorld, visible: string) { + await expectVisibility(this.locators.topicsCreate.topicsCreate1Day(), visible); }); -Given('TopicCreate 2Day button visible is: {string}', async (visible: string) => { - await expectVisibility(scenarioContext.topicsCreate!.topicsCreate2Day(), visible); +Given('TopicCreate 2Day button visible is: {string}', async function (this: PlaywrightCustomWorld, visible: string) { + await expectVisibility(this.locators.topicsCreate.topicsCreate2Day(), visible); }); -Given('TopicCreate 7Day button visible is: {string}', async (visible: string) => { - await expectVisibility(scenarioContext.topicsCreate!.topicsCreate7Day(), visible); +Given('TopicCreate 7Day button visible is: {string}', async function (this: PlaywrightCustomWorld, visible: string) { + await expectVisibility(this.locators.topicsCreate.topicsCreate7Day(), visible); }); -Given('TopicCreate 4Weeks button visible is: {string}', async (visible: string) => { - await expectVisibility(scenarioContext.topicsCreate!.topicsCreate4Weeks(), visible); +Given('TopicCreate 4Weeks button visible is: {string}', async function (this: PlaywrightCustomWorld, visible: string) { + await expectVisibility(this.locators.topicsCreate.topicsCreate4Weeks(), visible); }); -Given('TopicCreate MaxPartitionSize select visible is: {string}', async (visible: string) => { - await expectVisibility(scenarioContext.topicsCreate!.topicsCreateMaxPartitionSize(), visible); +Given('TopicCreate MaxPartitionSize select visible is: {string}', async function (this: PlaywrightCustomWorld, visible: string) { + await expectVisibility(this.locators.topicsCreate.topicsCreateMaxPartitionSize(), visible); }); -Given('TopicCreate MaxMessageSize input visible is: {string}', async (visible: string) => { - await expectVisibility(scenarioContext.topicsCreate!.topicsCreateMaxMessageSize(), visible); +Given('TopicCreate MaxMessageSize input visible is: {string}', async function (this: PlaywrightCustomWorld, visible: string) { + await expectVisibility(this.locators.topicsCreate.topicsCreateMaxMessageSize(), visible); }); -Given('TopicCreate AddCustomParameter button visible is: {string}', async (visible: string) => { - await expectVisibility(scenarioContext.topicsCreate!.topicsCreateAddCustomParameter(), visible); +Given('TopicCreate AddCustomParameter button visible is: {string}', async function (this: PlaywrightCustomWorld, visible: string) { + await expectVisibility(this.locators.topicsCreate.topicsCreateAddCustomParameter(), visible); }); -Given('TopicCreate Cancel button visible is: {string}', async (visible: string) => { - await expectVisibility(scenarioContext.topicsCreate!.topicsCreateCancel(), visible); +Given('TopicCreate Cancel button visible is: {string}', async function (this: PlaywrightCustomWorld, visible: string) { + await expectVisibility(this.locators.topicsCreate.topicsCreateCancel(), visible); }); -Given('TopicCreate CreateTopic button visible is: {string}', async (visible: string) => { - await expectVisibility(scenarioContext.topicsCreate!.topicCreateCreateTopicButton(), visible); +Given('TopicCreate CreateTopic button visible is: {string}', async function (this: PlaywrightCustomWorld, visible: string) { + await expectVisibility(this.locators.topicsCreate.topicCreateCreateTopicButton(), visible); }); -When('TopicCreate Topic name starts with: {string}', async function (this: CustomWorld, prefix: string) { +When('TopicCreate Topic name starts with: {string}', async function (this: PlaywrightCustomWorld, prefix: string) { const topicName = generateName(prefix); this.setValue(`topicName-${prefix}`, topicName); - await scenarioContext.topicsCreate!.topicsCreateTopicName().fill(topicName); + await this.locators.topicsCreate.topicsCreateTopicName().fill(topicName); }); -When('TopicCreate Number of partitons: {int}', async function (this: CustomWorld, count: number) { - await scenarioContext.topicsCreate!.topicsCreateNumberOfPartitions().fill(count.toString()); +When('TopicCreate Number of partitons: {int}', async function (this: PlaywrightCustomWorld, count: number) { + await this.locators.topicsCreate.topicsCreateNumberOfPartitions().fill(count.toString()); }); -When('TopicCreate Time to retain data one day', async function () { - await scenarioContext.topicsCreate!.topicsCreate1Day().click(); +When('TopicCreate Time to retain data one day', async function (this: PlaywrightCustomWorld) { + await this.locators.topicsCreate.topicsCreate1Day().click(); }); -When('TopicCreate Create topic clicked', async function () { - await scenarioContext.topicsCreate!.topicCreateCreateTopicButton().click(); +When('TopicCreate Create topic clicked', async function (this: PlaywrightCustomWorld) { + await this.locators.topicsCreate.topicCreateCreateTopicButton().click(); }); -Then('Header starts with: {string}', async function (this: CustomWorld, prefix: string) { +Then('Header starts with: {string}', async function (this: PlaywrightCustomWorld, prefix: string) { const topicName = this.getValue(`topicName-${prefix}`); - const header = stepsContext.page.getByRole('heading', { name: topicName }); + const header = this.page.getByRole('heading', { name: topicName }); await expect(header).toBeVisible(); }); -Then('Topic name started with: {string} visible is: {string}', async function (this: CustomWorld, prefix: string, visible: string) { +Then('Topic name started with: {string} visible is: {string}', async function (this: PlaywrightCustomWorld, prefix: string, visible: string) { const topicName = this.getValue(`topicName-${prefix}`); - await expectVisibility(scenarioContext.topics!.topicNameLink(topicName), visible); + await expectVisibility(this.locators.topics.topicNameLink(topicName), visible); }); -Then('TopicCreate TimeToRetainData value is: {string}', async (expectedValue: string) => { - const input = scenarioContext.topicsCreate!.topicsCreateTimeToRetainData(); +Then('TopicCreate TimeToRetainData value is: {string}', async function (this: PlaywrightCustomWorld, expectedValue: string) { + const input = this.locators.topicsCreate.topicsCreateTimeToRetainData(); const actualValue = await input.inputValue(); expect(actualValue).toBe(expectedValue); }); -When('TopicCreate 12Hours button clicked', async () => { - await scenarioContext.topicsCreate!.topicsCreate12Hours().click(); +When('TopicCreate 12Hours button clicked', async function (this: PlaywrightCustomWorld) { + await this.locators.topicsCreate.topicsCreate12Hours().click(); }); -When('TopicCreate 1Day button clicked', async () => { - await scenarioContext.topicsCreate!.topicsCreate1Day().click(); +When('TopicCreate 1Day button clicked', async function (this: PlaywrightCustomWorld) { + await this.locators.topicsCreate.topicsCreate1Day().click(); }); -When('TopicCreate 2Day button clicked', async () => { - await scenarioContext.topicsCreate!.topicsCreate2Day().click(); +When('TopicCreate 2Day button clicked', async function (this: PlaywrightCustomWorld) { + await this.locators.topicsCreate.topicsCreate2Day().click(); }); -When('TopicCreate 7Day button clicked', async () => { - await scenarioContext.topicsCreate!.topicsCreate7Day().click(); +When('TopicCreate 7Day button clicked', async function (this: PlaywrightCustomWorld) { + await this.locators.topicsCreate.topicsCreate7Day().click(); }); -When('TopicCreate 4Weeks button clicked', async () => { - await scenarioContext.topicsCreate!.topicsCreate4Weeks().click(); +When('TopicCreate 4Weeks button clicked', async function (this: PlaywrightCustomWorld) { + await this.locators.topicsCreate.topicsCreate4Weeks().click(); }); diff --git a/e2e-playwright/src/steps/navigation.steps.ts b/e2e-playwright/src/steps/navigation.steps.ts index b55b32d37..c6f5584da 100644 --- a/e2e-playwright/src/steps/navigation.steps.ts +++ b/e2e-playwright/src/steps/navigation.steps.ts @@ -1,109 +1,108 @@ import { Given, When, Then, setDefaultTimeout } from "@cucumber/cucumber"; -import { stepsContext } from "../hooks/pageFixture"; import expect from "../helper/util/expect"; -import { scenarioContext } from "../hooks/scenarioContext"; +import { PlaywrightCustomWorld } from "../support/PlaywrightCustomWorld"; -setDefaultTimeout(60 * 1000 * 2); +setDefaultTimeout(60 * 1000 * 2); -Given('Brokers is visible', async () => { - await stepsContext.page.goto(process.env.BASEURL!); - await expect(scenarioContext.panel!.brokersLink()).toBeVisible(); +Given('Brokers is visible', async function (this: PlaywrightCustomWorld) { + await this.page.goto(process.env.BASEURL!); + await expect(this.locators.panel.brokersLink()).toBeVisible(); }); -When('click on Brokers link', async () => { - await scenarioContext.panel!.brokersLink().click(); +When('click on Brokers link', async function (this: PlaywrightCustomWorld) { + await this.locators.panel.brokersLink().click(); }); -Then('Brokers heading visible', async () => { - await scenarioContext.brokers!.brokersHeading().waitFor({ state: 'visible' }); +Then('Brokers heading visible', async function (this: PlaywrightCustomWorld) { + await this.locators.brokers.brokersHeading().waitFor({ state: 'visible' }); }); -Given('Topics is visible', async () => { - await stepsContext.page.goto(process.env.BASEURL!); - await expect(scenarioContext.panel!.topicsLink()).toBeVisible(); +Given('Topics is visible', async function (this: PlaywrightCustomWorld) { + await this.page.goto(process.env.BASEURL!); + await expect(this.locators.panel.topicsLink()).toBeVisible(); }); -When('click on Topics link', async () => { - await scenarioContext.panel!.topicsLink().click(); +When('click on Topics link', async function (this: PlaywrightCustomWorld) { + await this.locators.panel.topicsLink().click(); }); -Then('Topics heading visible', async () => { - await scenarioContext.topics!.topicsHeading().waitFor({ state: 'visible' }); +Then('Topics heading visible', async function (this: PlaywrightCustomWorld) { + await this.locators.topics.topicsHeading().waitFor({ state: 'visible' }); }); -Given('Consumers is visible', async () => { - await stepsContext.page.goto(process.env.BASEURL!); - await expect(scenarioContext.panel!.consumersLink()).toBeVisible(); +Given('Consumers is visible', async function (this: PlaywrightCustomWorld) { + await this.page.goto(process.env.BASEURL!); + await expect(this.locators.panel.consumersLink()).toBeVisible(); }); -When('click on Consumers link', async () => { - await scenarioContext.panel!.consumersLink().click(); +When('click on Consumers link', async function (this: PlaywrightCustomWorld) { + await this.locators.panel.consumersLink().click(); }); -Then('Consumers heading visible', async () => { - await scenarioContext.consumers!.consumersHeading().waitFor({ state: 'visible' }); +Then('Consumers heading visible', async function (this: PlaywrightCustomWorld) { + await this.locators.consumers.consumersHeading().waitFor({ state: 'visible' }); }); -Given('Schema Registry is visible', async () => { - await stepsContext.page.goto(process.env.BASEURL!); - await expect(scenarioContext.panel!.schemaRegistryLink()).toBeVisible(); +Given('Schema Registry is visible', async function (this: PlaywrightCustomWorld) { + await this.page.goto(process.env.BASEURL!); + await expect(this.locators.panel.schemaRegistryLink()).toBeVisible(); }); -When('click on Schema Registry link', async () => { - await scenarioContext.panel!.schemaRegistryLink().click(); +When('click on Schema Registry link', async function (this: PlaywrightCustomWorld) { + await this.locators.panel.schemaRegistryLink().click(); }); -Then('Schema Registry heading visible', async () => { - await scenarioContext.schemaRegistry!.schemaRegistryHeading().waitFor({ state: 'visible' }); +Then('Schema Registry heading visible', async function (this: PlaywrightCustomWorld) { + await this.locators.schemaRegistry.schemaRegistryHeading().waitFor({ state: 'visible' }); }); -Given('Kafka Connect is visible', async () => { - await stepsContext.page.goto(process.env.BASEURL!); - await expect(scenarioContext.panel!.kafkaConnectLink()).toBeVisible(); +Given('Kafka Connect is visible', async function (this: PlaywrightCustomWorld) { + await this.page.goto(process.env.BASEURL!); + await expect(this.locators.panel.kafkaConnectLink()).toBeVisible(); }); -When('click on Kafka Connect link', async () => { - await scenarioContext.panel!.kafkaConnectLink().click(); +When('click on Kafka Connect link', async function (this: PlaywrightCustomWorld) { + await this.locators.panel.kafkaConnectLink().click(); }); -Then('Kafka Connect heading visible', async () => { - await scenarioContext.connectors!.connectorsHeading().waitFor({ state: 'visible' }); +Then('Kafka Connect heading visible', async function (this: PlaywrightCustomWorld) { + await this.locators.connectors.connectorsHeading().waitFor({ state: 'visible' }); }); -Given('KSQL DB is visible', async () => { - await stepsContext.page.goto(process.env.BASEURL!); - await expect(scenarioContext.panel!.ksqlDbLink()).toBeVisible(); +Given('KSQL DB is visible', async function (this: PlaywrightCustomWorld) { + await this.page.goto(process.env.BASEURL!); + await expect(this.locators.panel.ksqlDbLink()).toBeVisible(); }); -When('click on KSQL DB link', async () => { - await scenarioContext.panel!.ksqlDbLink().click(); +When('click on KSQL DB link', async function (this: PlaywrightCustomWorld) { + await this.locators.panel.ksqlDbLink().click(); }); -Then('KSQL DB heading visible', async () => { - await scenarioContext.ksqlDb!.ksqlDbHeading().waitFor({ state: 'visible' }); +Then('KSQL DB heading visible', async function (this: PlaywrightCustomWorld) { + await this.locators.ksqlDb.ksqlDbHeading().waitFor({ state: 'visible' }); }); -Given('Dashboard is visible', async () => { - await stepsContext.page.goto(process.env.BASEURL!); - await expect(scenarioContext.panel!.getDashboardLink()).toBeVisible(); +Given('Dashboard is visible', async function (this: PlaywrightCustomWorld) { + await this.page.goto(process.env.BASEURL!); + await expect(this.locators.panel.getDashboardLink()).toBeVisible(); }); -When('click on Dashboard link', async () => { - const dashboard = scenarioContext.panel!.getDashboardLink(); - await dashboard.isVisible(); +When('click on Dashboard link', async function (this: PlaywrightCustomWorld) { + const dashboard = this.locators.panel.getDashboardLink(); + await dashboard.isVisible(); // Optional: could be removed if already handled in expect above await dashboard.click(); }); -Then('Dashboard heading visible', async () => { - await scenarioContext.dashboard!.dashboardHeading().waitFor({ state: 'visible' }); +Then('Dashboard heading visible', async function (this: PlaywrightCustomWorld) { + await this.locators.dashboard.dashboardHeading().waitFor({ state: 'visible' }); }); -Then('the end of current URL should be {string}', async (expected: string) => { - const actual = new URL(stepsContext.page.url()).pathname; +Then('the end of current URL should be {string}', async function (this: PlaywrightCustomWorld, expected: string) { + const actual = new URL(this.page.url()).pathname; expect(actual.endsWith(expected)).toBeTruthy(); }); -Then('the part of current URL should be {string}', async (expected: string) => { - const actual = new URL(stepsContext.page.url()).pathname; +Then('the part of current URL should be {string}', async function (this: PlaywrightCustomWorld, expected: string) { + const actual = new URL(this.page.url()).pathname; expect(actual.includes(expected)).toBeTruthy(); }); \ No newline at end of file diff --git a/e2e-playwright/src/support/PlaywrightCustomWorld.ts b/e2e-playwright/src/support/PlaywrightCustomWorld.ts new file mode 100644 index 000000000..8495fdfca --- /dev/null +++ b/e2e-playwright/src/support/PlaywrightCustomWorld.ts @@ -0,0 +1,63 @@ +import { IWorldOptions, World } from '@cucumber/cucumber'; +import { Page } from "@playwright/test"; +import { Logger } from "winston"; +import { BrowserContext } from "@playwright/test"; +import { createLogger } from "winston"; +import { options } from "../helper/util/logger"; +import { Locators } from '../pages/Locators'; + +export class PlaywrightCustomWorld extends World { + + public logger?: Logger; + public browserContext?: BrowserContext; + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + private context: Map = new Map(); + private _page?: Page; + private _locators?:Locators; + private _scenarioName?: string; + + constructor(options: IWorldOptions) { + super(options); + } + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + setValue(key: string, value: any) { + this.context.set(key, value); + } + + getValue(key: string): T { + const value = this.context.get(key); + if (value === undefined) throw new Error(`Key '${key}' not found in context.`); + return value as T; + } + + async init(context: BrowserContext, scenarioName:string ){ + const page = await context.newPage(); + + this._page = page; + this.logger = createLogger(options(scenarioName)); + this._scenarioName = scenarioName; + this.browserContext = context; + } + + get page() : Page { + if (this._page) { + return this._page!; + } + + throw new Error("No page"); + } + + get locators() : Locators { + return (this._locators ??= new Locators(this.page)); + } + + get scenarioName(): string { + return this._scenarioName ?? "No Name"; + } + + clear() { + this.context.clear(); + } +} diff --git a/e2e-playwright/src/support/customWorld.ts b/e2e-playwright/src/support/customWorld.ts deleted file mode 100644 index 764623bcb..000000000 --- a/e2e-playwright/src/support/customWorld.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { IWorldOptions, setWorldConstructor, World } from '@cucumber/cucumber'; - -export class CustomWorld extends World { - private context: Map = new Map(); - - constructor(options: IWorldOptions) { - super(options); - } - - setValue(key: string, value: any) { - this.context.set(key, value); - } - - getValue(key: string): T { - const value = this.context.get(key); - if (value === undefined) throw new Error(`Key '${key}' not found in context.`); - return value as T; - } - - clear() { - this.context.clear(); - } -} - -setWorldConstructor(CustomWorld); \ No newline at end of file From 90150a566b66167b12dfeecdded66752beb41741 Mon Sep 17 00:00:00 2001 From: AspidDark Date: Thu, 22 May 2025 22:51:57 +0300 Subject: [PATCH 03/14] eslint --- e2e-playwright/.eslintignore | 4 ++ e2e-playwright/config/cucumber.js | 1 + e2e-playwright/eslint.config.js | 38 +++++++++--- e2e-playwright/src/helper/types/env.d.ts | 1 + e2e-playwright/src/helper/wrapper/assert.ts | 3 +- e2e-playwright/src/hooks/hooks.ts | 10 ++-- e2e-playwright/src/pages/BaseLocators.ts | 1 + .../src/pages/Brokers/BrokersLocators.ts | 2 +- .../pages/Connectors/ConnectorsLocators.ts | 2 +- .../src/pages/Consumers/ConsumersLocators.ts | 2 +- .../src/pages/Dashboard/DashboardLocators.ts | 2 +- .../src/pages/KSQLDB/ksqldbLocators.ts | 2 +- .../src/pages/Panel/PanelLocators.ts | 6 +- .../SchemaRegistry/SchemaRegistryLocators.ts | 2 +- .../src/pages/Topics/TopicsCreateLocators.ts | 2 +- .../src/pages/Topics/TopicsLocators.ts | 2 +- e2e-playwright/{ => src}/playwright.config.ts | 2 + e2e-playwright/src/services/uiHelper.ts | 4 +- e2e-playwright/src/steps/Topics.steps.ts | 28 ++++----- .../src/steps/TopicsCreate.steps.ts | 60 +++++++++---------- e2e-playwright/src/steps/navigation.steps.ts | 50 ++++++++-------- .../src/support/PlaywrightCustomWorld.ts | 8 +-- e2e-playwright/tsconfig.json | 2 +- 23 files changed, 132 insertions(+), 102 deletions(-) create mode 100644 e2e-playwright/.eslintignore rename e2e-playwright/{ => src}/playwright.config.ts (98%) diff --git a/e2e-playwright/.eslintignore b/e2e-playwright/.eslintignore new file mode 100644 index 000000000..d15f86d1c --- /dev/null +++ b/e2e-playwright/.eslintignore @@ -0,0 +1,4 @@ +cucumber.js +init.ts +playwright.config.ts +env.d.ts \ No newline at end of file diff --git a/e2e-playwright/config/cucumber.js b/e2e-playwright/config/cucumber.js index 339a10de9..7213fd230 100644 --- a/e2e-playwright/config/cucumber.js +++ b/e2e-playwright/config/cucumber.js @@ -1,3 +1,4 @@ +/* eslint-disable */ module.exports = { default: { timeout: 30000, diff --git a/e2e-playwright/eslint.config.js b/e2e-playwright/eslint.config.js index d86c9b1e9..6499b4df1 100644 --- a/e2e-playwright/eslint.config.js +++ b/e2e-playwright/eslint.config.js @@ -1,12 +1,36 @@ +import { defineConfig } from "eslint/config"; import js from "@eslint/js"; import globals from "globals"; import tseslint from "typescript-eslint"; -import { defineConfig } from "eslint/config"; - export default defineConfig([ - { files: ["**/*.{js,mjs,cjs,ts,mts,cts}"], plugins: { js }, extends: ["js/recommended"] }, - { files: ["**/*.{js,mjs,cjs,ts,mts,cts}"], languageOptions: { globals: globals.browser } }, - { files: ["**/*.{ts,tsx}"], ...tseslint.configs.recommendedTypeChecked, languageOptions: { parserOptions: {project: "./tsconfig.json" } } }, - tseslint.configs.recommended, -]); + js.configs.recommended, + { + files: ["**/*.{ts,tsx}"], + languageOptions: { + parser: tseslint.parser, + parserOptions: { + project: "./tsconfig.json", + }, + globals: { + ...globals.node, + ...globals.browser, + }, + }, + plugins: { + "@typescript-eslint": tseslint.plugin, + }, + rules: { + "no-trailing-spaces": "error", + "no-multiple-empty-lines": ["error", { max: 1 }], + "semi-spacing": ["error", { before: false, after: true }], + "keyword-spacing": ["error", { before: true, after: true }], + "space-infix-ops": "error", + "space-before-blocks": "error", + "space-before-function-paren": ["error", "never"], + "object-curly-spacing": ["error", "always"], + "array-bracket-spacing": ["error", "never"], + 'no-invalid-this': 'off', + }, + }, +]); \ No newline at end of file diff --git a/e2e-playwright/src/helper/types/env.d.ts b/e2e-playwright/src/helper/types/env.d.ts index fa60884f3..3a68e3f66 100644 --- a/e2e-playwright/src/helper/types/env.d.ts +++ b/e2e-playwright/src/helper/types/env.d.ts @@ -1,3 +1,4 @@ +/* eslint-disable */ export { }; declare global { diff --git a/e2e-playwright/src/helper/wrapper/assert.ts b/e2e-playwright/src/helper/wrapper/assert.ts index 272351752..409912e1d 100644 --- a/e2e-playwright/src/helper/wrapper/assert.ts +++ b/e2e-playwright/src/helper/wrapper/assert.ts @@ -2,7 +2,7 @@ import { Page } from "@playwright/test"; import expect from "../util/expect"; export default class Assert { - +// eslint-disable-next-line no-unused-vars constructor(private page: Page) { } async assertTitle(title: string) { @@ -22,5 +22,4 @@ export default class Assert { const pageURL = this.page.url(); expect(pageURL).toContain(title); } - } diff --git a/e2e-playwright/src/hooks/hooks.ts b/e2e-playwright/src/hooks/hooks.ts index a5851993a..8573d51c5 100644 --- a/e2e-playwright/src/hooks/hooks.ts +++ b/e2e-playwright/src/hooks/hooks.ts @@ -7,7 +7,7 @@ import { PlaywrightCustomWorld } from '../support/PlaywrightCustomWorld'; let browser: Browser; -BeforeAll(async function () { +BeforeAll(async function() { browser = await invokeBrowser(); }); @@ -15,7 +15,7 @@ setDefaultTimeout(60 * 1000); setWorldConstructor(PlaywrightCustomWorld); -Before(async function (this: PlaywrightCustomWorld, { pickle }) { +Before(async function(this: PlaywrightCustomWorld, { pickle }) { const scenarioName = pickle.name + pickle.id const context = await browser.newContext({ recordVideo: { dir: 'test-results/videos/' }, @@ -30,8 +30,8 @@ Before(async function (this: PlaywrightCustomWorld, { pickle }) { await this.init(context, scenarioName); }); -After({ timeout: 30000 }, async function (this: PlaywrightCustomWorld, { pickle, result }) { - let img: Buffer | undefined; +After({ timeout: 30000 }, async function(this: PlaywrightCustomWorld, { pickle, result }) { + let img: Buffer | undefined; const path = `./test-results/trace/${pickle.id}.zip`; try { if (result?.status === Status.FAILED) { @@ -80,6 +80,6 @@ After({ timeout: 30000 }, async function (this: PlaywrightCustomWorld, { pickle, } }); -AfterAll(async function () { +AfterAll(async function() { await browser.close(); }) diff --git a/e2e-playwright/src/pages/BaseLocators.ts b/e2e-playwright/src/pages/BaseLocators.ts index 77e290087..980f7a984 100644 --- a/e2e-playwright/src/pages/BaseLocators.ts +++ b/e2e-playwright/src/pages/BaseLocators.ts @@ -1,6 +1,7 @@ import { Locator, Page } from '@playwright/test'; export class BaseLocators { + // eslint-disable-next-line no-unused-vars constructor(private page: Page) {} loadingSpinner:Locator = this.page.locator('div[role="progressbar"]'); diff --git a/e2e-playwright/src/pages/Brokers/BrokersLocators.ts b/e2e-playwright/src/pages/Brokers/BrokersLocators.ts index eddd69207..50bd5d2b6 100644 --- a/e2e-playwright/src/pages/Brokers/BrokersLocators.ts +++ b/e2e-playwright/src/pages/Brokers/BrokersLocators.ts @@ -1,6 +1,6 @@ import { Page, Locator } from "@playwright/test"; -export default class BrokersLocators{ +export default class BrokersLocators { private readonly page: Page; constructor(page: Page) { diff --git a/e2e-playwright/src/pages/Connectors/ConnectorsLocators.ts b/e2e-playwright/src/pages/Connectors/ConnectorsLocators.ts index 7a014eb73..d372bfbb9 100644 --- a/e2e-playwright/src/pages/Connectors/ConnectorsLocators.ts +++ b/e2e-playwright/src/pages/Connectors/ConnectorsLocators.ts @@ -1,6 +1,6 @@ import { Page, Locator } from "@playwright/test"; -export default class ConnectorsLocators{ +export default class ConnectorsLocators { private readonly page: Page; constructor(page: Page) { diff --git a/e2e-playwright/src/pages/Consumers/ConsumersLocators.ts b/e2e-playwright/src/pages/Consumers/ConsumersLocators.ts index 9f4dbf379..327da5875 100644 --- a/e2e-playwright/src/pages/Consumers/ConsumersLocators.ts +++ b/e2e-playwright/src/pages/Consumers/ConsumersLocators.ts @@ -1,6 +1,6 @@ import { Page, Locator } from "@playwright/test"; -export default class ConsumersLocators{ +export default class ConsumersLocators { private readonly page: Page; constructor(page: Page) { diff --git a/e2e-playwright/src/pages/Dashboard/DashboardLocators.ts b/e2e-playwright/src/pages/Dashboard/DashboardLocators.ts index 415e8a62c..96561d820 100644 --- a/e2e-playwright/src/pages/Dashboard/DashboardLocators.ts +++ b/e2e-playwright/src/pages/Dashboard/DashboardLocators.ts @@ -1,6 +1,6 @@ import { Page, Locator } from "@playwright/test"; -export default class DashboardLocators{ +export default class DashboardLocators { private readonly page: Page; constructor(page: Page) { diff --git a/e2e-playwright/src/pages/KSQLDB/ksqldbLocators.ts b/e2e-playwright/src/pages/KSQLDB/ksqldbLocators.ts index bd98d0233..196fdcd6c 100644 --- a/e2e-playwright/src/pages/KSQLDB/ksqldbLocators.ts +++ b/e2e-playwright/src/pages/KSQLDB/ksqldbLocators.ts @@ -1,6 +1,6 @@ import { Page, Locator } from "@playwright/test"; -export default class ksqlDbLocators{ +export default class ksqlDbLocators { private readonly page: Page; constructor(page: Page) { diff --git a/e2e-playwright/src/pages/Panel/PanelLocators.ts b/e2e-playwright/src/pages/Panel/PanelLocators.ts index 750e14449..c56fd9baf 100644 --- a/e2e-playwright/src/pages/Panel/PanelLocators.ts +++ b/e2e-playwright/src/pages/Panel/PanelLocators.ts @@ -1,16 +1,16 @@ import { Page, Locator } from "@playwright/test"; -export default class PanelLocators{ +export default class PanelLocators { private readonly page: Page; constructor(page: Page) { this.page = page; } - linkByName(name: string): Locator{ + linkByName(name: string): Locator { return this.page.getByRole('link', { name }); } - + brokersLink(): Locator { return this.linkByName('Brokers');} topicsLink(): Locator { return this.page.getByTitle('Topics');} consumersLink(): Locator { return this.linkByName('Consumers');} diff --git a/e2e-playwright/src/pages/SchemaRegistry/SchemaRegistryLocators.ts b/e2e-playwright/src/pages/SchemaRegistry/SchemaRegistryLocators.ts index 438dac08e..f61d61e9b 100644 --- a/e2e-playwright/src/pages/SchemaRegistry/SchemaRegistryLocators.ts +++ b/e2e-playwright/src/pages/SchemaRegistry/SchemaRegistryLocators.ts @@ -1,6 +1,6 @@ import { Page, Locator } from "@playwright/test"; -export default class SchemaRegistryLocators{ +export default class SchemaRegistryLocators { private readonly page: Page; constructor(page: Page) { diff --git a/e2e-playwright/src/pages/Topics/TopicsCreateLocators.ts b/e2e-playwright/src/pages/Topics/TopicsCreateLocators.ts index a40fff49c..218b0f3dc 100644 --- a/e2e-playwright/src/pages/Topics/TopicsCreateLocators.ts +++ b/e2e-playwright/src/pages/Topics/TopicsCreateLocators.ts @@ -1,6 +1,6 @@ import { Page, Locator } from "@playwright/test"; -export default class TopicCreateLocators{ +export default class TopicCreateLocators { private readonly page: Page; constructor(page: Page) { diff --git a/e2e-playwright/src/pages/Topics/TopicsLocators.ts b/e2e-playwright/src/pages/Topics/TopicsLocators.ts index a38fe37bc..3d678c07e 100644 --- a/e2e-playwright/src/pages/Topics/TopicsLocators.ts +++ b/e2e-playwright/src/pages/Topics/TopicsLocators.ts @@ -1,6 +1,6 @@ import { Page, Locator } from "@playwright/test"; -export default class TopicsLocators{ +export default class TopicsLocators { private readonly page: Page; constructor(page: Page) { diff --git a/e2e-playwright/playwright.config.ts b/e2e-playwright/src/playwright.config.ts similarity index 98% rename from e2e-playwright/playwright.config.ts rename to e2e-playwright/src/playwright.config.ts index dc2689df3..ecec420ae 100644 --- a/e2e-playwright/playwright.config.ts +++ b/e2e-playwright/src/playwright.config.ts @@ -1,5 +1,7 @@ + import { defineConfig } from '@playwright/test'; export default defineConfig({ timeout: 30_000, }); + diff --git a/e2e-playwright/src/services/uiHelper.ts b/e2e-playwright/src/services/uiHelper.ts index a423a6a6b..340140dd4 100644 --- a/e2e-playwright/src/services/uiHelper.ts +++ b/e2e-playwright/src/services/uiHelper.ts @@ -1,7 +1,7 @@ import { Locator } from '@playwright/test'; import expect from "../helper/util/expect"; - export const expectVisibility = async (locator: Locator, visibleString: string): Promise => { + export const expectVisibility = async(locator: Locator, visibleString: string): Promise => { if (visibleString === "true") { await expect(locator).toBeVisible(); } else { @@ -9,7 +9,7 @@ import expect from "../helper/util/expect"; } }; -export const ensureCheckboxState = async (checkbox: Locator, expectedState: string) => { +export const ensureCheckboxState = async(checkbox: Locator, expectedState: string) => { const desiredState = expectedState === 'true'; const isChecked = await checkbox.isChecked(); diff --git a/e2e-playwright/src/steps/Topics.steps.ts b/e2e-playwright/src/steps/Topics.steps.ts index bfa77eb4b..7d6109a33 100644 --- a/e2e-playwright/src/steps/Topics.steps.ts +++ b/e2e-playwright/src/steps/Topics.steps.ts @@ -1,72 +1,72 @@ import { Given, When, Then, setDefaultTimeout } from "@cucumber/cucumber"; import { expect } from "@playwright/test"; import { expectVisibility, ensureCheckboxState } from "../services/uiHelper"; -import { PlaywrightCustomWorld } from "../support/PlaywrightCustomWorld"; +import { PlaywrightCustomWorld } from "../support/PlaywrightCustomWorld"; setDefaultTimeout(60 * 1000 * 2); -Given('Topics Serchfield visible', async function (this: PlaywrightCustomWorld) { +Given('Topics Serchfield visible', async function() { await expect(this.locators.topics.topicSearchField()).toBeVisible(); }); -Given('Topics ShowInternalTopics visible', async function (this: PlaywrightCustomWorld) { +Given('Topics ShowInternalTopics visible', async function() { await expect(this.locators.topics.topicShowInternalTopics()).toBeVisible(); }); -Given('Topics AddATopic visible', async function (this: PlaywrightCustomWorld) { +Given('Topics AddATopic visible', async function() { await expect(this.locators.topics.topicAddTopicButton()).toBeVisible(); }); -Given('Topics DeleteSelectedTopics active is: {string}', async function (this: PlaywrightCustomWorld, state: string) { +Given('Topics DeleteSelectedTopics active is: {string}', async function(this: PlaywrightCustomWorld, state: string) { const isEnabled = await this.locators.topics.topicDeleteSelectedTopicsButton().isEnabled(); expect(isEnabled.toString()).toBe(state); }); -Given('Topics CopySelectedTopic active is: {string}', async function (this: PlaywrightCustomWorld, state: string) { +Given('Topics CopySelectedTopic active is: {string}', async function(this: PlaywrightCustomWorld, state: string) { const isEnabled = await this.locators.topics.topicCopySelectedTopicButton().isEnabled(); expect(isEnabled.toString()).toBe(state); }); -Given('Topics PurgeMessagesOfSelectedTopics active is: {string}', async function (this: PlaywrightCustomWorld, state: string) { +Given('Topics PurgeMessagesOfSelectedTopics active is: {string}', async function(this: PlaywrightCustomWorld, state: string) { const isEnabled = await this.locators.topics.topicPurgeMessagesOfSelectedTopicsButton().isEnabled(); expect(isEnabled.toString()).toBe(state); }); -When('Topic SelectAllTopic visible is: {string}', async function (this: PlaywrightCustomWorld, visible: string) { +When('Topic SelectAllTopic visible is: {string}', async function(this: PlaywrightCustomWorld, visible: string) { await expectVisibility(this.locators.topics.topicSelectAllCheckBox(), visible); }); -Then('Topic SelectAllTopic checked is: {string}', async function (this: PlaywrightCustomWorld, state: string) { +Then('Topic SelectAllTopic checked is: {string}', async function(this: PlaywrightCustomWorld, state: string) { const checkbox = this.locators.topics.topicSelectAllCheckBox(); await ensureCheckboxState(checkbox, state); const actual = await checkbox.isChecked(); expect(actual.toString()).toBe(state); }); -When('Topics serchfield input {string}', async function (this: PlaywrightCustomWorld, topicName: string) { +When('Topics serchfield input {string}', async function(this: PlaywrightCustomWorld, topicName: string) { const textBox = this.locators.topics.topicSearchField(); await textBox.fill(topicName); const actual = await textBox.inputValue(); expect(actual).toBe(topicName); }); -Then('Topic named: {string} visible is: {string}', async function (this: PlaywrightCustomWorld, topicName: string, visible: string) { +Then('Topic named: {string} visible is: {string}', async function(this: PlaywrightCustomWorld, topicName: string, visible: string) { await expectVisibility(this.locators.topics.topicNameLink(topicName), visible); }); -When('Topic serchfield input cleared', async function (this: PlaywrightCustomWorld) { +When('Topic serchfield input cleared', async function() { const textBox = this.locators.topics.topicSearchField(); await textBox.fill(''); const text = await textBox.inputValue(); expect(text).toBe(''); }); -When('Topics ShowInternalTopics switched is: {string}', async function (this: PlaywrightCustomWorld, state: string) { +When('Topics ShowInternalTopics switched is: {string}', async function(this: PlaywrightCustomWorld, state: string) { const checkBox = this.locators.topics.topicShowInternalTopics(); await ensureCheckboxState(checkBox, state); }); -When('Topic row named: {string} checked is: {string}', async function (this: PlaywrightCustomWorld, topicName: string, state: string) { +When('Topic row named: {string} checked is: {string}', async function(this: PlaywrightCustomWorld, topicName: string, state: string) { const checkbox = this.locators.topics.topicRowCheckBox(topicName); await ensureCheckboxState(checkbox, state); }); diff --git a/e2e-playwright/src/steps/TopicsCreate.steps.ts b/e2e-playwright/src/steps/TopicsCreate.steps.ts index 33e7837b5..cb5be6697 100644 --- a/e2e-playwright/src/steps/TopicsCreate.steps.ts +++ b/e2e-playwright/src/steps/TopicsCreate.steps.ts @@ -6,131 +6,131 @@ import { generateName } from "../services/commonFunctions"; setDefaultTimeout(60 * 1000 * 2); -Given('Topics AddATopic clicked', async function (this: PlaywrightCustomWorld) { +Given('Topics AddATopic clicked', async function() { const button = this.locators.topics.topicAddTopicButton(); await expect(button).toBeVisible(); await button.click(); }); -Given('TopicCreate heading visible is: {string}', async function (this: PlaywrightCustomWorld, visible: string) { +Given('TopicCreate heading visible is: {string}', async function(this: PlaywrightCustomWorld, visible: string) { await expectVisibility(this.locators.topicsCreate.topicsCreateHeading(), visible); }); -Given('TopicCreate TopicName input visible is: {string}', async function (this: PlaywrightCustomWorld, visible: string) { +Given('TopicCreate TopicName input visible is: {string}', async function(this: PlaywrightCustomWorld, visible: string) { await expectVisibility(this.locators.topicsCreate.topicsCreateTopicName(), visible); }); -Given('TopicCreate NumberOfPartitions input visible is: {string}', async function (this: PlaywrightCustomWorld, visible: string) { +Given('TopicCreate NumberOfPartitions input visible is: {string}', async function(this: PlaywrightCustomWorld, visible: string) { await expectVisibility(this.locators.topicsCreate.topicsCreateNumberOfPartitions(), visible); }); -Given('TopicCreate CleanupPolicy select visible is: {string}', async function (this: PlaywrightCustomWorld, visible: string) { +Given('TopicCreate CleanupPolicy select visible is: {string}', async function(this: PlaywrightCustomWorld, visible: string) { await expectVisibility(this.locators.topicsCreate.topicsCreateCleanupPolicy(), visible); }); -Given('TopicCreate MinInSyncReplicas input visible is: {string}', async function (this: PlaywrightCustomWorld, visible: string) { +Given('TopicCreate MinInSyncReplicas input visible is: {string}', async function(this: PlaywrightCustomWorld, visible: string) { await expectVisibility(this.locators.topicsCreate.topicsCreateMinInSyncReplicas(), visible); }); -Given('TopicCreate ReplicationFactor input visible is: {string}', async function (this: PlaywrightCustomWorld, visible: string) { +Given('TopicCreate ReplicationFactor input visible is: {string}', async function(this: PlaywrightCustomWorld, visible: string) { await expectVisibility(this.locators.topicsCreate.topicsCreateReplicationFactor(), visible); }); -Given('TopicCreate TimeToRetainData input visible is: {string}', async function (this: PlaywrightCustomWorld, visible: string) { +Given('TopicCreate TimeToRetainData input visible is: {string}', async function(this: PlaywrightCustomWorld, visible: string) { await expectVisibility(this.locators.topicsCreate.topicsCreateTimeToRetainData(), visible); }); -Given('TopicCreate 12Hours button visible is: {string}', async function (this: PlaywrightCustomWorld, visible: string) { +Given('TopicCreate 12Hours button visible is: {string}', async function(this: PlaywrightCustomWorld, visible: string) { await expectVisibility(this.locators.topicsCreate.topicsCreate12Hours(), visible); }); -Given('TopicCreate 1Day button visible is: {string}', async function (this: PlaywrightCustomWorld, visible: string) { +Given('TopicCreate 1Day button visible is: {string}', async function(this: PlaywrightCustomWorld, visible: string) { await expectVisibility(this.locators.topicsCreate.topicsCreate1Day(), visible); }); -Given('TopicCreate 2Day button visible is: {string}', async function (this: PlaywrightCustomWorld, visible: string) { +Given('TopicCreate 2Day button visible is: {string}', async function(this: PlaywrightCustomWorld, visible: string) { await expectVisibility(this.locators.topicsCreate.topicsCreate2Day(), visible); }); -Given('TopicCreate 7Day button visible is: {string}', async function (this: PlaywrightCustomWorld, visible: string) { +Given('TopicCreate 7Day button visible is: {string}', async function(this: PlaywrightCustomWorld, visible: string) { await expectVisibility(this.locators.topicsCreate.topicsCreate7Day(), visible); }); -Given('TopicCreate 4Weeks button visible is: {string}', async function (this: PlaywrightCustomWorld, visible: string) { +Given('TopicCreate 4Weeks button visible is: {string}', async function(this: PlaywrightCustomWorld, visible: string) { await expectVisibility(this.locators.topicsCreate.topicsCreate4Weeks(), visible); }); -Given('TopicCreate MaxPartitionSize select visible is: {string}', async function (this: PlaywrightCustomWorld, visible: string) { +Given('TopicCreate MaxPartitionSize select visible is: {string}', async function(this: PlaywrightCustomWorld, visible: string) { await expectVisibility(this.locators.topicsCreate.topicsCreateMaxPartitionSize(), visible); }); -Given('TopicCreate MaxMessageSize input visible is: {string}', async function (this: PlaywrightCustomWorld, visible: string) { +Given('TopicCreate MaxMessageSize input visible is: {string}', async function(this: PlaywrightCustomWorld, visible: string) { await expectVisibility(this.locators.topicsCreate.topicsCreateMaxMessageSize(), visible); }); -Given('TopicCreate AddCustomParameter button visible is: {string}', async function (this: PlaywrightCustomWorld, visible: string) { +Given('TopicCreate AddCustomParameter button visible is: {string}', async function(this: PlaywrightCustomWorld, visible: string) { await expectVisibility(this.locators.topicsCreate.topicsCreateAddCustomParameter(), visible); }); -Given('TopicCreate Cancel button visible is: {string}', async function (this: PlaywrightCustomWorld, visible: string) { +Given('TopicCreate Cancel button visible is: {string}', async function(this: PlaywrightCustomWorld, visible: string) { await expectVisibility(this.locators.topicsCreate.topicsCreateCancel(), visible); }); -Given('TopicCreate CreateTopic button visible is: {string}', async function (this: PlaywrightCustomWorld, visible: string) { +Given('TopicCreate CreateTopic button visible is: {string}', async function(this: PlaywrightCustomWorld, visible: string) { await expectVisibility(this.locators.topicsCreate.topicCreateCreateTopicButton(), visible); }); -When('TopicCreate Topic name starts with: {string}', async function (this: PlaywrightCustomWorld, prefix: string) { +When('TopicCreate Topic name starts with: {string}', async function(this: PlaywrightCustomWorld, prefix: string) { const topicName = generateName(prefix); this.setValue(`topicName-${prefix}`, topicName); await this.locators.topicsCreate.topicsCreateTopicName().fill(topicName); }); -When('TopicCreate Number of partitons: {int}', async function (this: PlaywrightCustomWorld, count: number) { +When('TopicCreate Number of partitons: {int}', async function(this: PlaywrightCustomWorld, count: number) { await this.locators.topicsCreate.topicsCreateNumberOfPartitions().fill(count.toString()); }); -When('TopicCreate Time to retain data one day', async function (this: PlaywrightCustomWorld) { +When('TopicCreate Time to retain data one day', async function() { await this.locators.topicsCreate.topicsCreate1Day().click(); }); -When('TopicCreate Create topic clicked', async function (this: PlaywrightCustomWorld) { +When('TopicCreate Create topic clicked', async function() { await this.locators.topicsCreate.topicCreateCreateTopicButton().click(); }); -Then('Header starts with: {string}', async function (this: PlaywrightCustomWorld, prefix: string) { +Then('Header starts with: {string}', async function(this: PlaywrightCustomWorld, prefix: string) { const topicName = this.getValue(`topicName-${prefix}`); const header = this.page.getByRole('heading', { name: topicName }); await expect(header).toBeVisible(); }); -Then('Topic name started with: {string} visible is: {string}', async function (this: PlaywrightCustomWorld, prefix: string, visible: string) { +Then('Topic name started with: {string} visible is: {string}', async function(this: PlaywrightCustomWorld, prefix: string, visible: string) { const topicName = this.getValue(`topicName-${prefix}`); await expectVisibility(this.locators.topics.topicNameLink(topicName), visible); }); -Then('TopicCreate TimeToRetainData value is: {string}', async function (this: PlaywrightCustomWorld, expectedValue: string) { +Then('TopicCreate TimeToRetainData value is: {string}', async function(this: PlaywrightCustomWorld, expectedValue: string) { const input = this.locators.topicsCreate.topicsCreateTimeToRetainData(); const actualValue = await input.inputValue(); expect(actualValue).toBe(expectedValue); }); -When('TopicCreate 12Hours button clicked', async function (this: PlaywrightCustomWorld) { +When('TopicCreate 12Hours button clicked', async function() { await this.locators.topicsCreate.topicsCreate12Hours().click(); }); -When('TopicCreate 1Day button clicked', async function (this: PlaywrightCustomWorld) { +When('TopicCreate 1Day button clicked', async function() { await this.locators.topicsCreate.topicsCreate1Day().click(); }); -When('TopicCreate 2Day button clicked', async function (this: PlaywrightCustomWorld) { +When('TopicCreate 2Day button clicked', async function() { await this.locators.topicsCreate.topicsCreate2Day().click(); }); -When('TopicCreate 7Day button clicked', async function (this: PlaywrightCustomWorld) { +When('TopicCreate 7Day button clicked', async function() { await this.locators.topicsCreate.topicsCreate7Day().click(); }); -When('TopicCreate 4Weeks button clicked', async function (this: PlaywrightCustomWorld) { +When('TopicCreate 4Weeks button clicked', async function() { await this.locators.topicsCreate.topicsCreate4Weeks().click(); }); diff --git a/e2e-playwright/src/steps/navigation.steps.ts b/e2e-playwright/src/steps/navigation.steps.ts index c6f5584da..ee691f051 100644 --- a/e2e-playwright/src/steps/navigation.steps.ts +++ b/e2e-playwright/src/steps/navigation.steps.ts @@ -2,107 +2,107 @@ import { Given, When, Then, setDefaultTimeout } from "@cucumber/cucumber"; import expect from "../helper/util/expect"; import { PlaywrightCustomWorld } from "../support/PlaywrightCustomWorld"; -setDefaultTimeout(60 * 1000 * 2); +setDefaultTimeout(60 * 1000 * 2); -Given('Brokers is visible', async function (this: PlaywrightCustomWorld) { +Given('Brokers is visible', async function() { await this.page.goto(process.env.BASEURL!); await expect(this.locators.panel.brokersLink()).toBeVisible(); }); -When('click on Brokers link', async function (this: PlaywrightCustomWorld) { +When('click on Brokers link', async function() { await this.locators.panel.brokersLink().click(); }); -Then('Brokers heading visible', async function (this: PlaywrightCustomWorld) { +Then('Brokers heading visible', async function() { await this.locators.brokers.brokersHeading().waitFor({ state: 'visible' }); }); -Given('Topics is visible', async function (this: PlaywrightCustomWorld) { +Given('Topics is visible', async function() { await this.page.goto(process.env.BASEURL!); await expect(this.locators.panel.topicsLink()).toBeVisible(); }); -When('click on Topics link', async function (this: PlaywrightCustomWorld) { +When('click on Topics link', async function() { await this.locators.panel.topicsLink().click(); }); -Then('Topics heading visible', async function (this: PlaywrightCustomWorld) { +Then('Topics heading visible', async function() { await this.locators.topics.topicsHeading().waitFor({ state: 'visible' }); }); -Given('Consumers is visible', async function (this: PlaywrightCustomWorld) { +Given('Consumers is visible', async function() { await this.page.goto(process.env.BASEURL!); await expect(this.locators.panel.consumersLink()).toBeVisible(); }); -When('click on Consumers link', async function (this: PlaywrightCustomWorld) { +When('click on Consumers link', async function() { await this.locators.panel.consumersLink().click(); }); -Then('Consumers heading visible', async function (this: PlaywrightCustomWorld) { +Then('Consumers heading visible', async function() { await this.locators.consumers.consumersHeading().waitFor({ state: 'visible' }); }); -Given('Schema Registry is visible', async function (this: PlaywrightCustomWorld) { +Given('Schema Registry is visible', async function() { await this.page.goto(process.env.BASEURL!); await expect(this.locators.panel.schemaRegistryLink()).toBeVisible(); }); -When('click on Schema Registry link', async function (this: PlaywrightCustomWorld) { +When('click on Schema Registry link', async function() { await this.locators.panel.schemaRegistryLink().click(); }); -Then('Schema Registry heading visible', async function (this: PlaywrightCustomWorld) { +Then('Schema Registry heading visible', async function() { await this.locators.schemaRegistry.schemaRegistryHeading().waitFor({ state: 'visible' }); }); -Given('Kafka Connect is visible', async function (this: PlaywrightCustomWorld) { +Given('Kafka Connect is visible', async function() { await this.page.goto(process.env.BASEURL!); await expect(this.locators.panel.kafkaConnectLink()).toBeVisible(); }); -When('click on Kafka Connect link', async function (this: PlaywrightCustomWorld) { +When('click on Kafka Connect link', async function() { await this.locators.panel.kafkaConnectLink().click(); }); -Then('Kafka Connect heading visible', async function (this: PlaywrightCustomWorld) { +Then('Kafka Connect heading visible', async function() { await this.locators.connectors.connectorsHeading().waitFor({ state: 'visible' }); }); -Given('KSQL DB is visible', async function (this: PlaywrightCustomWorld) { +Given('KSQL DB is visible', async function() { await this.page.goto(process.env.BASEURL!); await expect(this.locators.panel.ksqlDbLink()).toBeVisible(); }); -When('click on KSQL DB link', async function (this: PlaywrightCustomWorld) { +When('click on KSQL DB link', async function() { await this.locators.panel.ksqlDbLink().click(); }); -Then('KSQL DB heading visible', async function (this: PlaywrightCustomWorld) { +Then('KSQL DB heading visible', async function() { await this.locators.ksqlDb.ksqlDbHeading().waitFor({ state: 'visible' }); }); -Given('Dashboard is visible', async function (this: PlaywrightCustomWorld) { +Given('Dashboard is visible', async function() { await this.page.goto(process.env.BASEURL!); await expect(this.locators.panel.getDashboardLink()).toBeVisible(); }); -When('click on Dashboard link', async function (this: PlaywrightCustomWorld) { +When('click on Dashboard link', async function() { const dashboard = this.locators.panel.getDashboardLink(); await dashboard.isVisible(); // Optional: could be removed if already handled in expect above await dashboard.click(); }); -Then('Dashboard heading visible', async function (this: PlaywrightCustomWorld) { +Then('Dashboard heading visible', async function() { await this.locators.dashboard.dashboardHeading().waitFor({ state: 'visible' }); }); -Then('the end of current URL should be {string}', async function (this: PlaywrightCustomWorld, expected: string) { +Then('the end of current URL should be {string}', async function(this: PlaywrightCustomWorld, expected: string) { const actual = new URL(this.page.url()).pathname; expect(actual.endsWith(expected)).toBeTruthy(); }); -Then('the part of current URL should be {string}', async function (this: PlaywrightCustomWorld, expected: string) { +Then('the part of current URL should be {string}', async function(this: PlaywrightCustomWorld, expected: string) { const actual = new URL(this.page.url()).pathname; expect(actual.includes(expected)).toBeTruthy(); -}); \ No newline at end of file +}); diff --git a/e2e-playwright/src/support/PlaywrightCustomWorld.ts b/e2e-playwright/src/support/PlaywrightCustomWorld.ts index 8495fdfca..41d54f92e 100644 --- a/e2e-playwright/src/support/PlaywrightCustomWorld.ts +++ b/e2e-playwright/src/support/PlaywrightCustomWorld.ts @@ -11,7 +11,6 @@ export class PlaywrightCustomWorld extends World { public logger?: Logger; public browserContext?: BrowserContext; - // eslint-disable-next-line @typescript-eslint/no-explicit-any private context: Map = new Map(); private _page?: Page; private _locators?:Locators; @@ -21,7 +20,6 @@ export class PlaywrightCustomWorld extends World { super(options); } - // eslint-disable-next-line @typescript-eslint/no-explicit-any setValue(key: string, value: any) { this.context.set(key, value); } @@ -32,9 +30,9 @@ export class PlaywrightCustomWorld extends World { return value as T; } - async init(context: BrowserContext, scenarioName:string ){ + async init(context: BrowserContext, scenarioName:string ) { const page = await context.newPage(); - + this._page = page; this.logger = createLogger(options(scenarioName)); this._scenarioName = scenarioName; @@ -45,7 +43,7 @@ export class PlaywrightCustomWorld extends World { if (this._page) { return this._page!; } - + throw new Error("No page"); } diff --git a/e2e-playwright/tsconfig.json b/e2e-playwright/tsconfig.json index 264092083..a8a600d19 100644 --- a/e2e-playwright/tsconfig.json +++ b/e2e-playwright/tsconfig.json @@ -11,5 +11,5 @@ "rootDir": "src", "sourceMap": true }, - "include": ["src/**/*.ts", "src/steps/**/*.ts", "src/features/**/*.ts"] + "include": ["src/**/*.ts", "src/steps/**/*.ts", "src/features/**/*.ts", "src/playwright.config.ts"] } \ No newline at end of file From d6d78df32058837722793a962eb96d8add47c0c4 Mon Sep 17 00:00:00 2001 From: AspidDark Date: Fri, 23 May 2025 22:39:15 +0300 Subject: [PATCH 04/14] locators as getters better named locators --- e2e-playwright/src/hooks/hooks.ts | 8 +- e2e-playwright/src/pages/BaseLocators.ts | 30 ++--- .../src/pages/Brokers/BrokersLocators.ts | 2 +- .../pages/Connectors/ConnectorsLocators.ts | 6 +- .../src/pages/Consumers/ConsumersLocators.ts | 6 +- .../src/pages/Dashboard/DashboardLocators.ts | 2 +- .../src/pages/KSQLDB/ksqldbLocators.ts | 8 +- .../src/pages/Panel/PanelLocators.ts | 14 +-- .../SchemaRegistry/SchemaRegistryLocators.ts | 6 +- .../src/pages/Topics/TopicsCreateLocators.ts | 39 +++---- .../src/pages/Topics/TopicsLocators.ts | 24 ++-- e2e-playwright/src/steps/Topics.steps.ts | 49 ++++---- .../src/steps/TopicsCreate.steps.ts | 107 +++++++++--------- e2e-playwright/src/steps/navigation.steps.ts | 57 +++++----- ...rightCustomWorld.ts => PlaywrightWorld.ts} | 2 +- 15 files changed, 182 insertions(+), 178 deletions(-) rename e2e-playwright/src/support/{PlaywrightCustomWorld.ts => PlaywrightWorld.ts} (96%) diff --git a/e2e-playwright/src/hooks/hooks.ts b/e2e-playwright/src/hooks/hooks.ts index 8573d51c5..33f949db1 100644 --- a/e2e-playwright/src/hooks/hooks.ts +++ b/e2e-playwright/src/hooks/hooks.ts @@ -3,7 +3,7 @@ import { BeforeAll, AfterAll, Before, After, Status, setDefaultTimeout, setWorld import { Browser } from "@playwright/test"; import { invokeBrowser } from "../helper/browsers/browserManager"; import fs from 'fs'; -import { PlaywrightCustomWorld } from '../support/PlaywrightCustomWorld'; +import { PlaywrightWorld } from '../support/PlaywrightWorld'; let browser: Browser; @@ -13,9 +13,9 @@ BeforeAll(async function() { setDefaultTimeout(60 * 1000); -setWorldConstructor(PlaywrightCustomWorld); +setWorldConstructor(PlaywrightWorld); -Before(async function(this: PlaywrightCustomWorld, { pickle }) { +Before(async function(this: PlaywrightWorld, { pickle }) { const scenarioName = pickle.name + pickle.id const context = await browser.newContext({ recordVideo: { dir: 'test-results/videos/' }, @@ -30,7 +30,7 @@ Before(async function(this: PlaywrightCustomWorld, { pickle }) { await this.init(context, scenarioName); }); -After({ timeout: 30000 }, async function(this: PlaywrightCustomWorld, { pickle, result }) { +After({ timeout: 30000 }, async function(this: PlaywrightWorld, { pickle, result }) { let img: Buffer | undefined; const path = `./test-results/trace/${pickle.id}.zip`; try { diff --git a/e2e-playwright/src/pages/BaseLocators.ts b/e2e-playwright/src/pages/BaseLocators.ts index 980f7a984..a5bb34c83 100644 --- a/e2e-playwright/src/pages/BaseLocators.ts +++ b/e2e-playwright/src/pages/BaseLocators.ts @@ -4,21 +4,21 @@ export class BaseLocators { // eslint-disable-next-line no-unused-vars constructor(private page: Page) {} - loadingSpinner:Locator = this.page.locator('div[role="progressbar"]'); - submitBtn:Locator = this.page.locator('button[type="submit"]'); - tableGrid:Locator = this.page.locator('table'); - searchFld:Locator = this.page.locator('input[type="text"][id*=":r"]'); - dotMenuBtn:Locator = this.page.locator('button[aria-label="Dropdown Toggle"]'); - alertHeader:Locator = this.page.locator('div[role="alert"] div[role="heading"]'); - alertMessage:Locator = this.page.locator('div[role="alert"] div[role="contentinfo"]'); - confirmationMdl:Locator = this.page.locator('text=Confirm the action').locator('..'); - confirmBtn:Locator = this.page.locator('button:has-text("Confirm")'); - cancelBtn:Locator = this.page.locator('button:has-text("Cancel")'); - backBtn:Locator = this.page.locator('button:has-text("Back")'); - previousBtn:Locator = this.page.locator('button:has-text("Previous")'); - nextBtn:Locator = this.page.locator('button:has-text("Next")'); - ddlOptions:Locator = this.page.locator('li[value]'); - gridItems:Locator = this.page.locator('tr[class]'); + get loadingSpinner(): Locator { return this.page.locator('div[role="progressbar"]'); } + get submitBtn(): Locator { return this.page.locator('button[type="submit"]'); } + get tableGrid(): Locator { return this.page.locator('table'); } + get searchFld(): Locator { return this.page.locator('input[type="text"][id*=":r"]'); } + get dotMenuBtn(): Locator { return this.page.locator('button[aria-label="Dropdown Toggle"]'); } + get alertHeader(): Locator { return this.page.locator('div[role="alert"] div[role="heading"]'); } + get alertMessage(): Locator { return this.page.locator('div[role="alert"] div[role="contentinfo"]'); } + get confirmationMdl(): Locator { return this.page.locator('text=Confirm the action').locator('..'); } + get confirmBtn(): Locator { return this.page.locator('button:has-text("Confirm")'); } + get cancelBtn(): Locator { return this.page.locator('button:has-text("Cancel")'); } + get backBtn(): Locator { return this.page.locator('button:has-text("Back")'); } + get previousBtn(): Locator { return this.page.locator('button:has-text("Previous")'); } + get nextBtn(): Locator { return this.page.locator('button:has-text("Next")'); } + get ddlOptions(): Locator { return this.page.locator('li[value]'); } + get gridItems(): Locator { return this.page.locator('tr[class]'); } tableElementNameLocator = (name: string):Locator => this.page.locator(`tbody a:has-text("${name}")`); pageTitleFromHeader = (title: string):Locator => this.page.locator(`h1:has-text("${title}")`); diff --git a/e2e-playwright/src/pages/Brokers/BrokersLocators.ts b/e2e-playwright/src/pages/Brokers/BrokersLocators.ts index 50bd5d2b6..7d38c8dbd 100644 --- a/e2e-playwright/src/pages/Brokers/BrokersLocators.ts +++ b/e2e-playwright/src/pages/Brokers/BrokersLocators.ts @@ -7,5 +7,5 @@ export default class BrokersLocators { this.page = page; } - brokersHeading = (): Locator => this.page.getByRole('heading', { name: 'Brokers' }); + get heading(): Locator { return this.page.getByRole('heading', { name: 'Brokers' })}; } \ No newline at end of file diff --git a/e2e-playwright/src/pages/Connectors/ConnectorsLocators.ts b/e2e-playwright/src/pages/Connectors/ConnectorsLocators.ts index d372bfbb9..66e8cc0ac 100644 --- a/e2e-playwright/src/pages/Connectors/ConnectorsLocators.ts +++ b/e2e-playwright/src/pages/Connectors/ConnectorsLocators.ts @@ -7,7 +7,7 @@ export default class ConnectorsLocators { this.page = page; } - connectorsHeading = (): Locator => this.page.getByRole('heading', { name: 'Connectors' }); - connectorsSearchBox = (): Locator => this.page.getByRole('textbox', { name: 'SSearch by Connect Name' }); - connectorsCreateConnectorButton = (): Locator => this.page.getByRole('button', { name: 'Create Schema' }); + get heading(): Locator { return this.page.getByRole('heading', { name: 'Connectors' })}; + get searchBox(): Locator { return this.page.getByRole('textbox', { name: 'SSearch by Connect Name' })}; + get createConnectorButton(): Locator { return this.page.getByRole('button', { name: 'Create Schema' })}; } \ No newline at end of file diff --git a/e2e-playwright/src/pages/Consumers/ConsumersLocators.ts b/e2e-playwright/src/pages/Consumers/ConsumersLocators.ts index 327da5875..241808ee4 100644 --- a/e2e-playwright/src/pages/Consumers/ConsumersLocators.ts +++ b/e2e-playwright/src/pages/Consumers/ConsumersLocators.ts @@ -7,7 +7,7 @@ export default class ConsumersLocators { this.page = page; } - consumersHeading = (): Locator => this.page.getByRole('heading', { name: 'Consumers' }); - consumersSearchBox = (): Locator => this.page.getByRole('textbox', { name: 'Search by Consumer Group ID' }); - consumersSearchByGroupId = (): Locator => this.page.getByText('Group ID'); + get heading(): Locator { return this.page.getByRole('heading', { name: 'Consumers' })}; + get searchBox(): Locator { return this.page.getByRole('textbox', { name: 'Search by Consumer Group ID' })}; + get searchByGroupId(): Locator { return this.page.getByText('Group ID')}; } \ No newline at end of file diff --git a/e2e-playwright/src/pages/Dashboard/DashboardLocators.ts b/e2e-playwright/src/pages/Dashboard/DashboardLocators.ts index 96561d820..b42fe8538 100644 --- a/e2e-playwright/src/pages/Dashboard/DashboardLocators.ts +++ b/e2e-playwright/src/pages/Dashboard/DashboardLocators.ts @@ -7,5 +7,5 @@ export default class DashboardLocators { this.page = page; } - dashboardHeading = (): Locator => this.page.getByRole('heading', { name: 'Dashboard' }); + get heading(): Locator { return this.page.getByRole('heading', { name: 'Dashboard' })}; } \ No newline at end of file diff --git a/e2e-playwright/src/pages/KSQLDB/ksqldbLocators.ts b/e2e-playwright/src/pages/KSQLDB/ksqldbLocators.ts index 196fdcd6c..7fffdc13c 100644 --- a/e2e-playwright/src/pages/KSQLDB/ksqldbLocators.ts +++ b/e2e-playwright/src/pages/KSQLDB/ksqldbLocators.ts @@ -7,9 +7,9 @@ export default class ksqlDbLocators { this.page = page; } - ksqlDbHeading = (): Locator => this.page.getByRole('heading', { name: 'KSQL DB' }); - ksqlDbExecuteKSQLREquestButton = (): Locator => this.page.getByRole('button', { name: 'Execute KSQL Request' }); - ksqlDbTablesLink = (): Locator => this.page.getByRole('link', { name: 'Tables' }); - ksqlDbStreamsLink = (): Locator => this.page.getByRole('link', { name: 'Streams' }); + get heading(): Locator { return this.page.getByRole('heading', { name: 'KSQL DB' })}; + get executeKSQLREquestButton(): Locator { return this.page.getByRole('button', { name: 'Execute KSQL Request' })}; + get tablesLink(): Locator { return this.page.getByRole('link', { name: 'Tables' })}; + get streamsLink(): Locator { return this.page.getByRole('link', { name: 'Streams' })}; } \ No newline at end of file diff --git a/e2e-playwright/src/pages/Panel/PanelLocators.ts b/e2e-playwright/src/pages/Panel/PanelLocators.ts index c56fd9baf..01f52a103 100644 --- a/e2e-playwright/src/pages/Panel/PanelLocators.ts +++ b/e2e-playwright/src/pages/Panel/PanelLocators.ts @@ -11,11 +11,11 @@ export default class PanelLocators { return this.page.getByRole('link', { name }); } - brokersLink(): Locator { return this.linkByName('Brokers');} - topicsLink(): Locator { return this.page.getByTitle('Topics');} - consumersLink(): Locator { return this.linkByName('Consumers');} - schemaRegistryLink(): Locator { return this.linkByName('Schema Registry');} - ksqlDbLink(): Locator { return this.linkByName('KSQL DB');} - getDashboardLink(): Locator { return this.linkByName('Dashboard');} - kafkaConnectLink(): Locator { return this.linkByName('Kafka Connect');} + get brokersLink(): Locator { return this.linkByName('Brokers');} + get topicsLink(): Locator { return this.page.getByTitle('Topics');} + get consumersLink(): Locator { return this.linkByName('Consumers');} + get schemaRegistryLink(): Locator { return this.linkByName('Schema Registry');} + get ksqlDbLink(): Locator { return this.linkByName('KSQL DB');} + get getDashboardLink(): Locator { return this.linkByName('Dashboard');} + get kafkaConnectLink(): Locator { return this.linkByName('Kafka Connect');} } \ No newline at end of file diff --git a/e2e-playwright/src/pages/SchemaRegistry/SchemaRegistryLocators.ts b/e2e-playwright/src/pages/SchemaRegistry/SchemaRegistryLocators.ts index f61d61e9b..a1f908e74 100644 --- a/e2e-playwright/src/pages/SchemaRegistry/SchemaRegistryLocators.ts +++ b/e2e-playwright/src/pages/SchemaRegistry/SchemaRegistryLocators.ts @@ -7,7 +7,7 @@ export default class SchemaRegistryLocators { this.page = page; } - schemaRegistryHeading = (): Locator => this.page.getByRole('heading', { name: 'Schema Registry' }); - schemaRegistrySearchBox = (): Locator => this.page.getByRole('textbox', { name: 'Search by Schema Name' }); - schemaRegistryCreateSchemaButton = (): Locator => this.page.getByRole('button', { name: 'Create Schema' }); + get heading(): Locator { return this.page.getByRole('heading', { name: 'Schema Registry' })}; + get searchBox(): Locator { return this.page.getByRole('textbox', { name: 'Search by Schema Name' })}; + get createSchemaButton(): Locator { return this.page.getByRole('button', { name: 'Create Schema' })}; } \ No newline at end of file diff --git a/e2e-playwright/src/pages/Topics/TopicsCreateLocators.ts b/e2e-playwright/src/pages/Topics/TopicsCreateLocators.ts index 218b0f3dc..927c741e7 100644 --- a/e2e-playwright/src/pages/Topics/TopicsCreateLocators.ts +++ b/e2e-playwright/src/pages/Topics/TopicsCreateLocators.ts @@ -7,23 +7,24 @@ export default class TopicCreateLocators { this.page = page; } - topicsCreateHeading = (): Locator => this.page.getByText('TopicsCreate'); - topicsCreateTopicName = ():Locator => this.page.getByRole('textbox', { name: 'Topic Name *' }); - topicsCreateNumberOfPartitions = ():Locator => this.page.getByRole('spinbutton', { name: 'Number of Partitions *' }); - topicsCreateCleanupPolicy = (): Locator => this.page.getByRole('listbox', { name: 'Cleanup policy' }); - topicsCreateCleanupPolicySelect = (value : string): Locator => this.page.getByRole('list').getByRole('option', { name: value, exact: true }); - topicsCreateMinInSyncReplicas = (): Locator => this.page.getByRole('spinbutton', { name: 'Min In Sync Replicas' }); - topicsCreateReplicationFactor = (): Locator => this.page.getByRole('spinbutton', { name: 'Replication Factor' }); - topicsCreateTimeToRetainData = (): Locator => this.page.getByRole('spinbutton', { name: 'Time to retain data (in ms)' }); - topicsCreate12Hours = (): Locator => this.page.getByRole('button', { name: 'hours' }); - topicsCreate1Day = (): Locator => this.page.getByRole('button', { name: '1 day' }); - topicsCreate2Day = (): Locator => this.page.getByRole('button', { name: '2 days' }); - topicsCreate7Day = (): Locator => this.page.getByRole('button', { name: '7 days' }); - topicsCreate4Weeks = (): Locator => this.page.getByRole('button', { name: 'weeks' }); - topicsCreateMaxPartitionSize = (): Locator => this.page.getByRole('listbox', { name: 'Max partition size in GB' }); - topicsCreateMaxPartitionSizeSelect = (value: string): Locator => this.page.getByRole('option', { name: value }); - topicsCreateMaxMessageSize = (): Locator => this.page.getByRole('spinbutton', { name: 'Maximum message size in bytes' }); - topicsCreateAddCustomParameter = (): Locator => this.page.getByRole('button', { name: 'Add Custom Parameter' }); - topicsCreateCancel = (): Locator => this.page.getByRole('button', { name: 'Cancel' }); - topicCreateCreateTopicButton = (): Locator => this.page.getByRole('button', { name: 'Create topic' }); + get heading(): Locator { return this.page.getByText('TopicsCreate'); } + get topicName(): Locator { return this.page.getByRole('textbox', { name: 'Topic Name *' }); } + get numberOfPartitions(): Locator { return this.page.getByRole('spinbutton', { name: 'Number of Partitions *' }); } + get cleanupPolicy(): Locator { return this.page.getByRole('listbox', { name: 'Cleanup policy' }); } + get minInSyncReplicas(): Locator { return this.page.getByRole('spinbutton', { name: 'Min In Sync Replicas' }); } + get replicationFactor(): Locator { return this.page.getByRole('spinbutton', { name: 'Replication Factor' }); } + get timeToRetainData(): Locator { return this.page.getByRole('spinbutton', { name: 'Time to retain data (in ms)' }); } + get button12Hours(): Locator { return this.page.getByRole('button', { name: 'hours' }); } + get button1Day(): Locator { return this.page.getByRole('button', { name: '1 day' }); } + get button2Day(): Locator { return this.page.getByRole('button', { name: '2 days' }); } + get button7Day(): Locator { return this.page.getByRole('button', { name: '7 days' }); } + get button4Weeks(): Locator { return this.page.getByRole('button', { name: 'weeks' }); } + get maxPartitionSize(): Locator { return this.page.getByRole('listbox', { name: 'Max partition size in GB' }); } + get maxMessageSize(): Locator { return this.page.getByRole('spinbutton', { name: 'Maximum message size in bytes' }); } + get addCustomParameter(): Locator { return this.page.getByRole('button', { name: 'Add Custom Parameter' }); } + get cancel(): Locator { return this.page.getByRole('button', { name: 'Cancel' }); } + get createTopicButton(): Locator { return this.page.getByRole('button', { name: 'Create topic' }); } + + maxPartitionSizeSelect(value: string): Locator { return this.page.getByRole('option', { name: value }); } + cleanupPolicySelect(value: string): Locator { return this.page.getByRole('list').getByRole('option', { name: value, exact: true }); } } \ No newline at end of file diff --git a/e2e-playwright/src/pages/Topics/TopicsLocators.ts b/e2e-playwright/src/pages/Topics/TopicsLocators.ts index 3d678c07e..8b8493d5e 100644 --- a/e2e-playwright/src/pages/Topics/TopicsLocators.ts +++ b/e2e-playwright/src/pages/Topics/TopicsLocators.ts @@ -7,16 +7,16 @@ export default class TopicsLocators { this.page = page; } - topicsHeading = (): Locator => this.page.getByRole("heading", { name: "Topics" }); - topicSearchField = (): Locator => this.page.getByRole('textbox', { name: 'Search by Topic Name' }); - topicSearchFieldCleanText = (): Locator => this.page.getByRole('button').filter({ hasText: /^$/ }).locator('path'); - topicShowInternalTopics = (): Locator => this.page.locator('label').filter({ hasText: 'Show Internal Topics' }).locator('span'); - topicAddTopicButton = (): Locator => this.page.getByRole('button', { name: 'Add a Topic' }); - topicSelectAllCheckbox = (): Locator => this.page.getByRole('row', { name: 'Topic Name Partitions Out of' }).getByRole('checkbox'); - topicDeleteSelectedTopicsButton = (): Locator => this.page.getByRole('button', { name: 'Delete selected topics' }); - topicCopySelectedTopicButton = (): Locator => this.page.getByRole('button', { name: 'Copy selected topic' }); - topicPurgeMessagesOfSelectedTopicsButton = (): Locator => this.page.getByRole('button', { name: 'Purge messages of selected' }); - topicSelectAllCheckBox = (): Locator => this.page.getByRole('row', { name: 'Topic Name Partitions Out of' }).getByRole('checkbox'); - topicRowCheckBox = (message:string): Locator => this.page.getByRole('row', { name: message }).getByRole('checkbox'); - topicNameLink = (value:string) : Locator => this.page.getByRole('link', { name: value }) + get heading(): Locator { return this.page.getByRole("heading", { name: "Topics" }); } + get searchField(): Locator { return this.page.getByRole('textbox', { name: 'Search by Topic Name' }); } + get searchFieldCleanText(): Locator { return this.page.getByRole('button').filter({ hasText: /^$/ }).locator('path'); } + get showInternalTopics(): Locator { return this.page.locator('label').filter({ hasText: 'Show Internal Topics' }).locator('span'); } + get addTopicButton(): Locator { return this.page.getByRole('button', { name: 'Add a Topic' }); } + get selectAllCheckbox(): Locator { return this.page.getByRole('row', { name: 'Topic Name Partitions Out of' }).getByRole('checkbox'); } + get deleteSelectedTopicsButton(): Locator { return this.page.getByRole('button', { name: 'Delete selected topics' }); } + get copySelectedTopicButton(): Locator { return this.page.getByRole('button', { name: 'Copy selected topic' }); } + get purgeMessagesOfSelectedTopicsButton(): Locator { return this.page.getByRole('button', { name: 'Purge messages of selected' }); } + get selectAllCheckBox(): Locator { return this.page.getByRole('row', { name: 'Topic Name Partitions Out of' }).getByRole('checkbox'); } + rowCheckBox(message: string): Locator { return this.page.getByRole('row', { name: message }).getByRole('checkbox'); } + nameLink(value: string): Locator { return this.page.getByRole('link', { name: value }); } } \ No newline at end of file diff --git a/e2e-playwright/src/steps/Topics.steps.ts b/e2e-playwright/src/steps/Topics.steps.ts index 7d6109a33..42cb51664 100644 --- a/e2e-playwright/src/steps/Topics.steps.ts +++ b/e2e-playwright/src/steps/Topics.steps.ts @@ -1,72 +1,73 @@ +/* eslint-disable no-unused-vars */ import { Given, When, Then, setDefaultTimeout } from "@cucumber/cucumber"; import { expect } from "@playwright/test"; import { expectVisibility, ensureCheckboxState } from "../services/uiHelper"; -import { PlaywrightCustomWorld } from "../support/PlaywrightCustomWorld"; +import { PlaywrightWorld } from "../support/PlaywrightWorld"; setDefaultTimeout(60 * 1000 * 2); Given('Topics Serchfield visible', async function() { - await expect(this.locators.topics.topicSearchField()).toBeVisible(); + await expect(this.locators.topics.searchField).toBeVisible(); }); Given('Topics ShowInternalTopics visible', async function() { - await expect(this.locators.topics.topicShowInternalTopics()).toBeVisible(); + await expect(this.locators.topics.showInternalTopics).toBeVisible(); }); Given('Topics AddATopic visible', async function() { - await expect(this.locators.topics.topicAddTopicButton()).toBeVisible(); + await expect(this.locators.topics.addTopicButton).toBeVisible(); }); -Given('Topics DeleteSelectedTopics active is: {string}', async function(this: PlaywrightCustomWorld, state: string) { - const isEnabled = await this.locators.topics.topicDeleteSelectedTopicsButton().isEnabled(); +Given('Topics DeleteSelectedTopics active is: {string}', async function(this: PlaywrightWorld, state: string) { + const isEnabled = await this.locators.topics.deleteSelectedTopicsButton.isEnabled(); expect(isEnabled.toString()).toBe(state); }); -Given('Topics CopySelectedTopic active is: {string}', async function(this: PlaywrightCustomWorld, state: string) { - const isEnabled = await this.locators.topics.topicCopySelectedTopicButton().isEnabled(); +Given('Topics CopySelectedTopic active is: {string}', async function(this: PlaywrightWorld, state: string) { + const isEnabled = await this.locators.topics.copySelectedTopicButton.isEnabled(); expect(isEnabled.toString()).toBe(state); }); -Given('Topics PurgeMessagesOfSelectedTopics active is: {string}', async function(this: PlaywrightCustomWorld, state: string) { - const isEnabled = await this.locators.topics.topicPurgeMessagesOfSelectedTopicsButton().isEnabled(); +Given('Topics PurgeMessagesOfSelectedTopics active is: {string}', async function(this: PlaywrightWorld, state: string) { + const isEnabled = await this.locators.topics.purgeMessagesOfSelectedTopicsButton.isEnabled(); expect(isEnabled.toString()).toBe(state); }); -When('Topic SelectAllTopic visible is: {string}', async function(this: PlaywrightCustomWorld, visible: string) { - await expectVisibility(this.locators.topics.topicSelectAllCheckBox(), visible); +When('Topic SelectAllTopic visible is: {string}', async function(this: PlaywrightWorld, visible: string) { + await expectVisibility(this.locators.topics.selectAllCheckBox, visible); }); -Then('Topic SelectAllTopic checked is: {string}', async function(this: PlaywrightCustomWorld, state: string) { - const checkbox = this.locators.topics.topicSelectAllCheckBox(); +Then('Topic SelectAllTopic checked is: {string}', async function(this: PlaywrightWorld, state: string) { + const checkbox = this.locators.topics.selectAllCheckBox; await ensureCheckboxState(checkbox, state); const actual = await checkbox.isChecked(); expect(actual.toString()).toBe(state); }); -When('Topics serchfield input {string}', async function(this: PlaywrightCustomWorld, topicName: string) { - const textBox = this.locators.topics.topicSearchField(); +When('Topics serchfield input {string}', async function(this: PlaywrightWorld, topicName: string) { + const textBox = this.locators.topics.searchField; await textBox.fill(topicName); const actual = await textBox.inputValue(); expect(actual).toBe(topicName); }); -Then('Topic named: {string} visible is: {string}', async function(this: PlaywrightCustomWorld, topicName: string, visible: string) { - await expectVisibility(this.locators.topics.topicNameLink(topicName), visible); +Then('Topic named: {string} visible is: {string}', async function(this: PlaywrightWorld, topicName: string, visible: string) { + await expectVisibility(this.locators.topics.nameLink(topicName), visible); }); -When('Topic serchfield input cleared', async function() { - const textBox = this.locators.topics.topicSearchField(); +When('Topic serchfield input cleared', async function(this: PlaywrightWorld) { + const textBox = this.locators.topics.searchField; await textBox.fill(''); const text = await textBox.inputValue(); expect(text).toBe(''); }); -When('Topics ShowInternalTopics switched is: {string}', async function(this: PlaywrightCustomWorld, state: string) { - const checkBox = this.locators.topics.topicShowInternalTopics(); +When('Topics ShowInternalTopics switched is: {string}', async function(this: PlaywrightWorld, state: string) { + const checkBox = this.locators.topics.showInternalTopics; await ensureCheckboxState(checkBox, state); }); -When('Topic row named: {string} checked is: {string}', async function(this: PlaywrightCustomWorld, topicName: string, state: string) { - const checkbox = this.locators.topics.topicRowCheckBox(topicName); +When('Topic row named: {string} checked is: {string}', async function(this: PlaywrightWorld, topicName: string, state: string) { + const checkbox = this.locators.topics.rowCheckBox(topicName); await ensureCheckboxState(checkbox, state); }); diff --git a/e2e-playwright/src/steps/TopicsCreate.steps.ts b/e2e-playwright/src/steps/TopicsCreate.steps.ts index cb5be6697..26996c3c4 100644 --- a/e2e-playwright/src/steps/TopicsCreate.steps.ts +++ b/e2e-playwright/src/steps/TopicsCreate.steps.ts @@ -1,136 +1,137 @@ +/* eslint-disable no-unused-vars */ import { Given, When, Then, setDefaultTimeout } from "@cucumber/cucumber"; import { expect } from "@playwright/test"; -import { PlaywrightCustomWorld } from "../support/PlaywrightCustomWorld"; +import { PlaywrightWorld } from "../support/PlaywrightWorld"; import { expectVisibility } from "../services/uiHelper"; import { generateName } from "../services/commonFunctions"; setDefaultTimeout(60 * 1000 * 2); -Given('Topics AddATopic clicked', async function() { - const button = this.locators.topics.topicAddTopicButton(); +Given('Topics AddATopic clicked', async function(this: PlaywrightWorld) { + const button = this.locators.topics.addTopicButton; await expect(button).toBeVisible(); await button.click(); }); -Given('TopicCreate heading visible is: {string}', async function(this: PlaywrightCustomWorld, visible: string) { - await expectVisibility(this.locators.topicsCreate.topicsCreateHeading(), visible); +Given('TopicCreate heading visible is: {string}', async function(this: PlaywrightWorld, visible: string) { + await expectVisibility(this.locators.topicsCreate.heading, visible); }); -Given('TopicCreate TopicName input visible is: {string}', async function(this: PlaywrightCustomWorld, visible: string) { - await expectVisibility(this.locators.topicsCreate.topicsCreateTopicName(), visible); +Given('TopicCreate TopicName input visible is: {string}', async function(this: PlaywrightWorld, visible: string) { + await expectVisibility(this.locators.topicsCreate.topicName, visible); }); -Given('TopicCreate NumberOfPartitions input visible is: {string}', async function(this: PlaywrightCustomWorld, visible: string) { - await expectVisibility(this.locators.topicsCreate.topicsCreateNumberOfPartitions(), visible); +Given('TopicCreate NumberOfPartitions input visible is: {string}', async function(this: PlaywrightWorld, visible: string) { + await expectVisibility(this.locators.topicsCreate.numberOfPartitions, visible); }); -Given('TopicCreate CleanupPolicy select visible is: {string}', async function(this: PlaywrightCustomWorld, visible: string) { - await expectVisibility(this.locators.topicsCreate.topicsCreateCleanupPolicy(), visible); +Given('TopicCreate CleanupPolicy select visible is: {string}', async function(this: PlaywrightWorld, visible: string) { + await expectVisibility(this.locators.topicsCreate.cleanupPolicy, visible); }); -Given('TopicCreate MinInSyncReplicas input visible is: {string}', async function(this: PlaywrightCustomWorld, visible: string) { - await expectVisibility(this.locators.topicsCreate.topicsCreateMinInSyncReplicas(), visible); +Given('TopicCreate MinInSyncReplicas input visible is: {string}', async function(this: PlaywrightWorld, visible: string) { + await expectVisibility(this.locators.topicsCreate.minInSyncReplicas, visible); }); -Given('TopicCreate ReplicationFactor input visible is: {string}', async function(this: PlaywrightCustomWorld, visible: string) { - await expectVisibility(this.locators.topicsCreate.topicsCreateReplicationFactor(), visible); +Given('TopicCreate ReplicationFactor input visible is: {string}', async function(this: PlaywrightWorld, visible: string) { + await expectVisibility(this.locators.topicsCreate.replicationFactor, visible); }); -Given('TopicCreate TimeToRetainData input visible is: {string}', async function(this: PlaywrightCustomWorld, visible: string) { - await expectVisibility(this.locators.topicsCreate.topicsCreateTimeToRetainData(), visible); +Given('TopicCreate TimeToRetainData input visible is: {string}', async function(this: PlaywrightWorld, visible: string) { + await expectVisibility(this.locators.topicsCreate.timeToRetainData, visible); }); -Given('TopicCreate 12Hours button visible is: {string}', async function(this: PlaywrightCustomWorld, visible: string) { - await expectVisibility(this.locators.topicsCreate.topicsCreate12Hours(), visible); +Given('TopicCreate 12Hours button visible is: {string}', async function(this: PlaywrightWorld, visible: string) { + await expectVisibility(this.locators.topicsCreate.button12Hours, visible); }); -Given('TopicCreate 1Day button visible is: {string}', async function(this: PlaywrightCustomWorld, visible: string) { - await expectVisibility(this.locators.topicsCreate.topicsCreate1Day(), visible); +Given('TopicCreate 1Day button visible is: {string}', async function(this: PlaywrightWorld, visible: string) { + await expectVisibility(this.locators.topicsCreate.button1Day, visible); }); -Given('TopicCreate 2Day button visible is: {string}', async function(this: PlaywrightCustomWorld, visible: string) { - await expectVisibility(this.locators.topicsCreate.topicsCreate2Day(), visible); +Given('TopicCreate 2Day button visible is: {string}', async function(this: PlaywrightWorld, visible: string) { + await expectVisibility(this.locators.topicsCreate.button2Day, visible); }); -Given('TopicCreate 7Day button visible is: {string}', async function(this: PlaywrightCustomWorld, visible: string) { - await expectVisibility(this.locators.topicsCreate.topicsCreate7Day(), visible); +Given('TopicCreate 7Day button visible is: {string}', async function(this: PlaywrightWorld, visible: string) { + await expectVisibility(this.locators.topicsCreate.button7Day, visible); }); -Given('TopicCreate 4Weeks button visible is: {string}', async function(this: PlaywrightCustomWorld, visible: string) { - await expectVisibility(this.locators.topicsCreate.topicsCreate4Weeks(), visible); +Given('TopicCreate 4Weeks button visible is: {string}', async function(this: PlaywrightWorld, visible: string) { + await expectVisibility(this.locators.topicsCreate.button4Weeks, visible); }); -Given('TopicCreate MaxPartitionSize select visible is: {string}', async function(this: PlaywrightCustomWorld, visible: string) { - await expectVisibility(this.locators.topicsCreate.topicsCreateMaxPartitionSize(), visible); +Given('TopicCreate MaxPartitionSize select visible is: {string}', async function(this: PlaywrightWorld, visible: string) { + await expectVisibility(this.locators.topicsCreate.maxPartitionSize, visible); }); -Given('TopicCreate MaxMessageSize input visible is: {string}', async function(this: PlaywrightCustomWorld, visible: string) { - await expectVisibility(this.locators.topicsCreate.topicsCreateMaxMessageSize(), visible); +Given('TopicCreate MaxMessageSize input visible is: {string}', async function(this: PlaywrightWorld, visible: string) { + await expectVisibility(this.locators.topicsCreate.maxMessageSize, visible); }); -Given('TopicCreate AddCustomParameter button visible is: {string}', async function(this: PlaywrightCustomWorld, visible: string) { - await expectVisibility(this.locators.topicsCreate.topicsCreateAddCustomParameter(), visible); +Given('TopicCreate AddCustomParameter button visible is: {string}', async function(this: PlaywrightWorld, visible: string) { + await expectVisibility(this.locators.topicsCreate.addCustomParameter, visible); }); -Given('TopicCreate Cancel button visible is: {string}', async function(this: PlaywrightCustomWorld, visible: string) { - await expectVisibility(this.locators.topicsCreate.topicsCreateCancel(), visible); +Given('TopicCreate Cancel button visible is: {string}', async function(this: PlaywrightWorld, visible: string) { + await expectVisibility(this.locators.topicsCreate.cancel, visible); }); -Given('TopicCreate CreateTopic button visible is: {string}', async function(this: PlaywrightCustomWorld, visible: string) { - await expectVisibility(this.locators.topicsCreate.topicCreateCreateTopicButton(), visible); +Given('TopicCreate CreateTopic button visible is: {string}', async function(this: PlaywrightWorld, visible: string) { + await expectVisibility(this.locators.topicsCreate.createTopicButton, visible); }); -When('TopicCreate Topic name starts with: {string}', async function(this: PlaywrightCustomWorld, prefix: string) { +When('TopicCreate Topic name starts with: {string}', async function(this: PlaywrightWorld, prefix: string) { const topicName = generateName(prefix); this.setValue(`topicName-${prefix}`, topicName); - await this.locators.topicsCreate.topicsCreateTopicName().fill(topicName); + await this.locators.topicsCreate.topicName.fill(topicName); }); -When('TopicCreate Number of partitons: {int}', async function(this: PlaywrightCustomWorld, count: number) { - await this.locators.topicsCreate.topicsCreateNumberOfPartitions().fill(count.toString()); +When('TopicCreate Number of partitons: {int}', async function(this: PlaywrightWorld, count: number) { + await this.locators.topicsCreate.numberOfPartitions.fill(count.toString()); }); When('TopicCreate Time to retain data one day', async function() { - await this.locators.topicsCreate.topicsCreate1Day().click(); + await this.locators.topicsCreate.button1Day.click(); }); When('TopicCreate Create topic clicked', async function() { - await this.locators.topicsCreate.topicCreateCreateTopicButton().click(); + await this.locators.topicsCreate.createTopicButton.click(); }); -Then('Header starts with: {string}', async function(this: PlaywrightCustomWorld, prefix: string) { +Then('Header starts with: {string}', async function(this: PlaywrightWorld, prefix: string) { const topicName = this.getValue(`topicName-${prefix}`); const header = this.page.getByRole('heading', { name: topicName }); await expect(header).toBeVisible(); }); -Then('Topic name started with: {string} visible is: {string}', async function(this: PlaywrightCustomWorld, prefix: string, visible: string) { +Then('Topic name started with: {string} visible is: {string}', async function(this: PlaywrightWorld, prefix: string, visible: string) { const topicName = this.getValue(`topicName-${prefix}`); - await expectVisibility(this.locators.topics.topicNameLink(topicName), visible); + await expectVisibility(this.locators.topics.nameLink(topicName), visible); }); -Then('TopicCreate TimeToRetainData value is: {string}', async function(this: PlaywrightCustomWorld, expectedValue: string) { - const input = this.locators.topicsCreate.topicsCreateTimeToRetainData(); +Then('TopicCreate TimeToRetainData value is: {string}', async function(this: PlaywrightWorld, expectedValue: string) { + const input = this.locators.topicsCreate.timeToRetainData; const actualValue = await input.inputValue(); expect(actualValue).toBe(expectedValue); }); When('TopicCreate 12Hours button clicked', async function() { - await this.locators.topicsCreate.topicsCreate12Hours().click(); + await this.locators.topicsCreate.button12Hours.click(); }); When('TopicCreate 1Day button clicked', async function() { - await this.locators.topicsCreate.topicsCreate1Day().click(); + await this.locators.topicsCreate.button1Day.click(); }); When('TopicCreate 2Day button clicked', async function() { - await this.locators.topicsCreate.topicsCreate2Day().click(); + await this.locators.topicsCreate.button2Day.click(); }); When('TopicCreate 7Day button clicked', async function() { - await this.locators.topicsCreate.topicsCreate7Day().click(); + await this.locators.topicsCreate.button7Day.click(); }); When('TopicCreate 4Weeks button clicked', async function() { - await this.locators.topicsCreate.topicsCreate4Weeks().click(); + await this.locators.topicsCreate.button4Weeks.click(); }); diff --git a/e2e-playwright/src/steps/navigation.steps.ts b/e2e-playwright/src/steps/navigation.steps.ts index ee691f051..cbd6bf2fb 100644 --- a/e2e-playwright/src/steps/navigation.steps.ts +++ b/e2e-playwright/src/steps/navigation.steps.ts @@ -1,108 +1,109 @@ +/* eslint-disable no-unused-vars */ import { Given, When, Then, setDefaultTimeout } from "@cucumber/cucumber"; import expect from "../helper/util/expect"; -import { PlaywrightCustomWorld } from "../support/PlaywrightCustomWorld"; +import { PlaywrightWorld } from "../support/PlaywrightWorld"; setDefaultTimeout(60 * 1000 * 2); Given('Brokers is visible', async function() { await this.page.goto(process.env.BASEURL!); - await expect(this.locators.panel.brokersLink()).toBeVisible(); + await expect(this.locators.panel.brokersLink).toBeVisible(); }); When('click on Brokers link', async function() { - await this.locators.panel.brokersLink().click(); + await this.locators.panel.brokersLink.click(); }); Then('Brokers heading visible', async function() { - await this.locators.brokers.brokersHeading().waitFor({ state: 'visible' }); + await this.locators.brokers.heading.waitFor({ state: 'visible' }); }); Given('Topics is visible', async function() { await this.page.goto(process.env.BASEURL!); - await expect(this.locators.panel.topicsLink()).toBeVisible(); + await expect(this.locators.panel.topicsLink).toBeVisible(); }); When('click on Topics link', async function() { - await this.locators.panel.topicsLink().click(); + await this.locators.panel.topicsLink.click(); }); Then('Topics heading visible', async function() { - await this.locators.topics.topicsHeading().waitFor({ state: 'visible' }); + await this.locators.topics.heading.waitFor({ state: 'visible' }); }); Given('Consumers is visible', async function() { await this.page.goto(process.env.BASEURL!); - await expect(this.locators.panel.consumersLink()).toBeVisible(); + await expect(this.locators.panel.consumersLink).toBeVisible(); }); When('click on Consumers link', async function() { - await this.locators.panel.consumersLink().click(); + await this.locators.panel.consumersLink.click(); }); Then('Consumers heading visible', async function() { - await this.locators.consumers.consumersHeading().waitFor({ state: 'visible' }); + await this.locators.consumers.heading.waitFor({ state: 'visible' }); }); Given('Schema Registry is visible', async function() { await this.page.goto(process.env.BASEURL!); - await expect(this.locators.panel.schemaRegistryLink()).toBeVisible(); + await expect(this.locators.panel.schemaRegistryLink).toBeVisible(); }); When('click on Schema Registry link', async function() { - await this.locators.panel.schemaRegistryLink().click(); + await this.locators.panel.schemaRegistryLink.click(); }); Then('Schema Registry heading visible', async function() { - await this.locators.schemaRegistry.schemaRegistryHeading().waitFor({ state: 'visible' }); + await this.locators.schemaRegistry.heading.waitFor({ state: 'visible' }); }); Given('Kafka Connect is visible', async function() { await this.page.goto(process.env.BASEURL!); - await expect(this.locators.panel.kafkaConnectLink()).toBeVisible(); + await expect(this.locators.panel.kafkaConnectLink).toBeVisible(); }); When('click on Kafka Connect link', async function() { - await this.locators.panel.kafkaConnectLink().click(); + await this.locators.panel.kafkaConnectLink.click(); }); Then('Kafka Connect heading visible', async function() { - await this.locators.connectors.connectorsHeading().waitFor({ state: 'visible' }); + await this.locators.connectors.heading.waitFor({ state: 'visible' }); }); Given('KSQL DB is visible', async function() { await this.page.goto(process.env.BASEURL!); - await expect(this.locators.panel.ksqlDbLink()).toBeVisible(); + await expect(this.locators.panel.ksqlDbLink).toBeVisible(); }); -When('click on KSQL DB link', async function() { - await this.locators.panel.ksqlDbLink().click(); +When('click on KSQL DB link', async function(this: PlaywrightWorld) { + await this.locators.panel.ksqlDbLink.click(); }); -Then('KSQL DB heading visible', async function() { - await this.locators.ksqlDb.ksqlDbHeading().waitFor({ state: 'visible' }); +Then('KSQL DB heading visible', async function(this: PlaywrightWorld) { + await this.locators.ksqlDb.heading.waitFor({ state: 'visible' }); }); Given('Dashboard is visible', async function() { await this.page.goto(process.env.BASEURL!); - await expect(this.locators.panel.getDashboardLink()).toBeVisible(); + expect(this.locators.panel.getDashboardLink.isVisible()); }); -When('click on Dashboard link', async function() { - const dashboard = this.locators.panel.getDashboardLink(); - await dashboard.isVisible(); // Optional: could be removed if already handled in expect above +When('click on Dashboard link', async function(this: PlaywrightWorld) { + const dashboard = this.locators.panel.getDashboardLink; + await dashboard.isVisible(); await dashboard.click(); }); Then('Dashboard heading visible', async function() { - await this.locators.dashboard.dashboardHeading().waitFor({ state: 'visible' }); + await this.locators.dashboard.heading.waitFor({ state: 'visible' }); }); -Then('the end of current URL should be {string}', async function(this: PlaywrightCustomWorld, expected: string) { +Then('the end of current URL should be {string}', async function(this: PlaywrightWorld, expected: string) { const actual = new URL(this.page.url()).pathname; expect(actual.endsWith(expected)).toBeTruthy(); }); -Then('the part of current URL should be {string}', async function(this: PlaywrightCustomWorld, expected: string) { +Then('the part of current URL should be {string}', async function(this: PlaywrightWorld, expected: string) { const actual = new URL(this.page.url()).pathname; expect(actual.includes(expected)).toBeTruthy(); }); diff --git a/e2e-playwright/src/support/PlaywrightCustomWorld.ts b/e2e-playwright/src/support/PlaywrightWorld.ts similarity index 96% rename from e2e-playwright/src/support/PlaywrightCustomWorld.ts rename to e2e-playwright/src/support/PlaywrightWorld.ts index 41d54f92e..5f6115109 100644 --- a/e2e-playwright/src/support/PlaywrightCustomWorld.ts +++ b/e2e-playwright/src/support/PlaywrightWorld.ts @@ -6,7 +6,7 @@ import { createLogger } from "winston"; import { options } from "../helper/util/logger"; import { Locators } from '../pages/Locators'; -export class PlaywrightCustomWorld extends World { +export class PlaywrightWorld extends World { public logger?: Logger; public browserContext?: BrowserContext; From 0a84b062770fa81efc24bbd669fa2afcf3f5ea05 Mon Sep 17 00:00:00 2001 From: AspidDark Date: Sun, 1 Jun 2025 00:37:12 +0300 Subject: [PATCH 05/14] Topic messages --- .../src/features/TopicsMessages.feature | 38 ++++++++ e2e-playwright/src/pages/Locators.ts | 12 +++ .../pages/Topics/ProduceMessageLocators.ts | 22 +++++ .../pages/Topics/TopicsTopickNameLocators.ts | 28 ++++++ e2e-playwright/src/steps/ProduceMessages.ts | 91 +++++++++++++++++++ 5 files changed, 191 insertions(+) create mode 100644 e2e-playwright/src/features/TopicsMessages.feature create mode 100644 e2e-playwright/src/pages/Topics/ProduceMessageLocators.ts create mode 100644 e2e-playwright/src/pages/Topics/TopicsTopickNameLocators.ts create mode 100644 e2e-playwright/src/steps/ProduceMessages.ts diff --git a/e2e-playwright/src/features/TopicsMessages.feature b/e2e-playwright/src/features/TopicsMessages.feature new file mode 100644 index 000000000..fc9ff1c48 --- /dev/null +++ b/e2e-playwright/src/features/TopicsMessages.feature @@ -0,0 +1,38 @@ +Feature: Produce Messages page + Scenario: TopicName ui + Given Topics is visible + When click on Topics link + Given Topics AddATopic clicked + Given TopicCreate heading visible is: "true" + When TopicCreate Topic name starts with: "ANewAutoTopic" + When TopicCreate Number of partitons: 1 + When TopicCreate Time to retain data one day + When TopicCreate Create topic clicked + Then Header starts with: "ANewAutoTopic" + Given Topics TopicName partitions is: 1 + Given Topics TopicName Overview visible is: "true" + Given Topics TopicName Messages visible is: "true" + Given Topics TopicName Consumers visible is: "true" + Given Topics TopicName Settings visible is: "true" + Given Topics TopicName Statistics visible is: "true" + + Scenario: Produce Message + Given Topics is visible + When click on Topics link + Given Topics AddATopic clicked + Given TopicCreate heading visible is: "true" + When TopicCreate Topic name starts with: "ANewAutoTopic" + When TopicCreate Number of partitons: 1 + When TopicCreate Time to retain data one day + When TopicCreate Create topic clicked + Then Header starts with: "ANewAutoTopic" + Given Produce message clicked + Then ProduceMessage header visible + Given ProduceMessage Key input is: "keyFromAutotest" + Given ProduceMessage Value input is: "ValueFromAutotest" + Given ProduceMessage Headers input key is: "headerKey", value is: "headerValue" + Given ProduceMessage Produce Message button clicked + When Topics TopicName Messages clicked + Then TopicName messages contains key: "keyFromAutotest" + Then TopicName messages contains value: "ValueFromAutotest" + Then TopicName messages contains headers key is: "headerKey", value is: "headerValue" diff --git a/e2e-playwright/src/pages/Locators.ts b/e2e-playwright/src/pages/Locators.ts index 924762740..ceb2ab624 100644 --- a/e2e-playwright/src/pages/Locators.ts +++ b/e2e-playwright/src/pages/Locators.ts @@ -8,6 +8,8 @@ import SchemaRegistryLocators from "./SchemaRegistry/SchemaRegistryLocators"; import ConnectorsLocators from "./Connectors/ConnectorsLocators"; import ksqlDbLocators from "./KSQLDB/ksqldbLocators"; import DashboardLocators from "./Dashboard/DashboardLocators"; +import TopicsTopickNameLocators from "./Topics/TopicsTopickNameLocators" +import ProduceMessageLocators from "./Topics/ProduceMessageLocators" export class Locators { private readonly page: Page; @@ -16,6 +18,8 @@ export class Locators { private _brokers?: BrokersLocators; private _topics?: TopicsLocators; private _topicsCreate?: TopicCreateLocators; + private _topicTopicName?: TopicsTopickNameLocators; + private _produceMessage?: ProduceMessageLocators; private _consumers?: ConsumersLocators; private _schemaRegistry?: SchemaRegistryLocators; private _connectors?: ConnectorsLocators; @@ -42,6 +46,14 @@ export class Locators { return (this._topicsCreate ??= new TopicCreateLocators(this.page)); } + get topicTopicName() { + return (this._topicTopicName ??= new TopicsTopickNameLocators(this.page)); + } + + get produceMessage() { + return (this._produceMessage ??= new ProduceMessageLocators(this.page)); + } + get consumers() { return (this._consumers ??= new ConsumersLocators(this.page)); } diff --git a/e2e-playwright/src/pages/Topics/ProduceMessageLocators.ts b/e2e-playwright/src/pages/Topics/ProduceMessageLocators.ts new file mode 100644 index 000000000..b46577cb0 --- /dev/null +++ b/e2e-playwright/src/pages/Topics/ProduceMessageLocators.ts @@ -0,0 +1,22 @@ +import { Page, Locator } from "@playwright/test"; + +export default class ProduceMessageLocators { + private readonly page: Page; + + constructor(page: Page) { + this.page = page; + } + + get heading(): Locator { return this.page.getByText('Produce Message').nth(1); } + get keySerdeDropdown(): Locator { return this.page.locator('#selectKeySerdeOptions').getByRole('img'); } + get valueSerdeDropdown(): Locator { return this.page.locator('#selectValueSerdeOptions path'); } + get keyTextbox(): Locator { return this.page.locator('#key').getByRole('textbox'); } + get valueTextbox(): Locator { return this.page.locator('#content').getByRole('textbox'); } + get headersTextbox(): Locator { return this.page.locator('#headers').getByRole('textbox'); } + get produceMessage():Locator { return this.page.locator('form').getByRole('button', { name: 'Produce Message' }); } + + partitionDropdown(vakue:string = 'Partition #'): Locator { return this.page.getByRole('listbox', { name: vakue }); } + partitionDropdownElement(value: string): Locator { return this.page.getByRole('list').getByRole('option', { name: value }); } + keySerdeDropdownElement(value: string): Locator { return this.page.getByRole('list').getByRole('option', { name: value }); } + valueSerdeDropdownElement(value: string): Locator { return this.page.getByRole('list').getByRole('option', { name: value }); } +} \ No newline at end of file diff --git a/e2e-playwright/src/pages/Topics/TopicsTopickNameLocators.ts b/e2e-playwright/src/pages/Topics/TopicsTopickNameLocators.ts new file mode 100644 index 000000000..1f6602da9 --- /dev/null +++ b/e2e-playwright/src/pages/Topics/TopicsTopickNameLocators.ts @@ -0,0 +1,28 @@ +import { Page, Locator } from "@playwright/test"; + +export default class TopicsTopickNameLocators { + private readonly page: Page; + + constructor(page: Page) { + this.page = page; + } + + get overview():Locator { return this.page.getByRole('link', { name: 'Overview' }); } + get messages():Locator { return this.page.getByRole('link', { name: 'Messages' }); } + get consumers():Locator { return this.page.getByRole('main').getByRole('navigation').getByRole('link', { name: 'Consumers' }); } + get settings():Locator { return this.page.getByRole('link', { name: 'Settings' }); } + get statistics():Locator { return this.page.getByRole('link', { name: 'Statistics' }); } + get produceMessage():Locator { return this.page.getByRole('button', { name: 'Produce Message' }).first(); } + get keyButton():Locator { return this.page.getByRole('button', { name: 'Key' }); } + get valueButton():Locator { return this.page.getByRole('button', { name: 'Value' }); } + get headersButton():Locator { return this.page.getByRole('button', { name: 'Headers' }); } + + heading(topicName: string): Locator { return this.page.getByText(`Topics${topicName}`); } + partitions(value: string):Locator { return this.page.getByRole('group').getByText(value).first(); } + messageKey(value: string):Locator { return this.page.getByText(value, { exact: true }); } + messageValue(value: string):Locator { return this.page.getByText(value).first(); } + + messageKeyTextbox(value: string):Locator { return this.page.locator('#schema div').filter({ hasText: value }).nth(1); } + messageValueTextbox(value: string):Locator { return this.page.locator('div').filter({ hasText:value }).nth(1); } + messageHeadersTextbox(value: string):Locator { return this.page.locator('div').filter({ hasText: value }).nth(1); } +} \ No newline at end of file diff --git a/e2e-playwright/src/steps/ProduceMessages.ts b/e2e-playwright/src/steps/ProduceMessages.ts new file mode 100644 index 000000000..8897c5fb0 --- /dev/null +++ b/e2e-playwright/src/steps/ProduceMessages.ts @@ -0,0 +1,91 @@ +/* eslint-disable no-unused-vars */ +import { Given, When, Then, setDefaultTimeout } from "@cucumber/cucumber"; +import { expect } from "@playwright/test"; +import { expectVisibility, ensureCheckboxState } from "../services/uiHelper"; +import { PlaywrightWorld } from "../support/PlaywrightWorld"; + +setDefaultTimeout(60 * 1000 * 2); + +Given('Topics TopicName partitions is: {int}', async function(this: PlaywrightWorld, count: number) { + await expectVisibility(this.locators.topicTopicName.partitions(count.toString()), 'true'); +}); + +Given('Topics TopicName Overview visible is: {string}', async function(this: PlaywrightWorld, visible: string) { + await expectVisibility(this.locators.topicTopicName.overview, visible); +}); + +Given('Topics TopicName Messages visible is: {string}', async function(this: PlaywrightWorld, visible: string) { + await expectVisibility(this.locators.topicTopicName.messages, visible); +}); + +Given('Topics TopicName Consumers visible is: {string}', async function(this: PlaywrightWorld, visible: string) { + await expectVisibility(this.locators.topicTopicName.consumers, visible); +}); + +Given('Topics TopicName Settings visible is: {string}', async function(this: PlaywrightWorld, visible: string) { + await expectVisibility(this.locators.topicTopicName.settings, visible); +}); + +Given('Topics TopicName Statistics visible is: {string}', async function(this: PlaywrightWorld, visible: string) { + await expectVisibility(this.locators.topicTopicName.statistics, visible); +}); +////////////// +Given('Produce message clicked', async function(this: PlaywrightWorld) { + await this.locators.topicTopicName.produceMessage.click(); +}); + +Then('ProduceMessage header visible', async function(this: PlaywrightWorld) { + await expect(this.locators.produceMessage.heading).toBeVisible(); +}); + +Given('ProduceMessage Key input is: {string}', async function(this: PlaywrightWorld, key: string) { + const textbox = this.locators.produceMessage.keyTextbox; + await textbox.fill(key); + + const actualValue = await textbox.inputValue(); + expect(actualValue).toContain(key); +}); + +Given('ProduceMessage Value input is: {string}', async function(this: PlaywrightWorld, value: string) { + const textbox = this.locators.produceMessage.valueTextbox; + await textbox.fill(value); + + const actualValue = await textbox.inputValue(); + expect(actualValue).toContain(value); +}); + +Given('ProduceMessage Headers input key is: {string}, value is: {string}', async function(this: PlaywrightWorld, key: string, value: string) { + const header = `{"${key}":"${value}"}`; + const textbox = this.locators.produceMessage.headersTextbox; + await textbox.clear(); + await textbox.fill(header); + + const actualValue = await textbox.inputValue(); + expect(actualValue).toContain(header); + } +); + +Given('ProduceMessage Produce Message button clicked', async function(this: PlaywrightWorld) { + await this.locators.produceMessage.produceMessage.click(); +}); + +When('Topics TopicName Messages clicked', async function(this: PlaywrightWorld) { + await this.locators.topicTopicName.messages.click(); +}); + +Then('TopicName messages contains key: {string}', async function(this: PlaywrightWorld, expectedKey: string) { + await this.locators.topicTopicName.messageValue(expectedKey).click() + await this.locators.topicTopicName.keyButton.click(); + await expectVisibility(this.locators.topicTopicName.messageKeyTextbox(expectedKey), "true"); +}); + +Then('TopicName messages contains value: {string}', async function(this: PlaywrightWorld, expectedValue: string) { + await this.locators.topicTopicName.valueButton.click() + await expectVisibility(this.locators.topicTopicName.messageValue(expectedValue), "true"); +}); + +Then('TopicName messages contains headers key is: {string}, value is: {string}', async function(this: PlaywrightWorld, headerKey: string, headerValue: string) { + const expectedHeader = `"${headerKey}":"${headerValue}"`; + await this.locators.topicTopicName.headersButton.click() + await expectVisibility(this.locators.topicTopicName.messageHeadersTextbox(expectedHeader), "true"); +}); \ No newline at end of file From 6977e63d48d74701c6ee8e755819d649dd8dc391 Mon Sep 17 00:00:00 2001 From: AspidDark Date: Sun, 1 Jun 2025 00:42:28 +0300 Subject: [PATCH 06/14] clean --- e2e-playwright/src/steps/ProduceMessages.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e-playwright/src/steps/ProduceMessages.ts b/e2e-playwright/src/steps/ProduceMessages.ts index 8897c5fb0..3a78f110c 100644 --- a/e2e-playwright/src/steps/ProduceMessages.ts +++ b/e2e-playwright/src/steps/ProduceMessages.ts @@ -29,7 +29,7 @@ Given('Topics TopicName Settings visible is: {string}', async function(this: Pla Given('Topics TopicName Statistics visible is: {string}', async function(this: PlaywrightWorld, visible: string) { await expectVisibility(this.locators.topicTopicName.statistics, visible); }); -////////////// + Given('Produce message clicked', async function(this: PlaywrightWorld) { await this.locators.topicTopicName.produceMessage.click(); }); From ca661064278c5a830f3dbe66e5de5d455cfd004e Mon Sep 17 00:00:00 2001 From: AspidDark Date: Tue, 3 Jun 2025 23:45:20 +0300 Subject: [PATCH 07/14] Topics base finished Brokers finished --- e2e-playwright/src/features/Brokers.feature | 31 ++++++++++ .../src/features/TopicsMessages.feature | 27 +++++++++ .../pages/Brokers/BrokerDetailsLocators.ts | 21 +++++++ .../src/pages/Brokers/BrokersLocators.ts | 4 ++ e2e-playwright/src/pages/Locators.ts | 6 ++ .../pages/Topics/TopicsTopickNameLocators.ts | 9 +++ e2e-playwright/src/services/uiHelper.ts | 34 +++++++++++ e2e-playwright/src/steps/Brokers.steps.ts | 60 +++++++++++++++++++ e2e-playwright/src/steps/ProduceMessages.ts | 23 ++++++- 9 files changed, 214 insertions(+), 1 deletion(-) create mode 100644 e2e-playwright/src/features/Brokers.feature create mode 100644 e2e-playwright/src/pages/Brokers/BrokerDetailsLocators.ts create mode 100644 e2e-playwright/src/steps/Brokers.steps.ts diff --git a/e2e-playwright/src/features/Brokers.feature b/e2e-playwright/src/features/Brokers.feature new file mode 100644 index 000000000..134558bc0 --- /dev/null +++ b/e2e-playwright/src/features/Brokers.feature @@ -0,0 +1,31 @@ +Feature: Brokers page + + Scenario: Brokers visibility BrokerDetails visibility + Given Brokers is visible + When click on Brokers link + Then Brokers heading visible + Then the end of current URL should be "brokers" + Given Brokers Uptime visible is: "true" + Given Brokers Partitions visible is: "true" + When Brokers cell element "1" clicked + Given BrokerDetails name is: "BrokersBroker" header visible is: "true" + Given BrokerDetails Log directories visible is: "true" + Given BrokerDetails Configs visible is: "true" + Given BrokerDetails Metrics visible is: "true" + + Scenario: Brokers visibility BrokerDetails visibility + Given Brokers is visible + When click on Brokers link + Then Brokers heading visible + Then the end of current URL should be "brokers" + Given Brokers Uptime visible is: "true" + Given Brokers Partitions visible is: "true" + When Brokers cell element "1" clicked + Given BrokerDetails name is: "BrokersBroker" header visible is: "true" + When BrokerDetails Configs clicked + Given BrokerDetails Configs Key visible is: "true" + Given BrokerDetails Configs Value visible is: "true" + Given BrokerDetails Configs Source visible is: "true" + Then BrokerDetails searchfield visible is: "true" + When BrokerDetails searchfield input is: "process.roles" cell value is: "broker,controller" + When BrokerDetails searchfield input is: "broker,controller" cell value is: "process.roles" \ No newline at end of file diff --git a/e2e-playwright/src/features/TopicsMessages.feature b/e2e-playwright/src/features/TopicsMessages.feature index fc9ff1c48..e92670e70 100644 --- a/e2e-playwright/src/features/TopicsMessages.feature +++ b/e2e-playwright/src/features/TopicsMessages.feature @@ -36,3 +36,30 @@ Feature: Produce Messages page Then TopicName messages contains key: "keyFromAutotest" Then TopicName messages contains value: "ValueFromAutotest" Then TopicName messages contains headers key is: "headerKey", value is: "headerValue" + + Scenario: Topic Message cleanup policy + Given Topics is visible + When click on Topics link + Given Topics AddATopic clicked + Given TopicCreate heading visible is: "true" + When TopicCreate Topic name starts with: "ANewAutoTopic" + When TopicCreate Number of partitons: 1 + When TopicCreate Time to retain data one day + When TopicCreate Create topic clicked + Then Header starts with: "ANewAutoTopic" + Given TopicName menu button clicked + Then TopicNameMenu clear messages active is: "true" + + When TopicNameMenu edit settings clicked + When TopicName cleanup policy set to: "Compact" + When TopicName UpdateTopic button clicked + Then Header starts with: "ANewAutoTopic" + Given TopicName menu button clicked + Then TopicNameMenu clear messages active is: "false" + + When TopicNameMenu edit settings clicked + When TopicName cleanup policy set to: "Delete" + When TopicName UpdateTopic button clicked + Then Header starts with: "ANewAutoTopic" + Given TopicName menu button clicked + Then TopicNameMenu clear messages active is: "true" \ No newline at end of file diff --git a/e2e-playwright/src/pages/Brokers/BrokerDetailsLocators.ts b/e2e-playwright/src/pages/Brokers/BrokerDetailsLocators.ts new file mode 100644 index 000000000..3f94fb07b --- /dev/null +++ b/e2e-playwright/src/pages/Brokers/BrokerDetailsLocators.ts @@ -0,0 +1,21 @@ +import { Page, Locator } from "@playwright/test"; + +export default class BrokerDetailsLocators { + private readonly page: Page; + + constructor(page: Page) { + this.page = page; + } + + get logDirectors(): Locator { return this.page.getByRole('link', { name: 'Log directories' })}; + get firstDefaultCell(): Locator { return this.page.getByRole('cell', { name: '/tmp/kraft-combined-logs' })}; + get configs(): Locator { return this.page.getByRole('link', { name: 'Configs' })}; + get configsTextbox(): Locator { return this.page.getByRole('textbox', { name: 'Search by Key or Value' })}; + get metrics(): Locator { return this.page.getByRole('link', { name: 'Metrics' })}; + get configsKey(): Locator { return this.page.getByRole('cell', { name: 'Key' })}; + get configsValue(): Locator { return this.page.getByRole('cell', { name: 'Value' })}; + get configsSource(): Locator { return this.page.getByRole('cell', { name: 'Source' })}; + + configCell(value: string): Locator { return this.page.getByRole('cell', { name: value })}; + header(value: string): Locator { return this.page.getByText(value)}; +} \ No newline at end of file diff --git a/e2e-playwright/src/pages/Brokers/BrokersLocators.ts b/e2e-playwright/src/pages/Brokers/BrokersLocators.ts index 7d38c8dbd..24587a095 100644 --- a/e2e-playwright/src/pages/Brokers/BrokersLocators.ts +++ b/e2e-playwright/src/pages/Brokers/BrokersLocators.ts @@ -8,4 +8,8 @@ export default class BrokersLocators { } get heading(): Locator { return this.page.getByRole('heading', { name: 'Brokers' })}; + get uptime(): Locator { return this.page.getByRole('heading', { name: 'Uptime' })}; + get partitions(): Locator { return this.page.getByRole('heading', { name: 'Partitions' })}; + + toBroker(value: string): Locator { return this.page.getByRole('cell', { name: value, exact: true }); } } \ No newline at end of file diff --git a/e2e-playwright/src/pages/Locators.ts b/e2e-playwright/src/pages/Locators.ts index ceb2ab624..257707b63 100644 --- a/e2e-playwright/src/pages/Locators.ts +++ b/e2e-playwright/src/pages/Locators.ts @@ -10,12 +10,14 @@ import ksqlDbLocators from "./KSQLDB/ksqldbLocators"; import DashboardLocators from "./Dashboard/DashboardLocators"; import TopicsTopickNameLocators from "./Topics/TopicsTopickNameLocators" import ProduceMessageLocators from "./Topics/ProduceMessageLocators" +import BrokerDetailsLocators from "./Brokers/BrokerDetailsLocators" export class Locators { private readonly page: Page; private _panel?: PanelLocators; private _brokers?: BrokersLocators; + private _brokerDetails?: BrokerDetailsLocators; private _topics?: TopicsLocators; private _topicsCreate?: TopicCreateLocators; private _topicTopicName?: TopicsTopickNameLocators; @@ -38,6 +40,10 @@ export class Locators { return (this._brokers ??= new BrokersLocators(this.page)); } + get brokerDetails() { + return (this._brokerDetails ??= new BrokerDetailsLocators(this.page)); + } + get topics() { return (this._topics ??= new TopicsLocators(this.page)); } diff --git a/e2e-playwright/src/pages/Topics/TopicsTopickNameLocators.ts b/e2e-playwright/src/pages/Topics/TopicsTopickNameLocators.ts index 1f6602da9..06cc76055 100644 --- a/e2e-playwright/src/pages/Topics/TopicsTopickNameLocators.ts +++ b/e2e-playwright/src/pages/Topics/TopicsTopickNameLocators.ts @@ -16,6 +16,13 @@ export default class TopicsTopickNameLocators { get keyButton():Locator { return this.page.getByRole('button', { name: 'Key' }); } get valueButton():Locator { return this.page.getByRole('button', { name: 'Value' }); } get headersButton():Locator { return this.page.getByRole('button', { name: 'Headers' }); } + get dotsMenu():Locator {return this.page.locator('#root div').filter({ hasText: 'Edit settingsPay attention!' }).nth(3)} + + get menuItemEditSettings():Locator { return this.page.getByRole('menuitem', { name: 'Edit settings Pay attention!' }) } + get menuItemClearMessages():Locator { return this.page.getByText('Clear messagesClearing') } + + get cleanupPolicyDropdown():Locator { return this.page.getByRole('listbox', { name: 'Cleanup policy' }) } + get updateTopicButton():Locator { return this.page.getByRole('button', { name: 'Update topic' }) } heading(topicName: string): Locator { return this.page.getByText(`Topics${topicName}`); } partitions(value: string):Locator { return this.page.getByRole('group').getByText(value).first(); } @@ -25,4 +32,6 @@ export default class TopicsTopickNameLocators { messageKeyTextbox(value: string):Locator { return this.page.locator('#schema div').filter({ hasText: value }).nth(1); } messageValueTextbox(value: string):Locator { return this.page.locator('div').filter({ hasText:value }).nth(1); } messageHeadersTextbox(value: string):Locator { return this.page.locator('div').filter({ hasText: value }).nth(1); } + + cleanupPolicyDropdownItem(value: string):Locator { return this.page.getByRole('option', { name: value, exact: true }); } } \ No newline at end of file diff --git a/e2e-playwright/src/services/uiHelper.ts b/e2e-playwright/src/services/uiHelper.ts index 340140dd4..6bb7da541 100644 --- a/e2e-playwright/src/services/uiHelper.ts +++ b/e2e-playwright/src/services/uiHelper.ts @@ -9,6 +9,15 @@ import expect from "../helper/util/expect"; } }; +export const expectEnabled = async(locator: Locator, enabledString: string): Promise => { + const shouldBeEnabled = enabledString === "true"; + if (shouldBeEnabled) { + await expect(locator).toBeEnabled(); + } else { + await expect(locator).toBeDisabled(); + } +}; + export const ensureCheckboxState = async(checkbox: Locator, expectedState: string) => { const desiredState = expectedState === 'true'; const isChecked = await checkbox.isChecked(); @@ -21,3 +30,28 @@ export const ensureCheckboxState = async(checkbox: Locator, expectedState: strin } } }; + +export const expectVisuallyActive = async( + locator: Locator, + expected: string +): Promise => { + const shouldBeClickable = expected === 'true'; + + const style = await locator.evaluate((el) => { + const computed = window.getComputedStyle(el); + return { + pointerEvents: computed.pointerEvents, + visibility: computed.visibility, + display: computed.display, + cursor: computed.cursor, + }; + }); + + const isClickable = + style.pointerEvents !== 'none' && + style.visibility !== 'hidden' && + style.display !== 'none' && + style.cursor !== 'not-allowed'; + + expect(isClickable).toBe(shouldBeClickable); +}; \ No newline at end of file diff --git a/e2e-playwright/src/steps/Brokers.steps.ts b/e2e-playwright/src/steps/Brokers.steps.ts new file mode 100644 index 000000000..e3cd90b0e --- /dev/null +++ b/e2e-playwright/src/steps/Brokers.steps.ts @@ -0,0 +1,60 @@ +/* eslint-disable no-unused-vars */ +import { Given, When, Then, setDefaultTimeout } from "@cucumber/cucumber"; +import { PlaywrightWorld } from "../support/PlaywrightWorld"; +import { expectVisibility } from "../services/uiHelper"; + +setDefaultTimeout(60 * 1000 * 2); + +Given('Brokers Uptime visible is: {string}', async function(this: PlaywrightWorld, visible: string) { + await expectVisibility(this.locators.brokers.uptime, visible); +}); + +Given('Brokers Partitions visible is: {string}', async function(this: PlaywrightWorld, visible: string) { + await expectVisibility(this.locators.brokers.partitions, visible); +}); + +When('Brokers cell element {string} clicked', async function(this: PlaywrightWorld, index: string) { + await this.locators.brokers.toBroker(index).click(); +}); + +Given('BrokerDetails name is: {string} header visible is: {string}', async function(this: PlaywrightWorld, expectedName: string, visible: string) { + await expectVisibility(this.locators.brokerDetails.header(expectedName), visible); +}); + +Given('BrokerDetails Log directories visible is: {string}', async function(this: PlaywrightWorld, visible: string) { + await expectVisibility(this.locators.brokerDetails.logDirectors, visible); +}); + +Given('BrokerDetails Configs visible is: {string}', async function(this: PlaywrightWorld, visible: string) { + await expectVisibility(this.locators.brokerDetails.configs, visible); +}); + +Given('BrokerDetails Metrics visible is: {string}', async function(this: PlaywrightWorld, visible: string) { + await expectVisibility(this.locators.brokerDetails.metrics, visible); +}); + +Given('BrokerDetails Configs Key visible is: {string}', async function(this: PlaywrightWorld, visible: string) { + await expectVisibility(this.locators.brokerDetails.configsKey, visible); +}); + +Given('BrokerDetails Configs Value visible is: {string}', async function(this: PlaywrightWorld, visible: string) { + await expectVisibility(this.locators.brokerDetails.configsValue, visible); +}); + +Given('BrokerDetails Configs Source visible is: {string}', async function(this: PlaywrightWorld, visible: string) { + await expectVisibility(this.locators.brokerDetails.configsSource, visible); +}); + +When('BrokerDetails Configs clicked', async function(this: PlaywrightWorld) { + await this.locators.brokerDetails.configs.click(); +}); +Then('BrokerDetails searchfield visible is: {string}', async function(this: PlaywrightWorld, visible: string) { + await expectVisibility(this.locators.brokerDetails.configsTextbox, visible); +}); + +When('BrokerDetails searchfield input is: {string} cell value is: {string}', async function(this: PlaywrightWorld, input: string, expected: string) { + const searchField = this.locators.brokerDetails.configsTextbox; + await searchField.fill(input); + await expectVisibility( this.locators.brokerDetails.configCell(expected), "true"); + await searchField.fill(''); +}); diff --git a/e2e-playwright/src/steps/ProduceMessages.ts b/e2e-playwright/src/steps/ProduceMessages.ts index 3a78f110c..81263583f 100644 --- a/e2e-playwright/src/steps/ProduceMessages.ts +++ b/e2e-playwright/src/steps/ProduceMessages.ts @@ -1,7 +1,7 @@ /* eslint-disable no-unused-vars */ import { Given, When, Then, setDefaultTimeout } from "@cucumber/cucumber"; import { expect } from "@playwright/test"; -import { expectVisibility, ensureCheckboxState } from "../services/uiHelper"; +import { expectVisibility, expectVisuallyActive } from "../services/uiHelper"; import { PlaywrightWorld } from "../support/PlaywrightWorld"; setDefaultTimeout(60 * 1000 * 2); @@ -88,4 +88,25 @@ Then('TopicName messages contains headers key is: {string}, value is: {string}', const expectedHeader = `"${headerKey}":"${headerValue}"`; await this.locators.topicTopicName.headersButton.click() await expectVisibility(this.locators.topicTopicName.messageHeadersTextbox(expectedHeader), "true"); +}); + +Given('TopicName menu button clicked', async function(this: PlaywrightWorld) { + await this.locators.topicTopicName.dotsMenu.click(); +}); + +Then('TopicNameMenu clear messages active is: {string}', async function(this: PlaywrightWorld, state: string) { + await expectVisuallyActive(this.locators.topicTopicName.menuItemClearMessages, state); +}); + +When('TopicNameMenu edit settings clicked', async function(this: PlaywrightWorld) { + await this.locators.topicTopicName.menuItemEditSettings.click(); +}); + +When('TopicName cleanup policy set to: {string}', async function(this: PlaywrightWorld, policy: string) { + await this.locators.topicTopicName.cleanupPolicyDropdown.click(); + await this.locators.topicTopicName.cleanupPolicyDropdownItem(policy).click(); +}); + +When('TopicName UpdateTopic button clicked', async function(this: PlaywrightWorld) { + await this.locators.topicTopicName.updateTopicButton.click(); }); \ No newline at end of file From d4f48b61abb795d6c115d1f46bd11c7f6712bdc7 Mon Sep 17 00:00:00 2001 From: AspidDark Date: Fri, 6 Jun 2025 23:54:49 +0300 Subject: [PATCH 08/14] Ksql first part --- e2e-playwright/config/cucumber.js | 2 +- e2e-playwright/src/features/KsqlDb.feature | 39 +++++++ e2e-playwright/src/hooks/hooks.ts | 2 +- .../src/pages/KSQLDB/ksqldbLocators.ts | 9 +- e2e-playwright/src/services/KsqlScripts.ts | 13 +++ .../src/services/commonFunctions.ts | 13 ++- e2e-playwright/src/services/uiHelper.ts | 8 +- e2e-playwright/src/steps/Ksqldb.steps.ts | 107 ++++++++++++++++++ e2e-playwright/src/steps/ProduceMessages.ts | 4 +- 9 files changed, 190 insertions(+), 7 deletions(-) create mode 100644 e2e-playwright/src/features/KsqlDb.feature create mode 100644 e2e-playwright/src/services/KsqlScripts.ts create mode 100644 e2e-playwright/src/steps/Ksqldb.steps.ts diff --git a/e2e-playwright/config/cucumber.js b/e2e-playwright/config/cucumber.js index 7213fd230..72e206d25 100644 --- a/e2e-playwright/config/cucumber.js +++ b/e2e-playwright/config/cucumber.js @@ -1,7 +1,7 @@ /* eslint-disable */ module.exports = { default: { - timeout: 30000, + timeout: 60000, tags: process.env.npm_config_TAGS || "", formatOptions: { snippetInterface: "async-await" diff --git a/e2e-playwright/src/features/KsqlDb.feature b/e2e-playwright/src/features/KsqlDb.feature new file mode 100644 index 000000000..36c55eabc --- /dev/null +++ b/e2e-playwright/src/features/KsqlDb.feature @@ -0,0 +1,39 @@ +Feature: Ksqldb page visibility + + Scenario: KSQL DB elements visibility + Given KSQL DB is visible + When click on KSQL DB link + Then KSQL DB heading visible + Then the part of current URL should be "ksqldb" + Given KSQL DB Tables header visible is: "true" + Given KSQL DB Streams header visible is: "true" + Given KSQL DB Tables link visible is: "true" + Given KSQL DB Streams link visible is: "true" + When KSQL DB ExecuteKSQLRequest click + Given KSQL DB Clear visible is: "true" + Given KSQL DB Execute visible is: "true" + + Scenario: KSQL DB queries + Given KSQL DB is visible + When click on KSQL DB link + Then KSQL DB heading visible + Then the part of current URL should be "ksqldb" + Given KSQL DB Tables header visible is: "true" + Given KSQL DB Streams header visible is: "true" + Given KSQL DB Tables link visible is: "true" + Given KSQL DB Streams link visible is: "true" + + When KSQL DB ExecuteKSQLRequest click + Given KSQL DB textbox visible is: "true" + Given KSQL DB KSQL for stream starts with: "STREAM_ONE", kafka_topic starts with: "NewAutoTopic", value_format: "json" + Then KSQL DB stream created + When KSQL DB Stream clicked + Then KSQL DB stream starts with: "STREAM_ONE" visible is: "true" + + When KSQL DB ExecuteKSQLRequest click + Given KSQL DB textbox visible is: "true" + Then KSQL DB KSQL for table starts with: "TABLE_ONE", stream starts with: "STREAM_ONE" + Then KSQL DB table created + When KSQL DB Table clicked + Then KSQL DB table starts with: "TABLE_ONE" visible is: "true" + diff --git a/e2e-playwright/src/hooks/hooks.ts b/e2e-playwright/src/hooks/hooks.ts index 33f949db1..b7abff571 100644 --- a/e2e-playwright/src/hooks/hooks.ts +++ b/e2e-playwright/src/hooks/hooks.ts @@ -30,7 +30,7 @@ Before(async function(this: PlaywrightWorld, { pickle }) { await this.init(context, scenarioName); }); -After({ timeout: 30000 }, async function(this: PlaywrightWorld, { pickle, result }) { +After({ timeout: 60000 }, async function(this: PlaywrightWorld, { pickle, result }) { let img: Buffer | undefined; const path = `./test-results/trace/${pickle.id}.zip`; try { diff --git a/e2e-playwright/src/pages/KSQLDB/ksqldbLocators.ts b/e2e-playwright/src/pages/KSQLDB/ksqldbLocators.ts index 7fffdc13c..4a725487b 100644 --- a/e2e-playwright/src/pages/KSQLDB/ksqldbLocators.ts +++ b/e2e-playwright/src/pages/KSQLDB/ksqldbLocators.ts @@ -11,5 +11,12 @@ export default class ksqlDbLocators { get executeKSQLREquestButton(): Locator { return this.page.getByRole('button', { name: 'Execute KSQL Request' })}; get tablesLink(): Locator { return this.page.getByRole('link', { name: 'Tables' })}; get streamsLink(): Locator { return this.page.getByRole('link', { name: 'Streams' })}; - + get tablesHeader(): Locator { return this.page.getByTitle('Tables').locator('div')}; + get streamsHeader(): Locator { return this.page.getByTitle('Streams').locator('div')}; + get textField(): Locator { return this.page.locator('.ace_content')}; + get clear(): Locator { return this.page.getByRole('button', { name: 'Clear', exact: true })}; + get execute(): Locator { return this.page.getByRole('button', { name: 'Execute', exact: true })}; + get success(): Locator { return this.page.getByRole('cell', { name: 'SUCCESS' })}; + get streamCSreated(): Locator { return this.page.getByRole('cell', { name: 'Stream created' })}; + get clearResults(): Locator { return this.page.getByRole('button', { name: 'Clear results' })}; } \ No newline at end of file diff --git a/e2e-playwright/src/services/KsqlScripts.ts b/e2e-playwright/src/services/KsqlScripts.ts new file mode 100644 index 000000000..e8f8827c9 --- /dev/null +++ b/e2e-playwright/src/services/KsqlScripts.ts @@ -0,0 +1,13 @@ + +export function createStreamQuery( + streamName: string, + topicName: string, + valueFormat: string = "json", + partitions: number = 1 +): string { + return `CREATE STREAM ${streamName} (profileId VARCHAR, latitude DOUBLE, longitude DOUBLE ) WITH (kafka_topic='${topicName}', value_format='${valueFormat}', partitions=${partitions});`; +} + +export function createTableQuery(tableName: string, streamName: string): string { + return `CREATE TABLE ${tableName} AS SELECT profileId, LATEST_BY_OFFSET(latitude) AS la, LATEST_BY_OFFSET(longitude) AS lo FROM ${streamName} GROUP BY profileId EMIT CHANGES;`; +} \ No newline at end of file diff --git a/e2e-playwright/src/services/commonFunctions.ts b/e2e-playwright/src/services/commonFunctions.ts index f99fec670..0e638021d 100644 --- a/e2e-playwright/src/services/commonFunctions.ts +++ b/e2e-playwright/src/services/commonFunctions.ts @@ -1,5 +1,16 @@ import { v4 as uuidv4 } from 'uuid'; +import { Page } from "@playwright/test"; export const generateName = (prefix: string): string => { - return `${prefix}-${uuidv4().slice(0, 8)}`; + return `${prefix}${uuidv4().slice(0, 8)}`; }; + +export async function Delete(page: Page, times: number = 5): Promise { + for (let i = 0; i < times; i++) { + await page.keyboard.press('Delete'); + } +} + +// export const generateName = (prefix: string): string => { +// return `${prefix}-${uuidv4().slice(0, 8)}`; +// }; diff --git a/e2e-playwright/src/services/uiHelper.ts b/e2e-playwright/src/services/uiHelper.ts index 6bb7da541..c87a0999b 100644 --- a/e2e-playwright/src/services/uiHelper.ts +++ b/e2e-playwright/src/services/uiHelper.ts @@ -1,5 +1,6 @@ import { Locator } from '@playwright/test'; import expect from "../helper/util/expect"; +import { Page } from "@playwright/test"; export const expectVisibility = async(locator: Locator, visibleString: string): Promise => { if (visibleString === "true") { @@ -54,4 +55,9 @@ export const expectVisuallyActive = async( style.cursor !== 'not-allowed'; expect(isClickable).toBe(shouldBeClickable); -}; \ No newline at end of file +}; + +export async function refreshPageAfterDelay(page: Page, delayMs: number = 35000): Promise { + await page.waitForTimeout(delayMs); + await page.reload(); +} \ No newline at end of file diff --git a/e2e-playwright/src/steps/Ksqldb.steps.ts b/e2e-playwright/src/steps/Ksqldb.steps.ts new file mode 100644 index 000000000..b13684218 --- /dev/null +++ b/e2e-playwright/src/steps/Ksqldb.steps.ts @@ -0,0 +1,107 @@ +/* eslint-disable no-unused-vars */ +import { Given, When, Then, setDefaultTimeout } from "@cucumber/cucumber"; +import { expect } from "@playwright/test"; +import { expectVisibility, refreshPageAfterDelay } from "../services/uiHelper"; +import { PlaywrightWorld } from "../support/PlaywrightWorld"; +import { createStreamQuery, createTableQuery } from "../services/KsqlScripts"; +import { generateName, Delete } from "../services/commonFunctions"; + +setDefaultTimeout(60 * 1000 * 4); + +Given('KSQL DB Tables header visible is: {string}', async function(this: PlaywrightWorld, visible: string) { + await expectVisibility(this.locators.ksqlDb.tablesHeader, visible); +}); + +Given('KSQL DB Streams header visible is: {string}', async function(this: PlaywrightWorld, visible: string) { + await expectVisibility(this.locators.ksqlDb.streamsHeader, visible); +}); + +Given('KSQL DB Tables link visible is: {string}', async function(this: PlaywrightWorld, visible: string) { + await expectVisibility(this.locators.ksqlDb.tablesLink, visible); +}); + +Given('KSQL DB Streams link visible is: {string}', async function(this: PlaywrightWorld, visible: string) { + await expectVisibility(this.locators.ksqlDb.streamsLink, visible); +}); + +When('KSQL DB ExecuteKSQLRequest click', async function(this: PlaywrightWorld) { + await this.locators.ksqlDb.executeKSQLREquestButton.click(); +}); + +Given('KSQL DB Clear visible is: {string}', async function(this: PlaywrightWorld, visible: string) { + await expectVisibility(this.locators.ksqlDb.clear, visible); +}); + +Given('KSQL DB Execute visible is: {string}', async function(this: PlaywrightWorld, visible: string) { + await expectVisibility(this.locators.ksqlDb.execute, visible); +}); + +Given('KSQL DB textbox visible is: {string}', async function(this: PlaywrightWorld, visible: string) { + await expectVisibility(this.locators.ksqlDb.textField, visible); +}); + +Given('KSQL DB KSQL for stream starts with: {string}, kafka_topic starts with: {string}, value_format: {string}', + async function(this: PlaywrightWorld, stream: string, topic: string, format: string) { + const topicName = generateName(topic); + const streamName = generateName(stream).toUpperCase(); + const query = createStreamQuery(streamName, topicName, format); + + await this.locators.ksqlDb.clear.click(); + const textbox = this.locators.ksqlDb.textField; + await textbox.click(); + await textbox.type(query); + await Delete(this.page); + await this.locators.ksqlDb.execute.click(); + + this.setValue(`topicName-${topic}`, topicName); + this.setValue(`streamName-${stream}`, streamName); + } +); + +Then('KSQL DB stream created', async function(this: PlaywrightWorld) { + await expectVisibility(this.locators.ksqlDb.success, "true"); + await expectVisibility(this.locators.ksqlDb.streamCSreated, "true"); +}); + +Then( + 'KSQL DB KSQL for table starts with: {string}, stream starts with: {string}', + async function(this: PlaywrightWorld, table: string, stream: string) { + + const tableName = generateName(table); + const streamName = this.getValue(`streamName-${stream}`); + const query = createTableQuery(tableName, streamName); + + await this.locators.ksqlDb.clear.click(); + const textbox = this.locators.ksqlDb.textField; + await textbox.click(); + await textbox.type(query); + await Delete(this.page); + await this.locators.ksqlDb.execute.click(); + + this.setValue(`tableName-${table}`, tableName); + } +); + +Then('KSQL DB table created', async function(this: PlaywrightWorld) { + await expectVisibility(this.locators.ksqlDb.success, "true"); +}); + +When('KSQL DB Stream clicked', async function(this: PlaywrightWorld) { + await this.locators.ksqlDb.streamsLink.click(); +}); + +When('KSQL DB Table clicked', async function(this: PlaywrightWorld) { + await this.locators.ksqlDb.tablesLink.click(); +}); + +Then('KSQL DB stream starts with: {string} visible is: {string}', async function(this: PlaywrightWorld, name: string, visible: string) { + const streamName = this.getValue(`streamName-${name}`); + await refreshPageAfterDelay(this.page); + await expectVisibility(this.page.getByRole('cell', { name: streamName }), visible); +}); + +Then('KSQL DB table starts with: {string} visible is: {string}', async function(this: PlaywrightWorld, name: string, visible: string) { + const tableName = this.getValue(`tableName-${name}`); + await refreshPageAfterDelay(this.page); + await expectVisibility(this.page.getByRole('cell', { name: tableName }).first(), visible); +}); \ No newline at end of file diff --git a/e2e-playwright/src/steps/ProduceMessages.ts b/e2e-playwright/src/steps/ProduceMessages.ts index 81263583f..27e685aa1 100644 --- a/e2e-playwright/src/steps/ProduceMessages.ts +++ b/e2e-playwright/src/steps/ProduceMessages.ts @@ -1,10 +1,10 @@ /* eslint-disable no-unused-vars */ import { Given, When, Then, setDefaultTimeout } from "@cucumber/cucumber"; import { expect } from "@playwright/test"; -import { expectVisibility, expectVisuallyActive } from "../services/uiHelper"; +import { expectVisibility, expectVisuallyActive, refreshPageAfterDelay } from "../services/uiHelper"; import { PlaywrightWorld } from "../support/PlaywrightWorld"; -setDefaultTimeout(60 * 1000 * 2); +setDefaultTimeout(60 * 1000 * 4); Given('Topics TopicName partitions is: {int}', async function(this: PlaywrightWorld, count: number) { await expectVisibility(this.locators.topicTopicName.partitions(count.toString()), 'true'); From 4ce59e7305071faaf620e51cfc5d6e404eb5d294 Mon Sep 17 00:00:00 2001 From: AspidDark Date: Sat, 7 Jun 2025 00:01:59 +0300 Subject: [PATCH 09/14] one more --- e2e-playwright/src/features/KsqlDb.feature | 15 +++++++++++++++ e2e-playwright/src/steps/Ksqldb.steps.ts | 4 ++++ 2 files changed, 19 insertions(+) diff --git a/e2e-playwright/src/features/KsqlDb.feature b/e2e-playwright/src/features/KsqlDb.feature index 36c55eabc..111a74466 100644 --- a/e2e-playwright/src/features/KsqlDb.feature +++ b/e2e-playwright/src/features/KsqlDb.feature @@ -13,6 +13,21 @@ Feature: Ksqldb page visibility Given KSQL DB Clear visible is: "true" Given KSQL DB Execute visible is: "true" + Scenario: KSQL DB queries clear result + Given KSQL DB is visible + When click on KSQL DB link + Then KSQL DB heading visible + Then the part of current URL should be "ksqldb" + Given KSQL DB Tables header visible is: "true" + Given KSQL DB Streams header visible is: "true" + Given KSQL DB Tables link visible is: "true" + Given KSQL DB Streams link visible is: "true" + When KSQL DB ExecuteKSQLRequest click + Given KSQL DB textbox visible is: "true" + Given KSQL DB KSQL for stream starts with: "STREAM_ONE", kafka_topic starts with: "NewAutoTopic", value_format: "json" + Then KSQL DB stream created + Then KSQL DB clear result visible is: "true" + Scenario: KSQL DB queries Given KSQL DB is visible When click on KSQL DB link diff --git a/e2e-playwright/src/steps/Ksqldb.steps.ts b/e2e-playwright/src/steps/Ksqldb.steps.ts index b13684218..d1ddba89c 100644 --- a/e2e-playwright/src/steps/Ksqldb.steps.ts +++ b/e2e-playwright/src/steps/Ksqldb.steps.ts @@ -63,6 +63,10 @@ Then('KSQL DB stream created', async function(this: PlaywrightWorld) { await expectVisibility(this.locators.ksqlDb.streamCSreated, "true"); }); +Then('KSQL DB clear result visible is: {string}', async function(this: PlaywrightWorld, visible: string) { + await expectVisibility(this.locators.ksqlDb.clearResults, visible); +}); + Then( 'KSQL DB KSQL for table starts with: {string}, stream starts with: {string}', async function(this: PlaywrightWorld, table: string, stream: string) { From f47a6b94be24cd7582430cc70c8ee86912c8797a Mon Sep 17 00:00:00 2001 From: AspidDark Date: Wed, 11 Jun 2025 19:24:57 +0300 Subject: [PATCH 10/14] Ksql finished --- e2e-playwright/package.json | 1 + e2e-playwright/src/features/KsqlDb.feature | 34 ++++++++++- .../src/pages/KSQLDB/ksqldbLocators.ts | 5 ++ e2e-playwright/src/steps/Ksqldb.steps.ts | 57 ++++++++++++++++++- 4 files changed, 94 insertions(+), 3 deletions(-) diff --git a/e2e-playwright/package.json b/e2e-playwright/package.json index bc84432c7..6d1b9a347 100644 --- a/e2e-playwright/package.json +++ b/e2e-playwright/package.json @@ -7,6 +7,7 @@ "pretest": "npx ts-node src/helper/report/init.ts", "test": "cross-env ENV=prod FORCE_COLOR=0 cucumber-js --config=config/cucumber.js", "test:stage": "cross-env ENV=stage FORCE_COLOR=0 cucumber-js --config=config/cucumber.js", + "test:sp": "cross-env ENV=stage FORCE_COLOR=0 cucumber-js --config=config/cucumber.js --tags @sp", "posttest": "npx ts-node src/helper/report/report.ts", "test:failed": "cucumber-js -p rerun @rerun.txt", "lint": "eslint 'src/**/*.ts' --fix" diff --git a/e2e-playwright/src/features/KsqlDb.feature b/e2e-playwright/src/features/KsqlDb.feature index 111a74466..44b17c6f8 100644 --- a/e2e-playwright/src/features/KsqlDb.feature +++ b/e2e-playwright/src/features/KsqlDb.feature @@ -37,14 +37,12 @@ Feature: Ksqldb page visibility Given KSQL DB Streams header visible is: "true" Given KSQL DB Tables link visible is: "true" Given KSQL DB Streams link visible is: "true" - When KSQL DB ExecuteKSQLRequest click Given KSQL DB textbox visible is: "true" Given KSQL DB KSQL for stream starts with: "STREAM_ONE", kafka_topic starts with: "NewAutoTopic", value_format: "json" Then KSQL DB stream created When KSQL DB Stream clicked Then KSQL DB stream starts with: "STREAM_ONE" visible is: "true" - When KSQL DB ExecuteKSQLRequest click Given KSQL DB textbox visible is: "true" Then KSQL DB KSQL for table starts with: "TABLE_ONE", stream starts with: "STREAM_ONE" @@ -52,3 +50,35 @@ Feature: Ksqldb page visibility When KSQL DB Table clicked Then KSQL DB table starts with: "TABLE_ONE" visible is: "true" + Scenario: KSQL DB cancel queries + Given KSQL DB is visible + When click on KSQL DB link + Then KSQL DB heading visible + Then the part of current URL should be "ksqldb" + Given KSQL DB Tables header visible is: "true" + Given KSQL DB Streams header visible is: "true" + Given KSQL DB Tables link visible is: "true" + Given KSQL DB Streams link visible is: "true" + When KSQL DB ExecuteKSQLRequest click + Given KSQL DB textbox visible is: "true" + Given KSQL DB KSQL for stream starts with: "STREAM_ONE", kafka_topic starts with: "NewAutoTopic", value_format: "json" + Then KSQL DB stream created + Then KSQL DB KSQL cleared + When KSQL DB ExecuteKSQLRequest click + Given KSQL DB textbox visible is: "true" + Then KSQL DB KSQL for table starts with: "TABLE_ONE", stream starts with: "STREAM_ONE" + Then KSQL DB table created + Then KSQL DB KSQL cleared + When KSQL DB ExecuteKSQLRequest click + Given KSQL DB textbox visible is: "true" + Given KSQL DB KSQL data inserted to stream starts with: "STREAM_ONE", from table: + |Id |la |lo | + | c2309eec | 37.7877 | -122.4205 | + | 18f4ea86 | 37.3903 | -122.0643 | + | 4ab5cbad | 37.3952 | -122.0813 | + | 8b6eae59 | 37.3944 | -122.0813 | + | 4a7c7b41 | 37.4049 | -122.0822 | + | 4ddad000 | 37.7857 | -122.4011 | + + Given KSQL DB long query stream starts with: "STREAM_ONE" stared + Given KSQL DB long query stoped \ No newline at end of file diff --git a/e2e-playwright/src/pages/KSQLDB/ksqldbLocators.ts b/e2e-playwright/src/pages/KSQLDB/ksqldbLocators.ts index 4a725487b..2a50e5ab4 100644 --- a/e2e-playwright/src/pages/KSQLDB/ksqldbLocators.ts +++ b/e2e-playwright/src/pages/KSQLDB/ksqldbLocators.ts @@ -19,4 +19,9 @@ export default class ksqlDbLocators { get success(): Locator { return this.page.getByRole('cell', { name: 'SUCCESS' })}; get streamCSreated(): Locator { return this.page.getByRole('cell', { name: 'Stream created' })}; get clearResults(): Locator { return this.page.getByRole('button', { name: 'Clear results' })}; + get querySucceed(): Locator { return this.page.getByRole('heading', { name: 'Query succeed' })}; + + get consumingQueryExecution(): Locator { return this.page.getByText('Consuming query execution')}; + get abort(): Locator { return this.page.getByText('Abort')}; + get cancelled(): Locator { return this.page.getByText('Cancelled')}; } \ No newline at end of file diff --git a/e2e-playwright/src/steps/Ksqldb.steps.ts b/e2e-playwright/src/steps/Ksqldb.steps.ts index d1ddba89c..7b659ebd7 100644 --- a/e2e-playwright/src/steps/Ksqldb.steps.ts +++ b/e2e-playwright/src/steps/Ksqldb.steps.ts @@ -1,5 +1,5 @@ /* eslint-disable no-unused-vars */ -import { Given, When, Then, setDefaultTimeout } from "@cucumber/cucumber"; +import { Given, When, Then, setDefaultTimeout, DataTable } from "@cucumber/cucumber"; import { expect } from "@playwright/test"; import { expectVisibility, refreshPageAfterDelay } from "../services/uiHelper"; import { PlaywrightWorld } from "../support/PlaywrightWorld"; @@ -108,4 +108,59 @@ Then('KSQL DB table starts with: {string} visible is: {string}', async function( const tableName = this.getValue(`tableName-${name}`); await refreshPageAfterDelay(this.page); await expectVisibility(this.page.getByRole('cell', { name: tableName }).first(), visible); +}); + +Then('KSQL DB KSQL cleared', async function(this: PlaywrightWorld) { + await this.locators.ksqlDb.clear.click(); + await this.locators.ksqlDb.clearResults.click(); +}); + +Given( + 'KSQL DB KSQL data inserted to stream starts with: {string}, from table:', + async function(this: PlaywrightWorld, streamPrefix: string, table: DataTable) { + const streamName = this.getValue(`streamName-${streamPrefix}`); + const stream = streamName?.trim(); + const rows = table.hashes(); + + for (const row of rows) { + const id = row.Id; + const lat = row.la; + const lon = row.lo; + + const query = `INSERT INTO ${stream} (profileId, latitude, longitude) VALUES ('${id}', ${lat}, ${lon});`; + + await this.locators.ksqlDb.clear.click(); + const textbox = this.locators.ksqlDb.textField; + await textbox.click(); + await textbox.type(query); + await Delete(this.page); + await this.locators.ksqlDb.execute.click(); + + await expectVisibility(this.locators.ksqlDb.querySucceed, 'true'); + await this.locators.ksqlDb.clear.click(); + } +}); + +Given( + 'KSQL DB long query stream starts with: {string} stared', + async function(this: PlaywrightWorld, streamPrefix: string) { + await this.locators.ksqlDb.clear.click(); + const streamName = this.getValue(`streamName-${streamPrefix}`); + const query = `SELECT * FROM ${streamName} EMIT CHANGES;`.trim(); + + await this.locators.ksqlDb.clear.click(); + const textbox = this.locators.ksqlDb.textField; + await textbox.click(); + await textbox.type(query); + await Delete(this.page); + await this.locators.ksqlDb.execute.click(); + + await expectVisibility(this.locators.ksqlDb.consumingQueryExecution, 'true'); +}); + +Given('KSQL DB long query stoped', async function(this: PlaywrightWorld) { + await expectVisibility(this.locators.ksqlDb.consumingQueryExecution, 'true'); + const abortButton = this.locators.ksqlDb.abort; + await abortButton.scrollIntoViewIfNeeded(); + await this.locators.ksqlDb.abort.click({ force: true }); }); \ No newline at end of file From 3fac03dacaa68a0cb14567a4ccc277506ff2d770 Mon Sep 17 00:00:00 2001 From: AspidDark Date: Wed, 11 Jun 2025 23:02:54 +0300 Subject: [PATCH 11/14] Schema registry start --- .../src/features/SchemaRegistry.feature | 16 ++++++ e2e-playwright/src/pages/Locators.ts | 6 +++ .../SchemaRegistry/SchemaRegistryLocators.ts | 8 +++ .../SchemaRegistrySchemaNameLocators.ts | 11 ++++ e2e-playwright/src/services/schemas.ts | 51 +++++++++++++++++++ .../src/steps/SchemaRegistry.steps.ts | 51 +++++++++++++++++++ 6 files changed, 143 insertions(+) create mode 100644 e2e-playwright/src/features/SchemaRegistry.feature create mode 100644 e2e-playwright/src/pages/SchemaRegistry/SchemaRegistrySchemaNameLocators.ts create mode 100644 e2e-playwright/src/services/schemas.ts create mode 100644 e2e-playwright/src/steps/SchemaRegistry.steps.ts diff --git a/e2e-playwright/src/features/SchemaRegistry.feature b/e2e-playwright/src/features/SchemaRegistry.feature new file mode 100644 index 000000000..ce123d588 --- /dev/null +++ b/e2e-playwright/src/features/SchemaRegistry.feature @@ -0,0 +1,16 @@ +Feature: Schema page + + Scenario: SchemaRegistry and SchemaRegistryCreate visibility + Given Schema Registry is visible + When click on Schema Registry link + Then Schema Registry heading visible + Given SchemaRegistry CheateSchema clicked + + Given SchemaRegistryCreate is visible + Given SchemaRegistryCreate Subject visible is: "true" + Given SchemaRegistryCreate Schema visible is: "true" + Given SchemaRegistryCreate SchemaType visible is: "true" + When SchemaRegistryCreate Subject input starts with: "SchemaSubject" + When SchemaRegistryCreate Schema input from avro + When SchemaRegistryCreate Submit clicked + Then SchemaRegistrySchemaName starts with: "SchemaSubject", visible is: "true" \ No newline at end of file diff --git a/e2e-playwright/src/pages/Locators.ts b/e2e-playwright/src/pages/Locators.ts index 257707b63..8e479771a 100644 --- a/e2e-playwright/src/pages/Locators.ts +++ b/e2e-playwright/src/pages/Locators.ts @@ -11,6 +11,7 @@ import DashboardLocators from "./Dashboard/DashboardLocators"; import TopicsTopickNameLocators from "./Topics/TopicsTopickNameLocators" import ProduceMessageLocators from "./Topics/ProduceMessageLocators" import BrokerDetailsLocators from "./Brokers/BrokerDetailsLocators" +import SchemaRegistrySchemaNameLocators from "./SchemaRegistry/SchemaRegistrySchemaNameLocators" export class Locators { private readonly page: Page; @@ -24,6 +25,7 @@ export class Locators { private _produceMessage?: ProduceMessageLocators; private _consumers?: ConsumersLocators; private _schemaRegistry?: SchemaRegistryLocators; + private _schemaName?: SchemaRegistrySchemaNameLocators; private _connectors?: ConnectorsLocators; private _ksqlDb?: ksqlDbLocators; private _dashboard?: DashboardLocators; @@ -68,6 +70,10 @@ export class Locators { return (this._schemaRegistry ??= new SchemaRegistryLocators(this.page)); } + get schemaName() { + return (this._schemaName ??= new SchemaRegistrySchemaNameLocators(this.page)); + } + get connectors() { return (this._connectors ??= new ConnectorsLocators(this.page)); } diff --git a/e2e-playwright/src/pages/SchemaRegistry/SchemaRegistryLocators.ts b/e2e-playwright/src/pages/SchemaRegistry/SchemaRegistryLocators.ts index a1f908e74..f6e4a46ca 100644 --- a/e2e-playwright/src/pages/SchemaRegistry/SchemaRegistryLocators.ts +++ b/e2e-playwright/src/pages/SchemaRegistry/SchemaRegistryLocators.ts @@ -10,4 +10,12 @@ export default class SchemaRegistryLocators { get heading(): Locator { return this.page.getByRole('heading', { name: 'Schema Registry' })}; get searchBox(): Locator { return this.page.getByRole('textbox', { name: 'Search by Schema Name' })}; get createSchemaButton(): Locator { return this.page.getByRole('button', { name: 'Create Schema' })}; + + get createHeading(): Locator { return this.page.getByText('Schema RegistryCreate')}; + get subjectTextBox(): Locator { return this.page.getByRole('textbox', { name: 'Schema Name' })}; + get schemaTextBox(): Locator { return this.page.locator('textarea[name="schema"]')}; + get schemaTypeDropDown(): Locator { return this.page.locator('form path')}; + get submit(): Locator { return this.page.getByRole('button', { name: 'Submit' })}; + + schemaTypeDropDownElement(value:string): Locator { return this.page.getByRole('option', { name: value })}; } \ No newline at end of file diff --git a/e2e-playwright/src/pages/SchemaRegistry/SchemaRegistrySchemaNameLocators.ts b/e2e-playwright/src/pages/SchemaRegistry/SchemaRegistrySchemaNameLocators.ts new file mode 100644 index 000000000..903fe52c5 --- /dev/null +++ b/e2e-playwright/src/pages/SchemaRegistry/SchemaRegistrySchemaNameLocators.ts @@ -0,0 +1,11 @@ +import { Page, Locator } from "@playwright/test"; + +export default class SchemaRegistrySchemaNameLocators { + private readonly page: Page; + + constructor(page: Page) { + this.page = page; + } + + heading(value: string): Locator { return this.page.getByText(`Schema Registry${value}`)}; +} \ No newline at end of file diff --git a/e2e-playwright/src/services/schemas.ts b/e2e-playwright/src/services/schemas.ts new file mode 100644 index 000000000..83c61ab0a --- /dev/null +++ b/e2e-playwright/src/services/schemas.ts @@ -0,0 +1,51 @@ +export function getAvroSchema(): string { + return JSON.stringify({ + type: 'record', + name: 'Student', + namespace: 'DataFlair', + fields: [ + { name: 'Name', type: 'string' }, + { name: 'Age', type: 'int' } + ] + }, null, 2); +} + +export function getAvroUpdatedSchema(): string { + return JSON.stringify({ + type: "record", + name: "Message", + namespace: "io.kafbat.ui", + fields: [ + { + name: "text", + type: "string", + default: null + }, + { + name: "value", + type: "string", + default: null + } + ] + }, null, 2); +} + +export function getJsonSchema(): string { + return JSON.stringify({ + "connector.class": "io.confluent.connect.jdbc.JdbcSinkConnector", + "connection.url": "jdbc:postgresql://postgres-db:5432/test", + "connection.user": "dev_user", + "connection.password": "12345", + "topics": "topic_for_connector" + }, null, 2); +} + +export function getProtobufSchema(): string { + return ` +enum SchemaType { + AVRO = 0; + JSON = 1; + PROTOBUF = 2; +} +`.trim(); +} \ No newline at end of file diff --git a/e2e-playwright/src/steps/SchemaRegistry.steps.ts b/e2e-playwright/src/steps/SchemaRegistry.steps.ts new file mode 100644 index 000000000..4c5f011f3 --- /dev/null +++ b/e2e-playwright/src/steps/SchemaRegistry.steps.ts @@ -0,0 +1,51 @@ +/* eslint-disable no-unused-vars */ +import { Given, When, Then, setDefaultTimeout } from "@cucumber/cucumber"; +import { PlaywrightWorld } from "../support/PlaywrightWorld"; +import { expectVisibility } from "../services/uiHelper"; +import { generateName } from "../services/commonFunctions"; +import { getAvroSchema } from "../services/schemas" + +setDefaultTimeout(60 * 1000 * 2); + +Given('SchemaRegistry CheateSchema clicked', async function(this: PlaywrightWorld) { + await this.locators.schemaRegistry.createSchemaButton.click(); +}); + +Given('SchemaRegistryCreate is visible', async function(this: PlaywrightWorld) { + await expectVisibility(this.locators.schemaRegistry.createHeading, "true"); +}); + +Given('SchemaRegistryCreate Subject visible is: {string}', async function(this: PlaywrightWorld, visible: string) { + await expectVisibility(this.locators.schemaRegistry.subjectTextBox, visible); +}); + +Given('SchemaRegistryCreate Schema visible is: {string}', async function(this: PlaywrightWorld, visible: string) { + await expectVisibility(this.locators.schemaRegistry.schemaTextBox, visible); +}); + +Given('SchemaRegistryCreate SchemaType visible is: {string}', async function(this: PlaywrightWorld, visible: string) { + await expectVisibility(this.locators.schemaRegistry.schemaTypeDropDown, visible); +}); + +When('SchemaRegistryCreate Subject input starts with: {string}', async function(this: PlaywrightWorld, prefix: string) { + const subjectName = generateName(prefix); + await this.locators.schemaRegistry.subjectTextBox.fill(subjectName); + this.setValue(`subjectName-${prefix}`, subjectName); +}); + +When('SchemaRegistryCreate Schema input from avro', async function(this: PlaywrightWorld) { + const schema = getAvroSchema(); + await this.locators.schemaRegistry.schemaTextBox.fill(schema); +}); + +When('SchemaRegistryCreate Submit clicked', async function(this: PlaywrightWorld) { + await this.locators.schemaRegistry.submit.click(); +}); + +Then('SchemaRegistrySchemaName starts with: {string}, visible is: {string}', + async function(this: PlaywrightWorld, prefix: string, visible: string) { + const streamName = this.getValue(`subjectName-${prefix}`); + const locator = this.locators.schemaName.heading(streamName); + await expectVisibility(locator, visible); + } +); \ No newline at end of file From 9b678eb1a3fac3faa718664aa7a2e425e1b40b81 Mon Sep 17 00:00:00 2001 From: AspidDark Date: Wed, 18 Jun 2025 20:12:37 +0300 Subject: [PATCH 12/14] schema registry --- .../src/features/SchemaRegistry.feature | 72 ++++++++++++++- .../SchemaRegistry/SchemaRegistryLocators.ts | 5 ++ .../SchemaRegistrySchemaNameLocators.ts | 15 ++++ .../src/services/commonFunctions.ts | 6 ++ .../src/steps/SchemaRegistry.steps.ts | 87 ++++++++++++++++++- 5 files changed, 180 insertions(+), 5 deletions(-) diff --git a/e2e-playwright/src/features/SchemaRegistry.feature b/e2e-playwright/src/features/SchemaRegistry.feature index ce123d588..5aa41f3c8 100644 --- a/e2e-playwright/src/features/SchemaRegistry.feature +++ b/e2e-playwright/src/features/SchemaRegistry.feature @@ -5,7 +5,6 @@ Feature: Schema page When click on Schema Registry link Then Schema Registry heading visible Given SchemaRegistry CheateSchema clicked - Given SchemaRegistryCreate is visible Given SchemaRegistryCreate Subject visible is: "true" Given SchemaRegistryCreate Schema visible is: "true" @@ -13,4 +12,73 @@ Feature: Schema page When SchemaRegistryCreate Subject input starts with: "SchemaSubject" When SchemaRegistryCreate Schema input from avro When SchemaRegistryCreate Submit clicked - Then SchemaRegistrySchemaName starts with: "SchemaSubject", visible is: "true" \ No newline at end of file + Then SchemaRegistrySchemaName starts with: "SchemaSubject", visible is: "true" + + Scenario: SchemaRegistry Avro schema actions + Given Schema Registry is visible + When click on Schema Registry link + Then Schema Registry heading visible + Given SchemaRegistry CheateSchema clicked + Given SchemaRegistryCreate is visible + Given SchemaRegistryCreate Subject visible is: "true" + Given SchemaRegistryCreate Schema visible is: "true" + Given SchemaRegistryCreate SchemaType visible is: "true" + When SchemaRegistryCreate Subject input starts with: "SchemaSubject" + When SchemaRegistryCreate Schema input from avro + When SchemaRegistryCreate Submit clicked + Then SchemaRegistrySchemaName starts with: "SchemaSubject", visible is: "true" + When click on Brokers link + When click on Schema Registry link + Given SchemaRegistry click on schema starts with: "SchemaSubject" + Given SchemaRegistrySchemaName version is: "1" + Given SchemaRegistrySchemaName type is: "AVRO" + Given SchemaRegistrySchemaName Compatibility is: "BACKWARD" + When SchemaRegistrySchemaName remove schema clicked + Then Schema starts with: "SchemaSubject" deleted + Then SchemaRegistrySchemaName starts with: "SchemaSubject", visible is: "false" + + Scenario: SchemaRegistry Json schema actions + Given Schema Registry is visible + When click on Schema Registry link + Then Schema Registry heading visible + Given SchemaRegistry CheateSchema clicked + Given SchemaRegistryCreate is visible + Given SchemaRegistryCreate Subject visible is: "true" + Given SchemaRegistryCreate Schema visible is: "true" + Given SchemaRegistryCreate SchemaType visible is: "true" + When SchemaRegistryCreate Subject input starts with: "SchemaSubject" + When SchemaRegistryCreate Schema input from json + When SchemaRegistryCreate Submit clicked + Then SchemaRegistrySchemaName starts with: "SchemaSubject", visible is: "true" + When click on Brokers link + When click on Schema Registry link + Given SchemaRegistry click on schema starts with: "SchemaSubject" + Given SchemaRegistrySchemaName version is: "1" + Given SchemaRegistrySchemaName type is: "JSON" + Given SchemaRegistrySchemaName Compatibility is: "BACKWARD" + When SchemaRegistrySchemaName remove schema clicked + Then Schema starts with: "SchemaSubject" deleted + Then SchemaRegistrySchemaName starts with: "SchemaSubject", visible is: "false" + + Scenario: SchemaRegistry Json schema actions + Given Schema Registry is visible + When click on Schema Registry link + Then Schema Registry heading visible + Given SchemaRegistry CheateSchema clicked + Given SchemaRegistryCreate is visible + Given SchemaRegistryCreate Subject visible is: "true" + Given SchemaRegistryCreate Schema visible is: "true" + Given SchemaRegistryCreate SchemaType visible is: "true" + When SchemaRegistryCreate Subject input starts with: "SchemaSubject" + When SchemaRegistryCreate Schema input from protobuf + When SchemaRegistryCreate Submit clicked + Then SchemaRegistrySchemaName starts with: "SchemaSubject", visible is: "true" + When click on Brokers link + When click on Schema Registry link + Given SchemaRegistry click on schema starts with: "SchemaSubject" + Given SchemaRegistrySchemaName version is: "1" + Given SchemaRegistrySchemaName type is: "PROTOBUF" + Given SchemaRegistrySchemaName Compatibility is: "BACKWARD" + When SchemaRegistrySchemaName remove schema clicked + Then Schema starts with: "SchemaSubject" deleted + Then SchemaRegistrySchemaName starts with: "SchemaSubject", visible is: "false" \ No newline at end of file diff --git a/e2e-playwright/src/pages/SchemaRegistry/SchemaRegistryLocators.ts b/e2e-playwright/src/pages/SchemaRegistry/SchemaRegistryLocators.ts index f6e4a46ca..4aa7c90a1 100644 --- a/e2e-playwright/src/pages/SchemaRegistry/SchemaRegistryLocators.ts +++ b/e2e-playwright/src/pages/SchemaRegistry/SchemaRegistryLocators.ts @@ -16,6 +16,11 @@ export default class SchemaRegistryLocators { get schemaTextBox(): Locator { return this.page.locator('textarea[name="schema"]')}; get schemaTypeDropDown(): Locator { return this.page.locator('form path')}; get submit(): Locator { return this.page.getByRole('button', { name: 'Submit' })}; + get schemaType(): Locator { return this.page.locator('form').getByRole('img')}; schemaTypeDropDownElement(value:string): Locator { return this.page.getByRole('option', { name: value })}; + + toSchema(value:string): Locator { return this.page.getByRole('link', { name: value })}; + + schemaTypeElement(value: string): Locator { return this.page.getByRole('option', { name: value })}; } \ No newline at end of file diff --git a/e2e-playwright/src/pages/SchemaRegistry/SchemaRegistrySchemaNameLocators.ts b/e2e-playwright/src/pages/SchemaRegistry/SchemaRegistrySchemaNameLocators.ts index 903fe52c5..ab3397b10 100644 --- a/e2e-playwright/src/pages/SchemaRegistry/SchemaRegistrySchemaNameLocators.ts +++ b/e2e-playwright/src/pages/SchemaRegistry/SchemaRegistrySchemaNameLocators.ts @@ -7,5 +7,20 @@ export default class SchemaRegistrySchemaNameLocators { this.page = page; } + get editSchema(): Locator { return this.page.getByRole('button', { name: 'Edit Schema' })}; + get newSchemaTextbox(): Locator { return this.page.locator('#newSchema div').filter({ hasText: '{ "type": "record", "name": "' }).nth(1)}; + get submit(): Locator { return this.page.getByRole('button', { name: 'Submit' })}; + get incompatibeError(): Locator { return this.page.getByText('Schema being registered is')}; + get menu(): Locator { return this.page.getByRole('button', { name: 'Dropdown Toggle' })}; + get removeSchema(): Locator { return this.page.getByText('Remove schema')}; + get confirm(): Locator { return this.page.getByRole('button', { name: 'Confirm' })}; + heading(value: string): Locator { return this.page.getByText(`Schema Registry${value}`)}; + + version(value: string): Locator { return this.page.getByText(`Latest version${value}`)}; + type(value: string): Locator { return this.page.getByRole('paragraph').filter({ hasText: value })}; + compatibility(value: string): Locator { return this.page.getByText(`Compatibility${value}`)}; + + editDropdown(value: string): Locator { return this.page.getByRole('listbox').filter({ hasText: value }).getByRole('img')}; + editDropdownElement(value: string): Locator { return this.page.getByRole('list').getByRole('option', { name: value, exact: true })}; } \ No newline at end of file diff --git a/e2e-playwright/src/services/commonFunctions.ts b/e2e-playwright/src/services/commonFunctions.ts index 0e638021d..ddddeabcc 100644 --- a/e2e-playwright/src/services/commonFunctions.ts +++ b/e2e-playwright/src/services/commonFunctions.ts @@ -11,6 +11,12 @@ export async function Delete(page: Page, times: number = 5): Promise { } } +export async function clearWithSelectAll(page: Page): Promise { + const selectAll = process.platform === 'darwin' ? 'Meta+A' : 'Control+A'; + await page.keyboard.press(selectAll); + await page.keyboard.press('Backspace'); +} + // export const generateName = (prefix: string): string => { // return `${prefix}-${uuidv4().slice(0, 8)}`; // }; diff --git a/e2e-playwright/src/steps/SchemaRegistry.steps.ts b/e2e-playwright/src/steps/SchemaRegistry.steps.ts index 4c5f011f3..bce940b42 100644 --- a/e2e-playwright/src/steps/SchemaRegistry.steps.ts +++ b/e2e-playwright/src/steps/SchemaRegistry.steps.ts @@ -2,8 +2,9 @@ import { Given, When, Then, setDefaultTimeout } from "@cucumber/cucumber"; import { PlaywrightWorld } from "../support/PlaywrightWorld"; import { expectVisibility } from "../services/uiHelper"; -import { generateName } from "../services/commonFunctions"; -import { getAvroSchema } from "../services/schemas" +import { generateName } from "../services/commonFunctions"; +import { getAvroSchema, getAvroUpdatedSchema, getAvroSchemaValid, getJsonSchema, getProtobufSchema } from "../services/schemas" +import { clearWithSelectAll } from '../services/commonFunctions' setDefaultTimeout(60 * 1000 * 2); @@ -38,6 +39,20 @@ When('SchemaRegistryCreate Schema input from avro', async function(this: Playwri await this.locators.schemaRegistry.schemaTextBox.fill(schema); }); +When('SchemaRegistryCreate Schema input from json', async function(this: PlaywrightWorld) { + const schema = getJsonSchema(); + await this.locators.schemaRegistry.schemaType.click(); + await this.locators.schemaRegistry.schemaTypeElement("JSON").click(); + await this.locators.schemaRegistry.schemaTextBox.fill(schema); +}); + +When('SchemaRegistryCreate Schema input from protobuf', async function(this: PlaywrightWorld) { + const schema = getProtobufSchema(); + await this.locators.schemaRegistry.schemaType.click(); + await this.locators.schemaRegistry.schemaTypeElement("PROTOBUF").click(); + await this.locators.schemaRegistry.schemaTextBox.fill(schema); +}); + When('SchemaRegistryCreate Submit clicked', async function(this: PlaywrightWorld) { await this.locators.schemaRegistry.submit.click(); }); @@ -48,4 +63,70 @@ Then('SchemaRegistrySchemaName starts with: {string}, visible is: {string}', const locator = this.locators.schemaName.heading(streamName); await expectVisibility(locator, visible); } -); \ No newline at end of file +); + +Given('SchemaRegistry click on schema starts with: {string}', async function(this: PlaywrightWorld, prefix: string) { + const schemaName = this.getValue(`subjectName-${prefix}`); + const locator = await this.locators.schemaRegistry.toSchema(schemaName).click(); +}); + +Given('SchemaRegistrySchemaName version is: {string}', async function(this: PlaywrightWorld, version: string) { + await expectVisibility( this.locators.schemaName.version(version), "true"); +}); + +Given('SchemaRegistrySchemaName type is: {string}', async function(this: PlaywrightWorld, expectedType: string) { + await expectVisibility( this.locators.schemaName.type(expectedType), "true"); +}); + +Given('SchemaRegistrySchemaName Compatibility is: {string}', async function(this: PlaywrightWorld, expectedCompatibility: string) { + await expectVisibility( this.locators.schemaName.compatibility(expectedCompatibility), "true"); +}); + +Given('SchemaRegistrySchemaName EditSchema clicked', async function(this: PlaywrightWorld) { + await this.locators.schemaName.editSchema.click(); +}); + +Given('SchemaRegistrySchemaNameEdit New schema is update avro not valid', async function(this: PlaywrightWorld) { + const schema = getAvroUpdatedSchema(); + const textBox = this.locators.schemaName.newSchemaTextbox; + await textBox.click(); + await clearWithSelectAll(this.page); + await textBox.focus(); + await textBox.type(schema) +}); + +Given('SchemaRegistrySchemaNameEdit New schema is update avro valid', async function(this: PlaywrightWorld) { + const schema = getAvroSchemaValid(); + const textBox = this.locators.schemaName.newSchemaTextbox; + await textBox.click(); + await clearWithSelectAll(this.page); + await textBox.focus(); + await textBox.type(schema) +}); + +Given( + 'SchemaRegistrySchemaNameEdit old Compatibility is: {string}, new Compatibility is: {string}', + async function(this: PlaywrightWorld, oldLevel: string, newLevel: string) { + await this.locators.schemaName.editDropdown(oldLevel).click(); + await this.locators.schemaName.editDropdownElement(newLevel).click(); + } +); + +When('SchemaRegistrySchemaNameEdit submit clicked', async function(this: PlaywrightWorld) { + await this.locators.schemaName.submit.click(); +}); + +Then('Error incompatible visible', async function(this: PlaywrightWorld) { + await expectVisibility(this.locators.schemaName.incompatibeError, "true"); +}); + +When('SchemaRegistrySchemaName remove schema clicked', async function(this: PlaywrightWorld) { + await this.locators.schemaName.menu.click(); + await this.locators.schemaName.removeSchema.click() + await this.locators.schemaName.confirm.click(); +}); + +Then('Schema starts with: {string} deleted', async function(this: PlaywrightWorld, prefix: string) { + const schemaName = this.getValue(`subjectName-${prefix}`); + +}); \ No newline at end of file From 971f78ae6baf12b8fb49c1ed473cbd9e5ca7e188 Mon Sep 17 00:00:00 2001 From: AspidDark Date: Thu, 19 Jun 2025 16:29:03 +0300 Subject: [PATCH 13/14] Topic messages --- .../src/features/TopicsMessages.feature | 74 ++++++++++++++++++- .../pages/Topics/TopicsTopickNameLocators.ts | 7 ++ e2e-playwright/src/steps/ProduceMessages.ts | 24 ++++++ .../src/steps/SchemaRegistry.steps.ts | 11 +-- 4 files changed, 103 insertions(+), 13 deletions(-) diff --git a/e2e-playwright/src/features/TopicsMessages.feature b/e2e-playwright/src/features/TopicsMessages.feature index e92670e70..0fc0cd637 100644 --- a/e2e-playwright/src/features/TopicsMessages.feature +++ b/e2e-playwright/src/features/TopicsMessages.feature @@ -49,17 +49,85 @@ Feature: Produce Messages page Then Header starts with: "ANewAutoTopic" Given TopicName menu button clicked Then TopicNameMenu clear messages active is: "true" - When TopicNameMenu edit settings clicked When TopicName cleanup policy set to: "Compact" When TopicName UpdateTopic button clicked Then Header starts with: "ANewAutoTopic" Given TopicName menu button clicked Then TopicNameMenu clear messages active is: "false" - When TopicNameMenu edit settings clicked When TopicName cleanup policy set to: "Delete" When TopicName UpdateTopic button clicked Then Header starts with: "ANewAutoTopic" Given TopicName menu button clicked - Then TopicNameMenu clear messages active is: "true" \ No newline at end of file + Then TopicNameMenu clear messages active is: "true" + + Scenario: Produce messages clear messages + Given Topics is visible + When click on Topics link + Given Topics AddATopic clicked + Given TopicCreate heading visible is: "true" + When TopicCreate Topic name starts with: "ANewAutoTopic" + When TopicCreate Number of partitons: 1 + When TopicCreate Time to retain data one day + When TopicCreate Create topic clicked + Then Header starts with: "ANewAutoTopic" + Given Produce message clicked + Then ProduceMessage header visible + Given ProduceMessage Key input is: "keyFromAutotest" + Given ProduceMessage Value input is: "ValueFromAutotest" + Given ProduceMessage Headers input key is: "headerKey", value is: "headerValue" + Given ProduceMessage Produce Message button clicked + When Topics TopicName Messages clicked + Then TopicName messages contains key: "keyFromAutotest" + Then TopicName messages contains value: "ValueFromAutotest" + Then TopicName messages contains headers key is: "headerKey", value is: "headerValue" + Then Topics TopicName Overview click + Then TopicName messages count is "1" + Given Produce message clicked + Given ProduceMessage Key input is: "keyFromAutotest2" + Given ProduceMessage Value input is: "ValueFromAutotest2" + Given ProduceMessage Headers input key is: "headerKey2", value is: "headerValue2" + Given ProduceMessage Produce Message button clicked + Then TopicName messages count is "2" + When TopicName clear messages clicked + Then TopicName messages count is "0" + + Given Produce message clicked + Given ProduceMessage Key input is: "keyFromAutotest3" + Given ProduceMessage Value input is: "ValueFromAutotest3" + Given ProduceMessage Headers input key is: "headerKey3", value is: "headerValue3" + Given ProduceMessage Produce Message button clicked + Then TopicName messages count is "1" + Given Produce message clicked + Given ProduceMessage Key input is: "keyFromAutotest4" + Given ProduceMessage Value input is: "ValueFromAutotest4" + Given ProduceMessage Headers input key is: "headerKey4", value is: "headerValue4" + Given ProduceMessage Produce Message button clicked + Then TopicName messages count is "2" + When TopicName menu button clicked + When TopicName menu clear messages clicked + Then TopicName messages count is "0" + + Given Produce message clicked + Given ProduceMessage Key input is: "keyFromAutotest5" + Given ProduceMessage Value input is: "ValueFromAutotest5" + Given ProduceMessage Headers input key is: "headerKey5", value is: "headerValue5" + Given ProduceMessage Produce Message button clicked + Then TopicName messages count is "1" + Given Produce message clicked + Given ProduceMessage Key input is: "keyFromAutotest6" + Given ProduceMessage Value input is: "ValueFromAutotest6" + Given ProduceMessage Headers input key is: "headerKey6", value is: "headerValue6" + Given ProduceMessage Produce Message button clicked + Then TopicName messages count is "2" + When TopicName menu button clicked + When TopicName menu RecreateTopic clicked + Then TopicName messages count is "0" + + Given Produce message clicked + Given ProduceMessage Key input is: "keyFromAutotest7" + Given ProduceMessage Value input is: "ValueFromAutotest7" + Given ProduceMessage Headers input key is: "headerKey7", value is: "headerValue7" + Given ProduceMessage Produce Message button clicked + Then TopicName messages count is "1" \ No newline at end of file diff --git a/e2e-playwright/src/pages/Topics/TopicsTopickNameLocators.ts b/e2e-playwright/src/pages/Topics/TopicsTopickNameLocators.ts index 06cc76055..670125bc8 100644 --- a/e2e-playwright/src/pages/Topics/TopicsTopickNameLocators.ts +++ b/e2e-playwright/src/pages/Topics/TopicsTopickNameLocators.ts @@ -20,9 +20,14 @@ export default class TopicsTopickNameLocators { get menuItemEditSettings():Locator { return this.page.getByRole('menuitem', { name: 'Edit settings Pay attention!' }) } get menuItemClearMessages():Locator { return this.page.getByText('Clear messagesClearing') } + get menuItemRecreateTopic():Locator { return this.page.getByText('Recreate Topic') } + get confirm():Locator { return this.page.getByRole('button', { name: 'Confirm' }) } get cleanupPolicyDropdown():Locator { return this.page.getByRole('listbox', { name: 'Cleanup policy' }) } get updateTopicButton():Locator { return this.page.getByRole('button', { name: 'Update topic' }) } + get messagesDropdown():Locator { return this.page.getByRole('cell', { name: 'Dropdown Toggle' }).getByLabel('Dropdown Toggle') } + get clearMessages():Locator { return this.page.getByText('Clear Messages', { exact: true }) } + get deleteSuccess():Locator { return this.page.getByRole('heading', { name: 'Success' }) } heading(topicName: string): Locator { return this.page.getByText(`Topics${topicName}`); } partitions(value: string):Locator { return this.page.getByRole('group').getByText(value).first(); } @@ -34,4 +39,6 @@ export default class TopicsTopickNameLocators { messageHeadersTextbox(value: string):Locator { return this.page.locator('div').filter({ hasText: value }).nth(1); } cleanupPolicyDropdownItem(value: string):Locator { return this.page.getByRole('option', { name: value, exact: true }); } + + messagesCount(value: string):Locator { return this.page.getByText(`Message Count ${value}`); } } \ No newline at end of file diff --git a/e2e-playwright/src/steps/ProduceMessages.ts b/e2e-playwright/src/steps/ProduceMessages.ts index 27e685aa1..7563c307e 100644 --- a/e2e-playwright/src/steps/ProduceMessages.ts +++ b/e2e-playwright/src/steps/ProduceMessages.ts @@ -109,4 +109,28 @@ When('TopicName cleanup policy set to: {string}', async function(this: Playwrigh When('TopicName UpdateTopic button clicked', async function(this: PlaywrightWorld) { await this.locators.topicTopicName.updateTopicButton.click(); +}); + +Then('Topics TopicName Overview click', async function(this: PlaywrightWorld) { + await this.locators.topicTopicName.overview.click(); +}); + +Then('TopicName messages count is {string}', async function(this: PlaywrightWorld, expectedCount: string) { + await expectVisibility(this.locators.topicTopicName.messagesCount(expectedCount), "true"); +}); + +When('TopicName clear messages clicked', async function(this: PlaywrightWorld) { + await this.locators.topicTopicName.messagesDropdown.click(); + await this.locators.topicTopicName.clearMessages.click(); +}); + +When('TopicName menu clear messages clicked', async function(this: PlaywrightWorld) { + await this.locators.topicTopicName.menuItemClearMessages.click(); + await this.locators.topicTopicName.confirm.click(); + } +); + +When('TopicName menu RecreateTopic clicked', async function(this: PlaywrightWorld) { + await this.locators.topicTopicName.menuItemRecreateTopic.click(); + await this.locators.topicTopicName.confirm.click(); }); \ No newline at end of file diff --git a/e2e-playwright/src/steps/SchemaRegistry.steps.ts b/e2e-playwright/src/steps/SchemaRegistry.steps.ts index bce940b42..1ef0b921d 100644 --- a/e2e-playwright/src/steps/SchemaRegistry.steps.ts +++ b/e2e-playwright/src/steps/SchemaRegistry.steps.ts @@ -3,7 +3,7 @@ import { Given, When, Then, setDefaultTimeout } from "@cucumber/cucumber"; import { PlaywrightWorld } from "../support/PlaywrightWorld"; import { expectVisibility } from "../services/uiHelper"; import { generateName } from "../services/commonFunctions"; -import { getAvroSchema, getAvroUpdatedSchema, getAvroSchemaValid, getJsonSchema, getProtobufSchema } from "../services/schemas" +import { getAvroSchema, getAvroUpdatedSchema, getJsonSchema, getProtobufSchema } from "../services/schemas" import { clearWithSelectAll } from '../services/commonFunctions' setDefaultTimeout(60 * 1000 * 2); @@ -95,15 +95,6 @@ Given('SchemaRegistrySchemaNameEdit New schema is update avro not valid', async await textBox.type(schema) }); -Given('SchemaRegistrySchemaNameEdit New schema is update avro valid', async function(this: PlaywrightWorld) { - const schema = getAvroSchemaValid(); - const textBox = this.locators.schemaName.newSchemaTextbox; - await textBox.click(); - await clearWithSelectAll(this.page); - await textBox.focus(); - await textBox.type(schema) -}); - Given( 'SchemaRegistrySchemaNameEdit old Compatibility is: {string}, new Compatibility is: {string}', async function(this: PlaywrightWorld, oldLevel: string, newLevel: string) { From 5b5b14c3443b62d48d92fc70f6eb7b4ba5003fc6 Mon Sep 17 00:00:00 2001 From: AspidDark Date: Tue, 1 Jul 2025 22:36:54 +0300 Subject: [PATCH 14/14] Topics finished --- ...csCreate.feature => TopicsActions.feature} | 16 ++++++ .../src/features/TopicsMessages.feature | 42 ++++++++++++-- .../src/pages/Topics/TopicsLocators.ts | 4 ++ .../pages/Topics/TopicsTopickNameLocators.ts | 12 +++- e2e-playwright/src/services/filters.ts | 3 + e2e-playwright/src/services/templateJsons.ts | 1 + e2e-playwright/src/steps/ProduceMessages.ts | 56 +++++++++++++++++++ .../src/steps/TopicsCreate.steps.ts | 7 +++ .../ui/screens/topics/TopicDetails.java | 8 +++ 9 files changed, 144 insertions(+), 5 deletions(-) rename e2e-playwright/src/features/{TopicsCreate.feature => TopicsActions.feature} (79%) create mode 100644 e2e-playwright/src/services/filters.ts create mode 100644 e2e-playwright/src/services/templateJsons.ts diff --git a/e2e-playwright/src/features/TopicsCreate.feature b/e2e-playwright/src/features/TopicsActions.feature similarity index 79% rename from e2e-playwright/src/features/TopicsCreate.feature rename to e2e-playwright/src/features/TopicsActions.feature index 5e663857f..43a562af4 100644 --- a/e2e-playwright/src/features/TopicsCreate.feature +++ b/e2e-playwright/src/features/TopicsActions.feature @@ -51,3 +51,19 @@ Feature: TopicsCreate page Then TopicCreate TimeToRetainData value is: "604800000" When TopicCreate 4Weeks button clicked Then TopicCreate TimeToRetainData value is: "2419200000" + + Scenario: Topic Delete + Given Topics is visible + When click on Topics link + Given Topics AddATopic clicked + Given TopicCreate heading visible is: "true" + When TopicCreate Topic name starts with: "NewAutoTopic" + When TopicCreate Number of partitons: 1 + When TopicCreate Time to retain data one day + When TopicCreate Create topic clicked + Then Header starts with: "NewAutoTopic" + When click on Topics link + Then Topic name started with: "NewAutoTopic" visible is: "true" + When Topic name started with: "NewAutoTopic" RemoveTopic clicked + Then Topic name started with: "NewAutoTopic" visible is: "false" + \ No newline at end of file diff --git a/e2e-playwright/src/features/TopicsMessages.feature b/e2e-playwright/src/features/TopicsMessages.feature index 0fc0cd637..6e818dfec 100644 --- a/e2e-playwright/src/features/TopicsMessages.feature +++ b/e2e-playwright/src/features/TopicsMessages.feature @@ -92,7 +92,6 @@ Feature: Produce Messages page Then TopicName messages count is "2" When TopicName clear messages clicked Then TopicName messages count is "0" - Given Produce message clicked Given ProduceMessage Key input is: "keyFromAutotest3" Given ProduceMessage Value input is: "ValueFromAutotest3" @@ -108,7 +107,6 @@ Feature: Produce Messages page When TopicName menu button clicked When TopicName menu clear messages clicked Then TopicName messages count is "0" - Given Produce message clicked Given ProduceMessage Key input is: "keyFromAutotest5" Given ProduceMessage Value input is: "ValueFromAutotest5" @@ -124,10 +122,46 @@ Feature: Produce Messages page When TopicName menu button clicked When TopicName menu RecreateTopic clicked Then TopicName messages count is "0" - Given Produce message clicked Given ProduceMessage Key input is: "keyFromAutotest7" Given ProduceMessage Value input is: "ValueFromAutotest7" Given ProduceMessage Headers input key is: "headerKey7", value is: "headerValue7" Given ProduceMessage Produce Message button clicked - Then TopicName messages count is "1" \ No newline at end of file + Then TopicName messages count is "1" + + + Scenario: Topic message filter + Given Topics is visible + When click on Topics link + Given Topics AddATopic clicked + Given TopicCreate heading visible is: "true" + When TopicCreate Topic name starts with: "ANewAutoTopic" + When TopicCreate Number of partitons: 1 + When TopicCreate Time to retain data one day + When TopicCreate Create topic clicked + Then Header starts with: "ANewAutoTopic" + Given Produce message clicked + Then ProduceMessage header visible + Given ProduceMessage Key input is: "keyFromAutotest" + Given ProduceMessage Value input template Json + Given ProduceMessage Headers input key is: "headerKey", value is: "headerValue" + Given ProduceMessage Produce Message button clicked + When Topics TopicName Messages clicked + Given Topics TopicName AddFilters button click + Given Topics TopicName AddFilter visible is: "true" + Given Topics TopicName AddFilter filterCode Json value is: "2" + Given Topics TopicName AddFilter display name starts with: "Filter" + When Topics TopicName AddFilter button click + Then Topics TopicName Messages filter name starts with: "Filter" visible is: "true" + Then Topics TopicName Messages exist is: "true" + + + Given Topics TopicName Messages edit filter button click + Given Topics TopicName AddFilter filterCode change value is: "3" + Then Topics TopicName AddFilter EditFilter button click + + Then Topics TopicName Messages filter name starts with: "Filter" visible is: "true" + Then Topics TopicName Messages exist is: "false" + + + diff --git a/e2e-playwright/src/pages/Topics/TopicsLocators.ts b/e2e-playwright/src/pages/Topics/TopicsLocators.ts index 8b8493d5e..26872d6f8 100644 --- a/e2e-playwright/src/pages/Topics/TopicsLocators.ts +++ b/e2e-playwright/src/pages/Topics/TopicsLocators.ts @@ -17,6 +17,10 @@ export default class TopicsLocators { get copySelectedTopicButton(): Locator { return this.page.getByRole('button', { name: 'Copy selected topic' }); } get purgeMessagesOfSelectedTopicsButton(): Locator { return this.page.getByRole('button', { name: 'Purge messages of selected' }); } get selectAllCheckBox(): Locator { return this.page.getByRole('row', { name: 'Topic Name Partitions Out of' }).getByRole('checkbox'); } + get topicMenuItemRemove(): Locator { return this.page.getByRole('menuitem', { name: 'Remove Topic' }).locator('div'); } + get topicApproveWindowConfirm(): Locator { return this.page.getByRole('button', { name: 'Confirm' }); } + rowCheckBox(message: string): Locator { return this.page.getByRole('row', { name: message }).getByRole('checkbox'); } nameLink(value: string): Locator { return this.page.getByRole('link', { name: value }); } + topicMenu(value: string): Locator { return this.page.getByRole('row', { name: `${value} 1 0 1 0 0 Bytes` }).getByLabel('Dropdown Toggle'); } } \ No newline at end of file diff --git a/e2e-playwright/src/pages/Topics/TopicsTopickNameLocators.ts b/e2e-playwright/src/pages/Topics/TopicsTopickNameLocators.ts index 670125bc8..a17d9ef57 100644 --- a/e2e-playwright/src/pages/Topics/TopicsTopickNameLocators.ts +++ b/e2e-playwright/src/pages/Topics/TopicsTopickNameLocators.ts @@ -29,6 +29,16 @@ export default class TopicsTopickNameLocators { get clearMessages():Locator { return this.page.getByText('Clear Messages', { exact: true }) } get deleteSuccess():Locator { return this.page.getByRole('heading', { name: 'Success' }) } + get addFilters():Locator { return this.page.getByRole('button', { name: 'Add Filters' }) } + get addFilterHead():Locator { return this.page.getByText('Add Filter').nth(1) } + get addFilterFilterCode():Locator { return this.page.locator('.ace_content').first() } + get addFilterFilterCodeInput():Locator { return this.page.getByRole('form', { name: 'Filters submit Form' }).locator('textarea') } + get addFilterDisplayName():Locator { return this.page.getByRole('textbox', { name: 'Enter Name' }) } + get addFilterButton():Locator { return this.page.getByRole('button', { name: 'Add Filter', exact: true }) } + get cellExists():Locator { return this.page.getByRole('cell', { name: '0', exact: true }).first() } + get editFilter():Locator { return this.page.getByTestId('activeSmartFilter').getByRole('button', { name: 'Edit' }) } + get editFilterButton():Locator { return this.page.getByRole('button', { name: 'Edit Filter' }) } + heading(topicName: string): Locator { return this.page.getByText(`Topics${topicName}`); } partitions(value: string):Locator { return this.page.getByRole('group').getByText(value).first(); } messageKey(value: string):Locator { return this.page.getByText(value, { exact: true }); } @@ -39,6 +49,6 @@ export default class TopicsTopickNameLocators { messageHeadersTextbox(value: string):Locator { return this.page.locator('div').filter({ hasText: value }).nth(1); } cleanupPolicyDropdownItem(value: string):Locator { return this.page.getByRole('option', { name: value, exact: true }); } - messagesCount(value: string):Locator { return this.page.getByText(`Message Count ${value}`); } + filterName(value: string):Locator { return this.page.getByTestId('activeSmartFilter').getByText(value); } } \ No newline at end of file diff --git a/e2e-playwright/src/services/filters.ts b/e2e-playwright/src/services/filters.ts new file mode 100644 index 000000000..1943794fd --- /dev/null +++ b/e2e-playwright/src/services/filters.ts @@ -0,0 +1,3 @@ +export const jsonFilter = (value : string):string => { + return `record.value.value.internalValue == ${value}`; + } \ No newline at end of file diff --git a/e2e-playwright/src/services/templateJsons.ts b/e2e-playwright/src/services/templateJsons.ts new file mode 100644 index 000000000..f9dd71de0 --- /dev/null +++ b/e2e-playwright/src/services/templateJsons.ts @@ -0,0 +1 @@ +export const getBlankJson = '{"name":"Name","value":{"internalValue":2}}'; \ No newline at end of file diff --git a/e2e-playwright/src/steps/ProduceMessages.ts b/e2e-playwright/src/steps/ProduceMessages.ts index 7563c307e..f57ecffb4 100644 --- a/e2e-playwright/src/steps/ProduceMessages.ts +++ b/e2e-playwright/src/steps/ProduceMessages.ts @@ -3,6 +3,8 @@ import { Given, When, Then, setDefaultTimeout } from "@cucumber/cucumber"; import { expect } from "@playwright/test"; import { expectVisibility, expectVisuallyActive, refreshPageAfterDelay } from "../services/uiHelper"; import { PlaywrightWorld } from "../support/PlaywrightWorld"; +import { getBlankJson } from "../services/templateJsons" +import { jsonFilter } from "../services/filters" setDefaultTimeout(60 * 1000 * 4); @@ -54,6 +56,15 @@ Given('ProduceMessage Value input is: {string}', async function(this: Playwright expect(actualValue).toContain(value); }); +Given('ProduceMessage Value input template Json', async function(this: PlaywrightWorld) { + const value = getBlankJson + const textbox = this.locators.produceMessage.valueTextbox; + await textbox.fill(value); + + const actualValue = await textbox.inputValue(); + expect(actualValue).toContain(value); +}); + Given('ProduceMessage Headers input key is: {string}, value is: {string}', async function(this: PlaywrightWorld, key: string, value: string) { const header = `{"${key}":"${value}"}`; const textbox = this.locators.produceMessage.headersTextbox; @@ -133,4 +144,49 @@ When('TopicName menu clear messages clicked', async function(this: PlaywrightWor When('TopicName menu RecreateTopic clicked', async function(this: PlaywrightWorld) { await this.locators.topicTopicName.menuItemRecreateTopic.click(); await this.locators.topicTopicName.confirm.click(); +}); + +Given('Topics TopicName AddFilters button click', async function(this: PlaywrightWorld) { + await this.locators.topicTopicName.addFilters.click(); +}); + +Given('Topics TopicName AddFilter visible is: {string}', async function(this: PlaywrightWorld, visible: string) { + await expectVisibility(this.locators.topicTopicName.addFilterHead, "true"); +}); + +Given('Topics TopicName AddFilter filterCode Json value is: {string}', async function(this: PlaywrightWorld, value: string) { + const filter = jsonFilter(value); + await this.locators.topicTopicName.addFilterFilterCode.click(); + const input = this.locators.topicTopicName.addFilterFilterCodeInput; + await input.fill(filter); +}); + +Given('Topics TopicName AddFilter filterCode change value is: {string}', async function(this: PlaywrightWorld, newValue: string) { + await this.locators.topicTopicName.addFilterFilterCode.click(); + await this.locators.topicTopicName.addFilterFilterCodeInput.press('Backspace'); + await this.locators.topicTopicName.addFilterFilterCodeInput.type(newValue); +}); + +Given('Topics TopicName AddFilter display name starts with: {string}', async function(this: PlaywrightWorld, namePrefix: string) { + await this.locators.topicTopicName.addFilterDisplayName.fill(namePrefix); +}); + +When('Topics TopicName AddFilter button click', async function(this: PlaywrightWorld) { + await this.locators.topicTopicName.addFilterButton.click(); +}); + +Then('Topics TopicName Messages filter name starts with: {string} visible is: {string}', async function(this: PlaywrightWorld, namePrefix: string, visible: string) { + await expectVisibility( this.locators.topicTopicName.filterName(namePrefix), visible); +}); + +Then('Topics TopicName Messages exist is: {string}', async function(this: PlaywrightWorld, expected: string) { + await expectVisibility( this.locators.topicTopicName.cellExists, expected); +}); + +Given('Topics TopicName Messages edit filter button click', async function(this: PlaywrightWorld) { + await this.locators.topicTopicName.editFilter.click(); +}); + +Then('Topics TopicName AddFilter EditFilter button click', async function(this: PlaywrightWorld) { + await this.locators.topicTopicName.editFilterButton.click(); }); \ No newline at end of file diff --git a/e2e-playwright/src/steps/TopicsCreate.steps.ts b/e2e-playwright/src/steps/TopicsCreate.steps.ts index 26996c3c4..68c4f0acf 100644 --- a/e2e-playwright/src/steps/TopicsCreate.steps.ts +++ b/e2e-playwright/src/steps/TopicsCreate.steps.ts @@ -135,3 +135,10 @@ When('TopicCreate 7Day button clicked', async function() { When('TopicCreate 4Weeks button clicked', async function() { await this.locators.topicsCreate.button4Weeks.click(); }); + +When('Topic name started with: {string} RemoveTopic clicked', async function(this: PlaywrightWorld, prefix: string) { + const topicName = this.getValue(`topicName-${prefix}`); + await this.locators.topics.topicMenu(topicName).click(); + await this.locators.topics.topicMenuItemRemove.click(); + await this.locators.topics.topicApproveWindowConfirm.click(); +}); diff --git a/e2e-tests/src/main/java/io/kafbat/ui/screens/topics/TopicDetails.java b/e2e-tests/src/main/java/io/kafbat/ui/screens/topics/TopicDetails.java index b27da901c..fb4674aed 100644 --- a/e2e-tests/src/main/java/io/kafbat/ui/screens/topics/TopicDetails.java +++ b/e2e-tests/src/main/java/io/kafbat/ui/screens/topics/TopicDetails.java @@ -41,9 +41,13 @@ public class TopicDetails extends BasePage { protected SelenideElement addFiltersBtn = $x("//button[text()='Add Filters']"); protected SelenideElement savedFiltersLink = $x("//div[text()='Saved Filters']"); protected SelenideElement addFilterCodeModalTitle = $x("//label[text()='Filter code']"); + protected SelenideElement addFilterCodeEditor = $x("//div[@id='ace-editor']"); protected SelenideElement addFilterCodeTextarea = $x("//div[@id='ace-editor']//textarea"); + + protected SelenideElement saveThisFilterCheckBoxAddFilterMdl = $x("//input[@name='saveFilter']"); + protected SelenideElement displayNameInputAddFilterMdl = $x("//input[@placeholder='Enter Name']"); protected SelenideElement cancelBtnAddFilterMdl = $x("//button[text()='Cancel']"); protected SelenideElement addFilterBtnAddFilterMdl = $x("//button[text()='Add Filter']"); @@ -227,6 +231,8 @@ public TopicDetails setFilterCodeFldAddFilterMdl(String filterCode) { return this; } + + @Step public String getFilterCodeValue() { addFilterCodeEditor.shouldBe(enabled).click(); @@ -238,6 +244,8 @@ public String getFilterCodeValue() { } } + + @Step public String getFilterNameValue() { return displayNameInputAddFilterMdl.shouldBe(enabled).getValue();