Repository: provectus/kafka-ui
Issue: [e2e]Checking messages filtering by Timestamp within Messages/Topic
Labels: scope/QA
scope/AQA

Autotest implementation for:

https://app.qase.io/case/KAFKAUI-16

Description:
Checking messages filtering by Timestamp within Messages/Topic

Pre-conditions:
- Login to Kafka-ui application
- Open the 'Local' section
- Select the 'Topics'
- Open the Topic profile
- Turn to Messages tab

Steps:
1. Change the Offset dropdown value to 'Timestamp'
2. Click on 'Select Timestamp'
3. Choose the date and time within opened calendar
**Expected result:**
All the messages created from the selected time should filtered

Issue comments:

Pull request review comments:
please make all created methods return the object of ApiService and all old methods need to set private
don't we able to use createConnector() at line 60 and deleteConnector() at line 123 without clusterName?
seems here we also can set a date when seek type is Timestamp. so suggest tot lease String argument
Condition.visible -> Condition.enabled for seekTypeFLd
seems this method is not used in tests, it should be private and w/o Step annotation
Condition.visible -> Condition.enabled
Condition.visible -> Condition.enabled
done
sure ,done it 
done
done

done
done
done

Patch that resolved the issue:
diff --git a/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/BasePage.java b/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/BasePage.java
index 67bf5a7c590..8b12d3b0d3f 100644
--- a/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/BasePage.java
+++ b/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/BasePage.java
@@ -7,12 +7,13 @@
 import com.codeborne.selenide.ElementsCollection;
 import com.codeborne.selenide.SelenideElement;
 import com.provectus.kafka.ui.utilities.WebUtils;
+import java.time.Duration;
 import lombok.extern.slf4j.Slf4j;
 
 @Slf4j
 public abstract class BasePage extends WebUtils {
 
-  protected SelenideElement loadingSpinner = $x("//*[contains(text(),'Loading')]");
+  protected SelenideElement loadingSpinner = $x("//div[@role='progressbar']");
   protected SelenideElement submitBtn = $x("//button[@type='submit']");
   protected SelenideElement tableGrid = $x("//table");
   protected SelenideElement dotMenuBtn = $x("//button[@aria-label='Dropdown Toggle']");
@@ -26,7 +27,9 @@ public abstract class BasePage extends WebUtils {
 
   protected void waitUntilSpinnerDisappear() {
     log.debug("\nwaitUntilSpinnerDisappear");
-    loadingSpinner.shouldBe(Condition.disappear);
+    if(isVisible(loadingSpinner)){
+      loadingSpinner.shouldBe(Condition.disappear, Duration.ofSeconds(30));
+    }
   }
 
   protected void clickSubmitBtn() {
diff --git a/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/topic/TopicDetails.java b/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/topic/TopicDetails.java
index bd8cbd3d02c..1de0478abec 100644
--- a/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/topic/TopicDetails.java
+++ b/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/topic/TopicDetails.java
@@ -3,6 +3,7 @@
 import static com.codeborne.selenide.Selenide.$;
 import static com.codeborne.selenide.Selenide.$$x;
 import static com.codeborne.selenide.Selenide.$x;
+import static com.codeborne.selenide.Selenide.sleep;
 import static org.apache.commons.lang.math.RandomUtils.nextInt;
 
 import com.codeborne.selenide.CollectionCondition;
@@ -11,9 +12,17 @@
 import com.codeborne.selenide.SelenideElement;
 import com.provectus.kafka.ui.pages.BasePage;
 import io.qameta.allure.Step;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.time.YearMonth;
+import java.time.format.DateTimeFormatter;
+import java.time.format.DateTimeFormatterBuilder;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
+import java.util.Locale;
+import java.util.Objects;
 import org.openqa.selenium.By;
 
 public class TopicDetails extends BasePage {
@@ -24,7 +33,7 @@ public class TopicDetails extends BasePage {
   protected SelenideElement overviewTab = $x("//a[contains(text(),'Overview')]");
   protected SelenideElement messagesTab = $x("//a[contains(text(),'Messages')]");
   protected SelenideElement seekTypeDdl = $x("//ul[@id='selectSeekType']/li");
-  protected SelenideElement seekTypeField = $x("//label[text()='Seek Type']//..//input");
+  protected SelenideElement seekTypeField = $x("//label[text()='Seek Type']//..//div/input");
   protected SelenideElement addFiltersBtn = $x("//button[text()='Add Filters']");
   protected SelenideElement savedFiltersLink = $x("//div[text()='Saved Filters']");
   protected SelenideElement addFilterCodeModalTitle = $x("//label[text()='Filter code']");
@@ -33,6 +42,7 @@ public class TopicDetails extends BasePage {
   protected SelenideElement displayNameInputAddFilterMdl = $x("//input[@placeholder='Enter Name']");
   protected SelenideElement cancelBtnAddFilterMdl = $x("//button[text()='Cancel']");
   protected SelenideElement addFilterBtnAddFilterMdl = $x("//button[text()='Add filter']");
+  protected SelenideElement addFiltersBtnMessages = $x("//button[text()='Add Filters']");
   protected SelenideElement selectFilterBtnAddFilterMdl = $x("//button[text()='Select filter']");
   protected SelenideElement editSettingsMenu = $x("//li[@role][contains(text(),'Edit settings')]");
   protected SelenideElement removeTopicBtn = $x("//ul[@role='menu']//div[contains(text(),'Remove Topic')]");
@@ -43,6 +53,11 @@ public class TopicDetails extends BasePage {
   protected SelenideElement backToCreateFiltersLink = $x("//div[text()='Back To create filters']");
   protected SelenideElement confirmationMdl = $x("//div[text()= 'Confirm the action']/..");
   protected ElementsCollection messageGridItems = $$x("//tbody//tr");
+  protected SelenideElement actualCalendarDate = $x("//div[@class='react-datepicker__current-month']");
+  protected SelenideElement previousMonthButton = $x("//button[@aria-label='Previous Month']");
+  protected SelenideElement nextMonthButton = $x("//button[@aria-label='Next Month']");
+  protected SelenideElement calendarTimeFld = $x("//input[@placeholder='Time']");
+  protected String dayCellLtr = "//div[@role='option'][contains(text(),'%d')]";
   protected String seekFilterDdlLocator = "//ul[@id='selectSeekType']/ul/li[text()='%s']";
   protected String savedFilterNameLocator = "//div[@role='savedFilter']/div[contains(text(),'%s')]";
   protected String consumerIdLocator = "//a[@title='%s']";
@@ -53,7 +68,7 @@ public class TopicDetails extends BasePage {
   @Step
   public TopicDetails waitUntilScreenReady() {
     waitUntilSpinnerDisappear();
-    dotMenuBtn.shouldBe(Condition.visible);
+    overviewTab.shouldBe(Condition.visible);
     return this;
   }
 
@@ -265,6 +280,63 @@ public boolean isContentMessageVisible(String contentMessage) {
     return contentMessage.matches(contentMessageTab.getText().trim());
   }
 
+  private void selectYear(int expectedYear) {
+    while (getActualCalendarDate().getYear() > expectedYear) {
+      clickByJavaScript(previousMonthButton);
+      sleep(1000);
+      if (LocalTime.now().plusMinutes(3).isBefore(LocalTime.now())) {
+        throw new IllegalArgumentException("Unable to select year");
+      }
+    }
+  }
+
+  private void selectMonth(int expectedMonth) {
+    while (getActualCalendarDate().getMonthValue() > expectedMonth) {
+      clickByJavaScript(previousMonthButton);
+      sleep(1000);
+      if (LocalTime.now().plusMinutes(3).isBefore(LocalTime.now())) {
+        throw new IllegalArgumentException("Unable to select month");
+      }
+    }
+  }
+
+  private void selectDay(int expectedDay) {
+    Objects.requireNonNull($$x(String.format(dayCellLtr, expectedDay)).stream()
+        .filter(day -> !Objects.requireNonNull(day.getAttribute("class")).contains("outside-month"))
+        .findFirst().orElse(null)).shouldBe(Condition.enabled).click();
+  }
+
+  private void setTime(LocalDateTime dateTime) {
+    calendarTimeFld.shouldBe(Condition.enabled)
+        .sendKeys(String.valueOf(dateTime.getHour()), String.valueOf(dateTime.getMinute()));
+  }
+
+  @Step
+  public TopicDetails selectDateAndTimeByCalendar(LocalDateTime dateTime) {
+    setTime(dateTime);
+    selectYear(dateTime.getYear());
+    selectMonth(dateTime.getMonthValue());
+    selectDay(dateTime.getDayOfMonth());
+    return this;
+  }
+
+  private LocalDate getActualCalendarDate() {
+    String monthAndYearStr = actualCalendarDate.getText().trim();
+    DateTimeFormatter formatter = new DateTimeFormatterBuilder()
+        .parseCaseInsensitive()
+        .append(DateTimeFormatter.ofPattern("MMMM yyyy"))
+        .toFormatter(Locale.ENGLISH);
+    YearMonth yearMonth = formatter.parse(monthAndYearStr, YearMonth::from);
+    return yearMonth.atDay(1);
+  }
+
+  @Step
+  public TopicDetails openCalendarSeekType(){
+    seekTypeField.shouldBe(Condition.enabled).click();
+    actualCalendarDate.shouldBe(Condition.visible);
+    return this;
+  }
+
   @Step
   public int getMessageCountAmount() {
     return Integer.parseInt(messageAmountCell.getText().trim());
@@ -278,7 +350,7 @@ private List<TopicDetails.MessageGridItem> initItems() {
   }
 
   @Step
-  public TopicDetails.MessageGridItem getMessage(int offset) {
+  public TopicDetails.MessageGridItem getMessageByOffset(int offset) {
     return initItems().stream()
         .filter(e -> e.getOffset() == offset)
         .findFirst().orElse(null);
@@ -291,7 +363,7 @@ public List<MessageGridItem> getAllMessages(){
 
   @Step
   public TopicDetails.MessageGridItem getRandomMessage() {
-    return getMessage(nextInt(initItems().size() - 1));
+    return getMessageByOffset(nextInt(initItems().size() - 1));
   }
 
   public enum TopicMenu {
@@ -340,8 +412,10 @@ public int getPartition() {
     }
 
     @Step
-    public String getTimestamp() {
-      return element.$x("./td[4]/div").getText().trim();
+    public LocalDateTime getTimestamp() {
+      String timestampValue = element.$x("./td[4]/div").getText().trim();
+      DateTimeFormatter formatter = DateTimeFormatter.ofPattern("M/d/yyyy, HH:mm:ss");
+      return LocalDateTime.parse(timestampValue, formatter);
     }
 
     @Step
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 ad1fad76b2e..8451ef836e1 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
@@ -1,7 +1,6 @@
 package com.provectus.kafka.ui.services;
 
 import static com.codeborne.selenide.Selenide.sleep;
-import static com.provectus.kafka.ui.settings.BaseSource.BASE_LOCAL_URL;
 import static com.provectus.kafka.ui.utilities.FileUtils.fileToString;
 
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -17,6 +16,8 @@
 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.settings.BaseSource;
+import io.qameta.allure.Step;
 import java.util.HashMap;
 import java.util.Map;
 import lombok.SneakyThrows;
@@ -25,7 +26,7 @@
 
 
 @Slf4j
-public class ApiService {
+public class ApiService extends BaseSource {
 
     @SneakyThrows
     private TopicsApi topicApi() {
@@ -48,7 +49,7 @@ private MessagesApi messageApi() {
     }
 
     @SneakyThrows
-    public void createTopic(String clusterName, String topicName) {
+    private void createTopic(String clusterName, String topicName) {
       TopicCreation topic = new TopicCreation();
       topic.setName(topicName);
       topic.setPartitions(1);
@@ -61,15 +62,28 @@ public void createTopic(String clusterName, String topicName) {
       }
     }
 
-    public void deleteTopic(String clusterName, String topicName) {
+    @Step
+    public ApiService createTopic(String topicName) {
+      createTopic(CLUSTER_NAME, topicName);
+      return this;
+    }
+
+    @SneakyThrows
+    private void deleteTopic(String clusterName, String topicName) {
         try {
             topicApi().deleteTopic(clusterName, topicName).block();
         } catch (WebClientResponseException ignore) {
         }
     }
 
+    @Step
+    public ApiService deleteTopic(String topicName){
+      deleteTopic(CLUSTER_NAME, topicName);
+      return this;
+    }
+
     @SneakyThrows
-    public void createSchema(String clusterName, Schema schema) {
+    private void createSchema(String clusterName, Schema schema) {
         NewSchemaSubject schemaSubject = new NewSchemaSubject();
         schemaSubject.setSubject(schema.getName());
         schemaSubject.setSchema(fileToString(schema.getValuePath()));
@@ -81,24 +95,42 @@ public void createSchema(String clusterName, Schema schema) {
         }
     }
 
+    @Step
+    public ApiService createSchema(Schema schema){
+      createSchema(CLUSTER_NAME, schema);
+      return this;
+    }
+
     @SneakyThrows
-    public void deleteSchema(String clusterName, String schemaName) {
+    private void deleteSchema(String clusterName, String schemaName) {
         try {
             schemaApi().deleteSchema(clusterName, schemaName).block();
         } catch (WebClientResponseException ignore) {
         }
     }
 
+    @Step
+    public ApiService deleteSchema(String schemaName){
+      deleteSchema(CLUSTER_NAME, schemaName);
+      return this;
+    }
+
     @SneakyThrows
-    public void deleteConnector(String clusterName, String connectName, String connectorName) {
+    private void deleteConnector(String clusterName, String connectName, String connectorName) {
         try {
             connectorApi().deleteConnector(clusterName, connectName, connectorName).block();
         } catch (WebClientResponseException ignore) {
         }
     }
 
+    @Step
+    public ApiService deleteConnector(String connectName, String connectorName){
+      deleteConnector(CLUSTER_NAME, connectName, connectorName);
+      return this;
+    }
+
     @SneakyThrows
-    public void createConnector(String clusterName, String connectName, Connector connector) {
+    private void createConnector(String clusterName, String connectName, Connector connector) {
         NewConnector connectorProperties = new NewConnector();
         connectorProperties.setName(connector.getName());
         Map<String, Object> configMap = new ObjectMapper().readValue(connector.getConfig(), HashMap.class);
@@ -110,20 +142,35 @@ public void createConnector(String clusterName, String connectName, Connector co
         connectorApi().createConnector(clusterName, connectName, connectorProperties).block();
     }
 
+    @Step
+    public ApiService createConnector(String connectName, Connector connector){
+      createConnector(CLUSTER_NAME, connectName, connector);
+      return this;
+    }
+
+    @Step
     public String getFirstConnectName(String clusterName) {
         return connectorApi().getConnects(clusterName).blockFirst().getName();
     }
 
     @SneakyThrows
-    public void sendMessage(String clusterName, Topic topic) {
-        CreateTopicMessage createMessage = new CreateTopicMessage();
-        createMessage.partition(0);
-        createMessage.setContent(topic.getMessageContent());
-        createMessage.setKey(topic.getMessageKey());
-        try {
-            messageApi().sendTopicMessages(clusterName, topic.getName(), createMessage).block();
-        } catch (WebClientResponseException ex) {
-            ex.getRawStatusCode();
-        }
+    private void sendMessage(String clusterName, Topic topic) {
+      CreateTopicMessage createMessage = new CreateTopicMessage();
+      createMessage.setPartition(0);
+      createMessage.setKeySerde("String");
+      createMessage.setValueSerde("String");
+      createMessage.setKey(topic.getMessageKey());
+      createMessage.setContent(topic.getMessageContent());
+      try {
+        messageApi().sendTopicMessages(clusterName, topic.getName(), createMessage).block();
+      } catch (WebClientResponseException ex) {
+        ex.getRawStatusCode();
+      }
+    }
+
+    @Step
+    public ApiService sendMessage(Topic topic) {
+      sendMessage(CLUSTER_NAME, topic);
+      return this;
     }
 }
diff --git a/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/utilities/TimeUtils.java b/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/utilities/TimeUtils.java
new file mode 100644
index 00000000000..259f70c3ccc
--- /dev/null
+++ b/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/utilities/TimeUtils.java
@@ -0,0 +1,16 @@
+package com.provectus.kafka.ui.utilities;
+
+import static com.codeborne.selenide.Selenide.sleep;
+
+import java.time.LocalTime;
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+public class TimeUtils {
+
+  public static void waitUntilNewMinuteStarted(){
+    int secondsLeft = 60 - LocalTime.now().getSecond();
+    log.debug("\nwaitUntilNewMinuteStarted: {}s", secondsLeft);
+    sleep(secondsLeft * 1000);
+  }
+}
diff --git a/kafka-ui-e2e-checks/src/test/resources/producedkey.txt b/kafka-ui-e2e-checks/src/test/resources/producedkey.txt
deleted file mode 100644
index f1ccb75d55d..00000000000
--- a/kafka-ui-e2e-checks/src/test/resources/producedkey.txt
+++ /dev/null
@@ -1,1 +0,0 @@
-"key"
\ No newline at end of file
diff --git a/kafka-ui-e2e-checks/src/test/resources/testData.txt b/kafka-ui-e2e-checks/src/test/resources/testData.txt
deleted file mode 100644
index 9b9d3b66546..00000000000
--- a/kafka-ui-e2e-checks/src/test/resources/testData.txt
+++ /dev/null
@@ -1,1 +0,0 @@
-"print"


Test patch:
diff --git a/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/base/BaseTest.java b/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/base/BaseTest.java
index 5ad98fe8542..6db92244ba4 100644
--- a/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/base/BaseTest.java
+++ b/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/base/BaseTest.java
@@ -62,6 +62,7 @@ public static void start() {
                 .addArguments("--disable-gpu")
                 .addArguments("--no-sandbox")
                 .addArguments("--verbose")
+                .addArguments("--lang=es")
             )
             .withLogConsumer(new Slf4jLogConsumer(log).withPrefix("[CHROME]: "));
         try {
diff --git a/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/suite/connectors/ConnectorsTests.java b/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/suite/connectors/ConnectorsTests.java
index 665b8fb2ff0..ec2e3d5a0f1 100644
--- a/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/suite/connectors/ConnectorsTests.java
+++ b/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/suite/connectors/ConnectorsTests.java
@@ -2,7 +2,6 @@
 
 import static com.provectus.kafka.ui.pages.BasePage.AlertHeader.SUCCESS;
 import static com.provectus.kafka.ui.pages.NaviSideBar.SideMenuOption.KAFKA_CONNECT;
-import static com.provectus.kafka.ui.settings.BaseSource.CLUSTER_NAME;
 import static com.provectus.kafka.ui.utilities.FileUtils.getResourceAsString;
 import static org.apache.commons.lang.RandomStringUtils.randomAlphabetic;
 
@@ -50,14 +49,14 @@ public class ConnectorsTests extends BaseTest {
 
     @BeforeAll
     public void beforeAll() {
-        TOPIC_LIST.addAll(List.of(TOPIC_FOR_CREATE, TOPIC_FOR_DELETE, TOPIC_FOR_UPDATE));
-        TOPIC_LIST.forEach(topic -> {
-            apiService.createTopic(CLUSTER_NAME, topic.getName());
-            apiService.sendMessage(CLUSTER_NAME, topic);
-        });
-        CONNECTOR_LIST.addAll(List.of(CONNECTOR_FOR_DELETE, CONNECTOR_FOR_UPDATE));
-        CONNECTOR_LIST.forEach(connector -> apiService
-                .createConnector(CLUSTER_NAME, CONNECT_NAME, connector));
+      TOPIC_LIST.addAll(List.of(TOPIC_FOR_CREATE, TOPIC_FOR_DELETE, TOPIC_FOR_UPDATE));
+      TOPIC_LIST.forEach(topic -> apiService
+          .createTopic(topic.getName())
+          .sendMessage(topic)
+      );
+      CONNECTOR_LIST.addAll(List.of(CONNECTOR_FOR_DELETE, CONNECTOR_FOR_UPDATE));
+      CONNECTOR_LIST.forEach(connector -> apiService
+          .createConnector(CONNECT_NAME, connector));
     }
 
     @DisplayName("should create a connector")
@@ -120,8 +119,8 @@ public void deleteConnector() {
     @AfterAll
     public void afterAll() {
         CONNECTOR_LIST.forEach(connector ->
-                apiService.deleteConnector(CLUSTER_NAME, CONNECT_NAME, connector.getName()));
-        TOPIC_LIST.forEach(topic -> apiService.deleteTopic(CLUSTER_NAME, topic.getName()));
+                apiService.deleteConnector(CONNECT_NAME, connector.getName()));
+        TOPIC_LIST.forEach(topic -> apiService.deleteTopic(topic.getName()));
     }
 
     @Step
diff --git a/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/suite/schemas/SchemasTests.java b/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/suite/schemas/SchemasTests.java
index 1af657ca976..ea98b4abe1a 100644
--- a/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/suite/schemas/SchemasTests.java
+++ b/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/suite/schemas/SchemasTests.java
@@ -1,7 +1,6 @@
 package com.provectus.kafka.ui.suite.schemas;
 
 import static com.provectus.kafka.ui.pages.NaviSideBar.SideMenuOption.SCHEMA_REGISTRY;
-import static com.provectus.kafka.ui.settings.BaseSource.CLUSTER_NAME;
 import static com.provectus.kafka.ui.utilities.FileUtils.fileToString;
 
 import com.codeborne.selenide.Condition;
@@ -41,7 +40,7 @@ public class SchemasTests extends BaseTest {
     @SneakyThrows
     public void beforeAll() {
         SCHEMA_LIST.addAll(List.of(AVRO_API, JSON_API, PROTOBUF_API));
-        SCHEMA_LIST.forEach(schema -> apiService.createSchema(CLUSTER_NAME, schema));
+        SCHEMA_LIST.forEach(schema -> apiService.createSchema(schema));
     }
 
     @DisplayName("should create AVRO schema")
@@ -228,7 +227,7 @@ void deleteSchemaProtobuf() {
 
     @AfterAll
     public void afterAll() {
-        SCHEMA_LIST.forEach(schema -> apiService.deleteSchema(CLUSTER_NAME, schema.getName()));
+        SCHEMA_LIST.forEach(schema -> apiService.deleteSchema(schema.getName()));
     }
 
     @Step
diff --git a/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/suite/topics/TopicMessagesTests.java b/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/suite/topics/TopicMessagesTests.java
index 68dd2f72201..db2d67106b6 100644
--- a/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/suite/topics/TopicMessagesTests.java
+++ b/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/suite/topics/TopicMessagesTests.java
@@ -2,8 +2,8 @@
 
 import static com.provectus.kafka.ui.pages.BasePage.AlertHeader.SUCCESS;
 import static com.provectus.kafka.ui.pages.topic.TopicDetails.TopicMenu.MESSAGES;
-import static com.provectus.kafka.ui.settings.BaseSource.CLUSTER_NAME;
-import static com.provectus.kafka.ui.utilities.FileUtils.fileToString;
+import static com.provectus.kafka.ui.pages.topic.TopicDetails.TopicMenu.OVERVIEW;
+import static com.provectus.kafka.ui.utilities.TimeUtils.waitUntilNewMinuteStarted;
 import static org.apache.commons.lang.RandomStringUtils.randomAlphabetic;
 import static org.assertj.core.api.Assertions.assertThat;
 
@@ -15,8 +15,12 @@
 import com.provectus.kafka.ui.utilities.qaseIoUtils.enums.Status;
 import io.qameta.allure.Issue;
 import io.qase.api.annotation.CaseId;
+import java.time.LocalDateTime;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
 import org.assertj.core.api.SoftAssertions;
 import org.junit.jupiter.api.AfterAll;
 import org.junit.jupiter.api.Assertions;
@@ -32,22 +36,29 @@ public class TopicMessagesTests extends BaseTest {
   private static final String SUITE_TITLE = "Topics";
   private static final Topic TOPIC_FOR_MESSAGES = new Topic()
       .setName("topic-with-clean-message-attribute-" + randomAlphabetic(5))
-      .setMessageKey(fileToString(System.getProperty("user.dir") + "/src/test/resources/producedkey.txt"))
-      .setMessageContent(fileToString(System.getProperty("user.dir") + "/src/test/resources/testData.txt"));
+      .setMessageKey(randomAlphabetic(5))
+      .setMessageContent(randomAlphabetic(10));
   private static final Topic TOPIC_TO_CLEAR_MESSAGES = new Topic()
       .setName("topic-to-clear-message-attribute-" + randomAlphabetic(5))
-      .setMessageKey(fileToString(System.getProperty("user.dir") + "/src/test/resources/producedkey.txt"))
-      .setMessageContent(fileToString(System.getProperty("user.dir") + "/src/test/resources/testData.txt"));
+      .setMessageKey(randomAlphabetic(5))
+      .setMessageContent(randomAlphabetic(10));
+  private static final Topic TOPIC_FOR_CHECKING_FILTERS = new Topic()
+      .setName("topic_for_checking_filters" + randomAlphabetic(5))
+      .setMessageKey(randomAlphabetic(5))
+      .setMessageContent(randomAlphabetic(10));
   private static final Topic TOPIC_TO_RECREATE = new Topic()
       .setName("topic-to-recreate-attribute-" + randomAlphabetic(5))
-      .setMessageKey(fileToString(System.getProperty("user.dir") + "/src/test/resources/producedkey.txt"))
-      .setMessageContent(fileToString(System.getProperty("user.dir") + "/src/test/resources/testData.txt"));
+      .setMessageKey(randomAlphabetic(5))
+      .setMessageContent(randomAlphabetic(10));
   private static final List<Topic> TOPIC_LIST = new ArrayList<>();
 
   @BeforeAll
   public void beforeAll() {
-    TOPIC_LIST.addAll(List.of(TOPIC_FOR_MESSAGES, TOPIC_TO_CLEAR_MESSAGES, TOPIC_TO_RECREATE));
-    TOPIC_LIST.forEach(topic -> apiService.createTopic(CLUSTER_NAME, topic.getName()));
+    TOPIC_LIST.addAll(List.of(TOPIC_FOR_MESSAGES, TOPIC_FOR_CHECKING_FILTERS, TOPIC_TO_CLEAR_MESSAGES, TOPIC_TO_RECREATE));
+    TOPIC_LIST.forEach(topic -> apiService.createTopic(topic.getName()));
+    IntStream.range(1, 3).forEach(i -> apiService.sendMessage(TOPIC_FOR_CHECKING_FILTERS));
+    waitUntilNewMinuteStarted();
+    IntStream.range(1, 3).forEach(i -> apiService.sendMessage(TOPIC_FOR_CHECKING_FILTERS));
   }
 
   @DisplayName("produce message")
@@ -58,7 +69,7 @@ public void beforeAll() {
   void produceMessage() {
     navigateToTopicsAndOpenDetails(TOPIC_FOR_MESSAGES.getName());
     topicDetails
-        .openDetailsTab(TopicDetails.TopicMenu.MESSAGES)
+        .openDetailsTab(MESSAGES)
         .clickProduceMessageBtn();
     produceMessagePanel
         .waitUntilScreenReady()
@@ -85,7 +96,7 @@ void produceMessage() {
   void clearMessage() {
     navigateToTopicsAndOpenDetails(TOPIC_FOR_MESSAGES.getName());
     topicDetails
-        .openDetailsTab(TopicDetails.TopicMenu.OVERVIEW)
+        .openDetailsTab(OVERVIEW)
         .clickProduceMessageBtn();
     int messageAmount = topicDetails.getMessageCountAmount();
     produceMessagePanel
@@ -111,35 +122,70 @@ void clearMessage() {
   @CaseId(21)
   @Test
   void copyMessageFromTopicProfile() {
-    navigateToTopicsAndOpenDetails("_schemas");
+    navigateToTopicsAndOpenDetails(TOPIC_FOR_CHECKING_FILTERS.getName());
     topicDetails
-        .openDetailsTab(TopicDetails.TopicMenu.MESSAGES)
+        .openDetailsTab(MESSAGES)
         .getRandomMessage()
         .openDotMenu()
         .clickCopyToClipBoard();
-    Assertions.assertTrue(topicDetails.isAlertWithMessageVisible(SUCCESS,"Copied successfully!"),
+    Assertions.assertTrue(topicDetails.isAlertWithMessageVisible(SUCCESS, "Copied successfully!"),
         "isAlertWithMessageVisible()");
   }
 
   @Disabled
-  @Issue("https://github.com/provectus/kafka-ui/issues/2856")
+  @Issue("https://github.com/provectus/kafka-ui/issues/2394")
   @DisplayName("Checking messages filtering by Offset within Topic/Messages")
   @Suite(suiteId = SUITE_ID, title = SUITE_TITLE)
   @AutomationStatus(status = Status.AUTOMATED)
   @CaseId(15)
   @Test
   void checkingMessageFilteringByOffset() {
-    String offsetValue = "2";
-    navigateToTopicsAndOpenDetails("_schemas");
+    navigateToTopicsAndOpenDetails(TOPIC_FOR_CHECKING_FILTERS.getName());
+    topicDetails
+        .openDetailsTab(MESSAGES);
+    TopicDetails.MessageGridItem secondMessage = topicDetails.getMessageByOffset(1);
     topicDetails
-        .openDetailsTab(MESSAGES)
         .selectSeekTypeDdlMessagesTab("Offset")
-        .setSeekTypeValueFldMessagesTab(offsetValue)
+        .setSeekTypeValueFldMessagesTab(String.valueOf(secondMessage.getOffset()))
+        .clickSubmitFiltersBtnMessagesTab();
+    SoftAssertions softly = new SoftAssertions();
+    topicDetails.getAllMessages().forEach(message ->
+        softly.assertThat(message.getOffset() == secondMessage.getOffset()
+                || message.getOffset() > secondMessage.getOffset())
+            .as(String.format("Expected offset is: %s, but found: %s", secondMessage.getOffset(), message.getOffset()))
+            .isTrue());
+    softly.assertAll();
+  }
+
+  @Disabled
+  @Issue("https://github.com/provectus/kafka-ui/issues/3215")
+  @Issue("https://github.com/provectus/kafka-ui/issues/2345")
+  @DisplayName("Checking messages filtering by Timestamp within Messages/Topic")
+  @Suite(suiteId = SUITE_ID, title = SUITE_TITLE)
+  @AutomationStatus(status = Status.AUTOMATED)
+  @CaseId(16)
+  @Test
+  void checkingMessageFilteringByTimestamp() {
+    navigateToTopicsAndOpenDetails(TOPIC_FOR_CHECKING_FILTERS.getName());
+    topicDetails
+        .openDetailsTab(MESSAGES);
+    LocalDateTime firstTimestamp = topicDetails.getMessageByOffset(0).getTimestamp();
+    List<TopicDetails.MessageGridItem> nextMessages = topicDetails.getAllMessages().stream()
+        .filter(message -> message.getTimestamp().getMinute() != firstTimestamp.getMinute())
+        .collect(Collectors.toList());
+    LocalDateTime nextTimestamp = Objects.requireNonNull(nextMessages.stream()
+        .findFirst().orElse(null)).getTimestamp();
+    topicDetails
+        .selectSeekTypeDdlMessagesTab("Timestamp")
+        .openCalendarSeekType()
+        .selectDateAndTimeByCalendar(nextTimestamp)
         .clickSubmitFiltersBtnMessagesTab();
     SoftAssertions softly = new SoftAssertions();
-    topicDetails.getAllMessages()
-        .forEach(messages -> softly.assertThat(messages.getOffset() == Integer.parseInt(offsetValue))
-        .as("getAllMessages()").isTrue());
+    topicDetails.getAllMessages().forEach(message ->
+        softly.assertThat(message.getTimestamp().isEqual(nextTimestamp)
+                || message.getTimestamp().isAfter(nextTimestamp))
+            .as(String.format("Expected timestamp is: %s, but found: %s", nextTimestamp, message.getTimestamp()))
+            .isTrue());
     softly.assertAll();
   }
 
@@ -215,6 +261,6 @@ void checkRecreateTopic(){
 
   @AfterAll
   public void afterAll() {
-    TOPIC_LIST.forEach(topic -> apiService.deleteTopic(CLUSTER_NAME, topic.getName()));
+    TOPIC_LIST.forEach(topic -> apiService.deleteTopic(topic.getName()));
   }
 }
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 89857df9675..bc2ebe0889b 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
@@ -9,11 +9,9 @@
 import static com.provectus.kafka.ui.pages.topic.enums.MaxSizeOnDisk.NOT_SET;
 import static com.provectus.kafka.ui.pages.topic.enums.MaxSizeOnDisk.SIZE_1_GB;
 import static com.provectus.kafka.ui.pages.topic.enums.MaxSizeOnDisk.SIZE_20_GB;
-import static com.provectus.kafka.ui.settings.BaseSource.CLUSTER_NAME;
-import static com.provectus.kafka.ui.utilities.FileUtils.fileToString;
 import static org.apache.commons.lang.RandomStringUtils.randomAlphabetic;
-import static org.assertj.core.api.Assertions.assertThat;
 import static org.apache.commons.lang3.RandomUtils.nextInt;
+import static org.assertj.core.api.Assertions.assertThat;
 
 import com.codeborne.selenide.Condition;
 import com.provectus.kafka.ui.base.BaseTest;
@@ -56,8 +54,8 @@ public class TopicsTests extends BaseTest {
       .setTimeToRetainData("604800001")
       .setMaxSizeOnDisk(SIZE_20_GB)
       .setMaxMessageBytes("1000020")
-      .setMessageKey(fileToString(System.getProperty("user.dir") + "/src/test/resources/producedkey.txt"))
-      .setMessageContent(fileToString(System.getProperty("user.dir") + "/src/test/resources/testData.txt"));
+      .setMessageKey(randomAlphabetic(5))
+      .setMessageContent(randomAlphabetic(10));
   private static final Topic TOPIC_TO_CHECK_SETTINGS = new Topic()
       .setName("new-topic-" + randomAlphabetic(5))
       .setNumberOfPartitions(1)
@@ -69,7 +67,7 @@ public class TopicsTests extends BaseTest {
   @BeforeAll
   public void beforeAll() {
     TOPIC_LIST.addAll(List.of(TOPIC_TO_UPDATE, TOPIC_FOR_DELETE));
-    TOPIC_LIST.forEach(topic -> apiService.createTopic(CLUSTER_NAME, topic.getName()));
+    TOPIC_LIST.forEach(topic -> apiService.createTopic(topic.getName()));
   }
 
   @DisplayName("should create a topic")
@@ -505,6 +503,6 @@ void checkCopyTopicPossibility(){
 
   @AfterAll
   public void afterAll() {
-    TOPIC_LIST.forEach(topic -> apiService.deleteTopic(CLUSTER_NAME, topic.getName()));
+    TOPIC_LIST.forEach(topic -> apiService.deleteTopic(topic.getName()));
   }
 }