Repository: provectus/kafka-ui
Issue: [e2e] Checking KSQL request execution
Labels: scope/QA
scope/AQA

Autotest implementation for:

https://app.qase.io/case/KAFKAUI-41

Description:
The purpose of this case is to check KSQL request execution

Pre-conditions:

- Login to system

- Navigate to KSQL DB

- Create stream

- Create tables for stream

- For more info use https://ksqldb.io/quickstart.html

Steps:
1. Press "Execute KSQL Request"
2. Input the query for KSQL
**Input data:** 
show tables;
3. Press "Execute"
**Expected result:**
All the requesting data should appear under the query

Issue comments:
We have documentation for this ticket https://ksqldb.io/quickstart.html 

@BulatKha 
We need to reproduce 4 and 5 steps as preconditions for create Stream and TABLE , and using this table for KSQL query 
@anezboretskiy we need to get AC and cover this case

Pull request review comments:
if the class consists wih enum only u can to not declare the class, just enum
also upd KsqlQueryConfig pls
1. in this logic method should be called as getTableNameElm()
2. no reason in this method because element it returns used only once in getTableName()
same comment as for 64 line
Done
Deleted method 
Deleted method 

Patch that resolved the issue:
diff --git a/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/ksqldb/KsqlDbList.java b/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/ksqldb/KsqlDbList.java
new file mode 100644
index 00000000000..ec735df65a7
--- /dev/null
+++ b/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/ksqldb/KsqlDbList.java
@@ -0,0 +1,137 @@
+package com.provectus.kafka.ui.pages.ksqldb;
+
+import static com.codeborne.selenide.Selenide.$;
+import static com.codeborne.selenide.Selenide.$x;
+
+import com.codeborne.selenide.CollectionCondition;
+import com.codeborne.selenide.Condition;
+import com.codeborne.selenide.SelenideElement;
+import com.provectus.kafka.ui.pages.BasePage;
+import com.provectus.kafka.ui.pages.ksqldb.enums.KsqlMenuTabs;
+import io.qameta.allure.Step;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import org.openqa.selenium.By;
+
+public class KsqlDbList extends BasePage {
+  protected SelenideElement executeKsqlBtn = $x("//button[text()='Execute KSQL Request']");
+  protected SelenideElement tablesTab = $x("//nav[@role='navigation']/a[text()='Tables']");
+  protected SelenideElement streamsTab = $x("//nav[@role='navigation']/a[text()='Streams']");
+
+  @Step
+  public KsqlDbList waitUntilScreenReady() {
+    waitUntilSpinnerDisappear();
+    Arrays.asList(tablesTab, streamsTab).forEach(tab -> tab.shouldBe(Condition.visible));
+    return this;
+  }
+
+  @Step
+  public KsqlDbList clickExecuteKsqlRequestBtn() {
+    clickByJavaScript(executeKsqlBtn);
+    return this;
+  }
+
+  @Step
+  public KsqlDbList openDetailsTab(KsqlMenuTabs menu) {
+    $(By.linkText(menu.toString())).shouldBe(Condition.visible).click();
+    waitUntilSpinnerDisappear();
+    return this;
+  }
+
+  private List<KsqlDbList.KsqlTablesGridItem> initTablesItems() {
+    List<KsqlDbList.KsqlTablesGridItem> gridItemList = new ArrayList<>();
+    allGridItems.shouldHave(CollectionCondition.sizeGreaterThan(0))
+        .forEach(item -> gridItemList.add(new KsqlDbList.KsqlTablesGridItem(item)));
+    return gridItemList;
+  }
+
+  @Step
+  public KsqlDbList.KsqlTablesGridItem getTableByName(String tableName) {
+    return initTablesItems().stream()
+        .filter(e -> e.getTableName().equals(tableName))
+        .findFirst().orElse(null);
+  }
+
+  public static class KsqlTablesGridItem extends BasePage {
+
+    private final SelenideElement element;
+
+    public KsqlTablesGridItem(SelenideElement element) {
+      this.element = element;
+    }
+
+    @Step
+    public String getTableName() {
+      return element.$x("./td[1]").getText().trim();
+    }
+
+    @Step
+    public String getTopicName() {
+      return element.$x("./td[2]").getText().trim();
+    }
+
+    @Step
+    public String getKeyFormat() {
+      return element.$x("./td[3]").getText().trim();
+    }
+
+    @Step
+    public String getValueFormat() {
+      return element.$x("./td[4]").getText().trim();
+    }
+
+    @Step
+    public String getIsWindowed() {
+      return element.$x("./td[5]").getText().trim();
+    }
+  }
+
+  private List<KsqlDbList.KsqlStreamsGridItem> initStreamsItems() {
+    List<KsqlDbList.KsqlStreamsGridItem> gridItemList = new ArrayList<>();
+    allGridItems.shouldHave(CollectionCondition.sizeGreaterThan(0))
+        .forEach(item -> gridItemList.add(new KsqlDbList.KsqlStreamsGridItem(item)));
+    return gridItemList;
+  }
+
+  @Step
+  public KsqlDbList.KsqlStreamsGridItem getStreamByName(String streamName) {
+    return initStreamsItems().stream()
+        .filter(e -> e.getStreamName().equals(streamName))
+        .findFirst().orElse(null);
+  }
+
+  public static class KsqlStreamsGridItem extends BasePage {
+
+    private final SelenideElement element;
+
+    public KsqlStreamsGridItem(SelenideElement element) {
+      this.element = element;
+    }
+
+    @Step
+    public String getStreamName() {
+      return element.$x("./td[1]").getText().trim();
+    }
+
+    @Step
+    public String getTopicName() {
+      return element.$x("./td[2]").getText().trim();
+    }
+
+    @Step
+    public String getKeyFormat() {
+      return element.$x("./td[3]").getText().trim();
+    }
+
+    @Step
+    public String getValueFormat() {
+      return element.$x("./td[4]").getText().trim();
+    }
+
+    @Step
+    public String getIsWindowed() {
+      return element.$x("./td[5]").getText().trim();
+    }
+  }
+}
diff --git a/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/ksqldb/KsqlQueryForm.java b/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/ksqldb/KsqlQueryForm.java
new file mode 100644
index 00000000000..21ceacdbb7f
--- /dev/null
+++ b/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/ksqldb/KsqlQueryForm.java
@@ -0,0 +1,144 @@
+package com.provectus.kafka.ui.pages.ksqldb;
+
+import static com.codeborne.selenide.Condition.visible;
+import static com.codeborne.selenide.Selenide.$$x;
+import static com.codeborne.selenide.Selenide.$x;
+
+import com.codeborne.selenide.CollectionCondition;
+import com.codeborne.selenide.Condition;
+import com.codeborne.selenide.ElementsCollection;
+import com.codeborne.selenide.SelenideElement;
+import com.provectus.kafka.ui.pages.BasePage;
+import io.qameta.allure.Step;
+import java.time.Duration;
+import java.util.ArrayList;
+import java.util.List;
+
+public class KsqlQueryForm extends BasePage {
+  protected SelenideElement pageTitle = $x("//h1[text()='Query']");
+  protected SelenideElement clearBtn = $x("//div/button[text()='Clear']");
+  protected SelenideElement executeBtn = $x("//div/button[text()='Execute']");
+  protected SelenideElement stopQueryBtn = $x("//div/button[text()='Stop query']");
+  protected SelenideElement clearResultsBtn = $x("//div/button[text()='Clear results']");
+  protected SelenideElement addStreamPropertyBtn = $x("//button[text()='Add Stream Property']");
+  protected SelenideElement queryAreaValue = $x("//div[@class='ace_content']");
+  protected SelenideElement queryArea = $x("//div[@id='ksql']/textarea[@class='ace_text-input']");
+  protected ElementsCollection ksqlGridItems = $$x("//tbody//tr");
+  protected ElementsCollection keyField = $$x("//input[@aria-label='value']");
+  protected ElementsCollection valueField = $$x("//input[@aria-label='value']");
+
+  @Step
+  public KsqlQueryForm waitUntilScreenReady() {
+    waitUntilSpinnerDisappear();
+    pageTitle.shouldBe(Condition.visible);
+    return this;
+  }
+
+  @Step
+  public KsqlQueryForm clickClearBtn() {
+    clickByJavaScript(clearBtn);
+    return this;
+  }
+
+  @Step
+  public KsqlQueryForm clickExecuteBtn() {
+    clickByJavaScript(executeBtn);
+    if (queryAreaValue.getText().contains("EMIT CHANGES;")) {
+      loadingSpinner.shouldBe(Condition.visible);
+    } else {
+      waitUntilSpinnerDisappear();
+    }
+    return this;
+  }
+
+  @Step
+  public KsqlQueryForm clickStopQueryBtn() {
+    clickByJavaScript(stopQueryBtn);
+    waitUntilSpinnerDisappear();
+    return this;
+  }
+
+  @Step
+  public KsqlQueryForm clickClearResultsBtn() {
+    clickByJavaScript(clearResultsBtn);
+    waitUntilSpinnerDisappear();
+    return this;
+  }
+
+  @Step
+  public KsqlQueryForm clickAddStreamProperty() {
+    clickByJavaScript(addStreamPropertyBtn);
+    return this;
+  }
+
+  @Step
+  public KsqlQueryForm setQuery(String query) {
+    queryAreaValue.shouldBe(Condition.visible).click();
+    queryArea.setValue(query);
+    return this;
+  }
+
+  private List<KsqlQueryForm.KsqlResponseGridItem> initItems() {
+    List<KsqlQueryForm.KsqlResponseGridItem> gridItemList = new ArrayList<>();
+    ksqlGridItems.shouldHave(CollectionCondition.sizeGreaterThan(0))
+        .forEach(item -> gridItemList.add(new KsqlQueryForm.KsqlResponseGridItem(item)));
+    return gridItemList;
+  }
+
+  @Step
+  public KsqlQueryForm.KsqlResponseGridItem getTableByName(String name) {
+    return initItems().stream()
+        .filter(e -> e.getName().equalsIgnoreCase(name))
+        .findFirst().orElse(null);
+  }
+
+  public static class KsqlResponseGridItem extends BasePage {
+
+    private final SelenideElement element;
+
+    private KsqlResponseGridItem(SelenideElement element) {
+      this.element = element;
+    }
+
+    @Step
+    public String getType() {
+      return element.$x("./td[1]").getText().trim();
+    }
+
+    @Step
+    public String getName() {
+      return element.$x("./td[2]").scrollTo().getText().trim();
+    }
+
+    @Step
+    public boolean isVisible() {
+      boolean isVisible = false;
+      try {
+        element.$x("./td[2]").shouldBe(visible, Duration.ofMillis(500));
+        isVisible = true;
+      } catch (Throwable ignored) {
+      }
+      return isVisible;
+    }
+
+    @Step
+    public String getTopic() {
+      return element.$x("./td[3]").getText().trim();
+    }
+
+    @Step
+    public String getKeyFormat() {
+      return element.$x("./td[4]").getText().trim();
+    }
+
+    @Step
+    public String getValueFormat() {
+      return element.$x("./td[5]").getText().trim();
+    }
+
+    @Step
+    public String getIsWindowed() {
+      return element.$x("./td[6]").getText().trim();
+    }
+  }
+}
diff --git a/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/ksqldb/enums/KsqlMenuTabs.java b/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/ksqldb/enums/KsqlMenuTabs.java
new file mode 100644
index 00000000000..f3bb55d42b0
--- /dev/null
+++ b/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/ksqldb/enums/KsqlMenuTabs.java
@@ -0,0 +1,16 @@
+package com.provectus.kafka.ui.pages.ksqldb.enums;
+
+public enum KsqlMenuTabs {
+    TABLES("Table"),
+    STREAMS("Streams");
+
+    private final String value;
+
+    KsqlMenuTabs(String value) {
+      this.value = value;
+    }
+
+    public String toString() {
+      return value;
+    }
+}
diff --git a/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/ksqldb/enums/KsqlQueryConfig.java b/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/ksqldb/enums/KsqlQueryConfig.java
new file mode 100644
index 00000000000..c918b079973
--- /dev/null
+++ b/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/ksqldb/enums/KsqlQueryConfig.java
@@ -0,0 +1,18 @@
+package com.provectus.kafka.ui.pages.ksqldb.enums;
+
+public enum KsqlQueryConfig {
+    SHOW_TABLES("show tables;"),
+    SHOW_STREAMS("show streams;"),
+    SELECT_ALL_FROM("SELECT * FROM %s\n" +
+        "EMIT CHANGES;");
+
+    private final String query;
+
+    KsqlQueryConfig(String query) {
+      this.query = query;
+    }
+
+    public String getQuery(){
+      return query;
+    }
+}
diff --git a/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/ksqldb/models/Stream.java b/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/ksqldb/models/Stream.java
new file mode 100644
index 00000000000..f61b8243866
--- /dev/null
+++ b/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/ksqldb/models/Stream.java
@@ -0,0 +1,10 @@
+package com.provectus.kafka.ui.pages.ksqldb.models;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+@Data
+@Accessors(chain = true)
+public class Stream {
+  private String name, topicName, valueFormat, partitions;
+}
diff --git a/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/ksqldb/models/Table.java b/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/ksqldb/models/Table.java
new file mode 100644
index 00000000000..cbb0c1d2a72
--- /dev/null
+++ b/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/ksqldb/models/Table.java
@@ -0,0 +1,10 @@
+package com.provectus.kafka.ui.pages.ksqldb.models;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+@Data
+@Accessors(chain = true)
+public class Table {
+  private String name, streamName;
+}
diff --git a/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/services/ApiService.java b/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/services/ApiService.java
index 8451ef836e1..c41796cb85c 100644
--- a/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/services/ApiService.java
+++ b/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/services/ApiService.java
@@ -6,20 +6,28 @@
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.provectus.kafka.ui.api.ApiClient;
 import com.provectus.kafka.ui.api.api.KafkaConnectApi;
+import com.provectus.kafka.ui.api.api.KsqlApi;
 import com.provectus.kafka.ui.api.api.MessagesApi;
 import com.provectus.kafka.ui.api.api.SchemasApi;
 import com.provectus.kafka.ui.api.api.TopicsApi;
 import com.provectus.kafka.ui.api.model.CreateTopicMessage;
+import com.provectus.kafka.ui.api.model.KsqlCommandV2;
+import com.provectus.kafka.ui.api.model.KsqlCommandV2Response;
+import com.provectus.kafka.ui.api.model.KsqlResponse;
 import com.provectus.kafka.ui.api.model.NewConnector;
 import com.provectus.kafka.ui.api.model.NewSchemaSubject;
 import com.provectus.kafka.ui.api.model.TopicCreation;
 import com.provectus.kafka.ui.models.Connector;
 import com.provectus.kafka.ui.models.Schema;
 import com.provectus.kafka.ui.models.Topic;
+import com.provectus.kafka.ui.pages.ksqldb.models.Stream;
+import com.provectus.kafka.ui.pages.ksqldb.models.Table;
 import com.provectus.kafka.ui.settings.BaseSource;
 import io.qameta.allure.Step;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import lombok.SneakyThrows;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.reactive.function.client.WebClientResponseException;
@@ -48,6 +56,9 @@ private MessagesApi messageApi() {
       return new MessagesApi(new ApiClient().setBasePath(BASE_LOCAL_URL));
     }
 
+    @SneakyThrows
+    private KsqlApi ksqlApi(){return new KsqlApi(new ApiClient().setBasePath(BASE_LOCAL_URL));}
+
     @SneakyThrows
     private void createTopic(String clusterName, String topicName) {
       TopicCreation topic = new TopicCreation();
@@ -173,4 +184,76 @@ public ApiService sendMessage(Topic topic) {
       sendMessage(CLUSTER_NAME, topic);
       return this;
     }
+
+    @Step
+    public ApiService createStream(Stream stream) {
+      KsqlCommandV2Response pipeIdStream = ksqlApi().executeKsql(
+          CLUSTER_NAME, new KsqlCommandV2()
+              .ksql(String.format("CREATE STREAM %s (profileId VARCHAR, latitude DOUBLE, longitude DOUBLE) ",
+                  stream.getName())
+                  + String.format("WITH (kafka_topic='%s', value_format='json', partitions=1);",
+                  stream.getTopicName())))
+          .block();
+      assert pipeIdStream != null;
+      List<KsqlResponse> responseListStream =
+          ksqlApi().openKsqlResponsePipe(CLUSTER_NAME, pipeIdStream.getPipeId()).collectList().block();
+      assert Objects.requireNonNull(responseListStream).size() != 0;
+      return this;
+    }
+
+    @Step
+    public ApiService createTables(Table firstTable, Table secondTable) {
+      KsqlCommandV2Response pipeIdTable1 = ksqlApi().executeKsql(
+          CLUSTER_NAME, new KsqlCommandV2().ksql(
+              String.format("CREATE TABLE %s AS ", firstTable.getName())
+                  + "  SELECT profileId, "
+                  + "         LATEST_BY_OFFSET(latitude) AS la, "
+                  + "         LATEST_BY_OFFSET(longitude) AS lo "
+                  + String.format("  FROM %s ", firstTable.getStreamName())
+                  + "  GROUP BY profileId "
+                  + "  EMIT CHANGES;"))
+          .block();
+      assert pipeIdTable1 != null;
+      List<KsqlResponse> responseListTable =
+          ksqlApi().openKsqlResponsePipe(CLUSTER_NAME, pipeIdTable1.getPipeId()).collectList().block();
+      assert Objects.requireNonNull(responseListTable).size() != 0;
+      KsqlCommandV2Response pipeIdTable2 = ksqlApi().executeKsql(
+          CLUSTER_NAME,
+          new KsqlCommandV2().ksql(String.format("CREATE TABLE %s AS ", secondTable.getName())
+              + "  SELECT ROUND(GEO_DISTANCE(la, lo, 37.4133, -122.1162), -1) AS distanceInMiles, "
+              + "         COLLECT_LIST(profileId) AS riders, "
+              + "         COUNT(*) AS count "
+              + String.format("  FROM %s ", firstTable.getName())
+              + "  GROUP BY ROUND(GEO_DISTANCE(la, lo, 37.4133, -122.1162), -1);"))
+          .block();
+      assert pipeIdTable2 != null;
+      List<KsqlResponse> responseListTable2 =
+          ksqlApi().openKsqlResponsePipe(CLUSTER_NAME, pipeIdTable2.getPipeId()).collectList().block();
+      assert Objects.requireNonNull(responseListTable2).size() != 0;
+      return this;
+    }
+
+    @Step
+    public ApiService insertInto(Stream stream) {
+      String streamName = stream.getName();
+      KsqlCommandV2Response pipeIdInsert = ksqlApi().executeKsql(CLUSTER_NAME, new KsqlCommandV2()
+              .ksql(
+                  "INSERT INTO " + streamName + " (profileId, latitude, longitude) VALUES ('c2309eec', 37.7877, -122.4205);"
+                      + "INSERT INTO " + streamName +
+                      " (profileId, latitude, longitude) VALUES ('18f4ea86', 37.3903, -122.0643); "
+                      + "INSERT INTO " + streamName +
+                      " (profileId, latitude, longitude) VALUES ('4ab5cbad', 37.3952, -122.0813); "
+                      + "INSERT INTO " + streamName +
+                      " (profileId, latitude, longitude) VALUES ('8b6eae59', 37.3944, -122.0813); "
+                      + "INSERT INTO " + streamName +
+                      " (profileId, latitude, longitude) VALUES ('4a7c7b41', 37.4049, -122.0822); "
+                      + "INSERT INTO " + streamName +
+                      " (profileId, latitude, longitude) VALUES ('4ddad000', 37.7857, -122.4011);"))
+          .block();
+      assert pipeIdInsert != null;
+      List<KsqlResponse> responseListInsert =
+          ksqlApi().openKsqlResponsePipe(CLUSTER_NAME, pipeIdInsert.getPipeId()).collectList().block();
+      assert Objects.requireNonNull(responseListInsert).size() != 0;
+      return this;
+    }
 }


Test patch:
diff --git a/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/base/Facade.java b/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/base/Facade.java
index 1dad47a7007..ac4180fe611 100644
--- a/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/base/Facade.java
+++ b/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/base/Facade.java
@@ -1,6 +1,5 @@
 package com.provectus.kafka.ui.base;
 
-import com.provectus.kafka.ui.services.ApiService;
 import com.provectus.kafka.ui.pages.NaviSideBar;
 import com.provectus.kafka.ui.pages.TopPanel;
 import com.provectus.kafka.ui.pages.brokers.BrokersConfigTab;
@@ -11,14 +10,17 @@
 import com.provectus.kafka.ui.pages.connector.KafkaConnectList;
 import com.provectus.kafka.ui.pages.consumer.ConsumersDetails;
 import com.provectus.kafka.ui.pages.consumer.ConsumersList;
+import com.provectus.kafka.ui.pages.ksqldb.KsqlDbList;
+import com.provectus.kafka.ui.pages.ksqldb.KsqlQueryForm;
 import com.provectus.kafka.ui.pages.schema.SchemaCreateForm;
 import com.provectus.kafka.ui.pages.schema.SchemaDetails;
 import com.provectus.kafka.ui.pages.schema.SchemaRegistryList;
 import com.provectus.kafka.ui.pages.topic.ProduceMessagePanel;
-import com.provectus.kafka.ui.pages.topic.TopicSettingsTab;
 import com.provectus.kafka.ui.pages.topic.TopicCreateEditForm;
 import com.provectus.kafka.ui.pages.topic.TopicDetails;
+import com.provectus.kafka.ui.pages.topic.TopicSettingsTab;
 import com.provectus.kafka.ui.pages.topic.TopicsList;
+import com.provectus.kafka.ui.services.ApiService;
 
 public abstract class Facade {
     protected ApiService apiService = new ApiService();
@@ -40,4 +42,7 @@ public abstract class Facade {
     protected BrokersDetails brokersDetails = new BrokersDetails();
     protected BrokersConfigTab brokersConfigTab = new BrokersConfigTab();
     protected TopicSettingsTab topicSettingsTab = new TopicSettingsTab();
+    protected KsqlQueryForm ksqlQueryForm = new KsqlQueryForm();
+    protected KsqlDbList ksqlDbList = new KsqlDbList();
+
 }
diff --git a/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/suite/ksqldb/KsqlTests.java b/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/suite/ksqldb/KsqlTests.java
new file mode 100644
index 00000000000..ee03fd8de1a
--- /dev/null
+++ b/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/suite/ksqldb/KsqlTests.java
@@ -0,0 +1,65 @@
+package com.provectus.kafka.ui.suite.ksqldb;
+
+import static com.provectus.kafka.ui.pages.NaviSideBar.SideMenuOption.KSQL_DB;
+import static com.provectus.kafka.ui.pages.ksqldb.enums.KsqlQueryConfig.SHOW_TABLES;
+import static org.apache.commons.lang.RandomStringUtils.randomAlphabetic;
+
+import com.provectus.kafka.ui.base.BaseTest;
+import com.provectus.kafka.ui.pages.ksqldb.models.Stream;
+import com.provectus.kafka.ui.pages.ksqldb.models.Table;
+import com.provectus.kafka.ui.utilities.qaseIoUtils.annotations.AutomationStatus;
+import com.provectus.kafka.ui.utilities.qaseIoUtils.annotations.Suite;
+import com.provectus.kafka.ui.utilities.qaseIoUtils.enums.Status;
+import io.qase.api.annotation.CaseId;
+import org.assertj.core.api.SoftAssertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
+public class KsqlTests extends BaseTest {
+  private static final long SUITE_ID = 8;
+  private static final String SUITE_TITLE = "KSQL_DB";
+  private static final Stream STREAM_FOR_CHECKING_TABLES = new Stream()
+      .setName("STREAM_FOR_CHECKING_TABLES_" + randomAlphabetic(4).toUpperCase())
+      .setTopicName("TOPIC_FOR_STREAM_" + randomAlphabetic(4).toUpperCase());
+  private static final Table FIRST_TABLE = new Table()
+      .setName("FIRST_TABLE"+ randomAlphabetic(4).toUpperCase())
+      .setStreamName(STREAM_FOR_CHECKING_TABLES.getName());
+  private static final Table SECOND_TABLE = new Table()
+      .setName("SECOND_TABLE"+ randomAlphabetic(4).toUpperCase())
+      .setStreamName(STREAM_FOR_CHECKING_TABLES.getName());
+
+  @BeforeAll
+  public void beforeAll(){
+    apiService
+        .createStream(STREAM_FOR_CHECKING_TABLES)
+        .createTables(FIRST_TABLE, SECOND_TABLE);
+  }
+
+  @DisplayName("check KSQL request execution")
+  @Suite(suiteId = SUITE_ID,title = SUITE_TITLE)
+  @AutomationStatus(status = Status.AUTOMATED)
+  @CaseId(41)
+  @Test
+  @Order(1)
+  public void checkingKsqlRequestExecution() {
+    naviSideBar
+        .openSideMenu(KSQL_DB);
+    ksqlDbList
+        .waitUntilScreenReady()
+        .clickExecuteKsqlRequestBtn();
+    ksqlQueryForm
+        .waitUntilScreenReady()
+        .setQuery(SHOW_TABLES.getQuery())
+        .clickExecuteBtn();
+    SoftAssertions softly = new SoftAssertions();
+    softly.assertThat(ksqlQueryForm.getTableByName(FIRST_TABLE.getName()).isVisible())
+        .as("getTableName()").isTrue();
+    softly.assertThat(ksqlQueryForm.getTableByName(SECOND_TABLE.getName()).isVisible())
+        .as("getTableName()").isTrue();
+    softly.assertAll();
+  }
+}
diff --git a/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/suite/topics/TopicsTests.java b/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/suite/topics/TopicsTests.java
index 7f301835c8a..fa51ebe1fc4 100644
--- a/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/suite/topics/TopicsTests.java
+++ b/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/suite/topics/TopicsTests.java
@@ -63,12 +63,14 @@ public class TopicsTests extends BaseTest {
       .setNumberOfPartitions(1)
       .setMaxMessageBytes("1000012")
       .setMaxSizeOnDisk(NOT_SET);
+  private static final Topic TOPIC_FOR_CHECK_FILTERS = new Topic()
+      .setName("topic-for-check-filters-" + randomAlphabetic(5));
   private static final Topic TOPIC_FOR_DELETE = new Topic().setName("topic-to-delete-" + randomAlphabetic(5));
   private static final List<Topic> TOPIC_LIST = new ArrayList<>();
 
   @BeforeAll
   public void beforeAll() {
-    TOPIC_LIST.addAll(List.of(TOPIC_TO_UPDATE_AND_DELETE, TOPIC_FOR_DELETE));
+    TOPIC_LIST.addAll(List.of(TOPIC_TO_UPDATE_AND_DELETE, TOPIC_FOR_DELETE, TOPIC_FOR_CHECK_FILTERS));
     TOPIC_LIST.forEach(topic -> apiService.createTopic(topic.getName()));
   }
 
@@ -337,7 +339,7 @@ void checkTopicListElements() {
   @Order(11)
   void addingNewFilterWithinTopic() {
     String filterName = randomAlphabetic(5);
-    navigateToTopicsAndOpenDetails("_schemas");
+    navigateToTopicsAndOpenDetails(TOPIC_FOR_CHECK_FILTERS.getName());
     topicDetails
         .openDetailsTab(MESSAGES)
         .clickMessagesAddFiltersBtn()
@@ -364,7 +366,7 @@ void addingNewFilterWithinTopic() {
   @Order(12)
   void checkFilterSavingWithinSavedFilters() {
     String displayName = randomAlphabetic(5);
-    navigateToTopicsAndOpenDetails("my_ksql_1ksql_processing_log");
+    navigateToTopicsAndOpenDetails(TOPIC_FOR_CHECK_FILTERS.getName());
     topicDetails
         .openDetailsTab(MESSAGES)
         .clickMessagesAddFiltersBtn()
@@ -389,7 +391,7 @@ void checkFilterSavingWithinSavedFilters() {
   @Order(13)
   void checkingApplyingSavedFilterWithinTopicMessages() {
     String displayName = randomAlphabetic(5);
-    navigateToTopicsAndOpenDetails("my_ksql_1ksql_processing_log");
+    navigateToTopicsAndOpenDetails(TOPIC_FOR_CHECK_FILTERS.getName());
     topicDetails
         .openDetailsTab(MESSAGES)
         .clickMessagesAddFiltersBtn()