浏览代码

Issue/copy checking topics section within kafka UI application (#2925)

* Commit

* Moved and renamed classes from Tests

* Added new methods and refactored getRandomMessage()

* Moved SmokeTests from tests to com.provectus.kafka.ui

* Moved SmokeTests from com.provectus.kafka.ui to Suite

* resolve conversation

* resolve conversation
Alexandr Nezboretskiy 2 年之前
父节点
当前提交
6de731778b

+ 3 - 4
kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/TopPanel.java

@@ -1,13 +1,12 @@
 package com.provectus.kafka.ui.pages;
 
-import com.codeborne.selenide.SelenideElement;
+import static com.codeborne.selenide.Selenide.$x;
 
+import com.codeborne.selenide.SelenideElement;
 import java.util.Arrays;
 import java.util.List;
 
-import static com.codeborne.selenide.Selenide.$x;
-
-public class TopPanel {
+public class TopPanel extends BasePage{
     protected SelenideElement kafkaLogo = $x("//a[contains(text(),'UI for Apache Kafka')]");
     protected SelenideElement kafkaVersion = $x("//a[@title='Current commit']");
     protected SelenideElement logOutBtn = $x("//button[contains(text(),'Log out')]");

+ 2 - 1
kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/topic/TopicDetails.java

@@ -3,6 +3,7 @@ package com.provectus.kafka.ui.pages.topic;
 import static com.codeborne.selenide.Selenide.$;
 import static com.codeborne.selenide.Selenide.$$x;
 import static com.codeborne.selenide.Selenide.$x;
+import static org.apache.commons.lang.math.RandomUtils.nextInt;
 
 import com.codeborne.selenide.CollectionCondition;
 import com.codeborne.selenide.Condition;
@@ -142,7 +143,7 @@ public class TopicDetails extends BasePage {
 
   @Step
   public TopicDetails.MessageGridItem getRandomMessage() {
-    return getMessage(initItems().size() - 1);
+    return getMessage(nextInt(initItems().size() - 1));
   }
 
   public static class MessageGridItem extends BasePage {

+ 42 - 0
kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/topic/TopicsList.java

@@ -7,6 +7,11 @@ import com.codeborne.selenide.SelenideElement;
 import com.provectus.kafka.ui.pages.BasePage;
 import com.provectus.kafka.ui.utilities.WaitUtils;
 import io.qameta.allure.Step;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
 import lombok.experimental.ExtensionMethod;
 
 @ExtensionMethod(WaitUtils.class)
@@ -14,6 +19,10 @@ public class TopicsList extends BasePage {
 
     protected SelenideElement topicListHeader = $x("//h1[text()='Topics']");
     protected SelenideElement addTopicBtn = $x("//button[normalize-space(text()) ='Add a Topic']");
+    protected SelenideElement searchField = $x("//input[@placeholder='Search by Topic Name']");
+    protected SelenideElement showInternalRadioBtn = $x("//input[@name='ShowInternalTopics']");
+    protected String сolumnHeaderLocator = "//table//tr/th/div[text()='%s']";
+    protected String actionButtonLocator = "//button[text()='%s']";
 
     @Step
     public TopicsList waitUntilScreenReady() {
@@ -39,4 +48,37 @@ public class TopicsList extends BasePage {
         getTableElement(topicName).shouldBe(Condition.enabled).click();
         return this;
     }
+
+    private List<SelenideElement> getActionButtons() {
+      return Stream.of("Delete selected topics", "Copy selected topic", "Purge messages of selected topics")
+          .map(name -> $x(String.format(actionButtonLocator, name)))
+          .collect(Collectors.toList());
+    }
+
+    private List<SelenideElement> getVisibleColumnHeaders() {
+      return Stream.of("Replication Factor","Number of messages","Topic Name", "Partitions", "Out of sync replicas", "Size")
+          .map(name -> $x(String.format(сolumnHeaderLocator, name)))
+        .collect(Collectors.toList());
+    }
+
+    private List<SelenideElement> getEnabledColumnHeaders(){
+      return Stream.of("Topic Name", "Partitions", "Out of sync replicas", "Size")
+          .map(name -> $x(String.format(сolumnHeaderLocator, name)))
+          .collect(Collectors.toList());
+    }
+
+    @Step
+    public List<SelenideElement> getAllVisibleElements() {
+      List<SelenideElement> visibleElements = new ArrayList<>(getVisibleColumnHeaders());
+      visibleElements.addAll(Arrays.asList(searchField, addTopicBtn, tableGrid));
+      visibleElements.addAll(getActionButtons());
+      return visibleElements;
+    }
+
+    @Step
+    public List<SelenideElement> getAllEnabledElements() {
+      List<SelenideElement> enabledElements = new ArrayList<>(getEnabledColumnHeaders());
+      enabledElements.addAll(Arrays.asList(searchField, showInternalRadioBtn,addTopicBtn));
+      return enabledElements;
+    }
 }

+ 2 - 2
kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/SmokeTests.java → kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/suite/SmokeTests.java

@@ -1,4 +1,4 @@
-package com.provectus.kafka.ui;
+package com.provectus.kafka.ui.suite;
 
 import com.codeborne.selenide.Condition;
 import com.provectus.kafka.ui.base.BaseTest;
@@ -29,4 +29,4 @@ public class SmokeTests extends BaseTest {
                                 .as(element.getSearchCriteria() + " isEnabled()").isTrue());
         softly.assertAll();
     }
-}
+}

+ 1 - 1
kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/tests/ConnectorsTests.java → kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/suite/connectors/ConnectorsTests.java

@@ -1,4 +1,4 @@
-package com.provectus.kafka.ui.tests;
+package com.provectus.kafka.ui.suite.connectors;
 
 import static com.provectus.kafka.ui.pages.BasePage.AlertHeader.SUCCESS;
 import static com.provectus.kafka.ui.pages.NaviSideBar.SideMenuOption.KAFKA_CONNECT;

+ 1 - 1
kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/tests/SchemasTests.java → kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/suite/schemas/SchemasTests.java

@@ -1,4 +1,4 @@
-package com.provectus.kafka.ui.tests;
+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.Source.CLUSTER_NAME;

+ 259 - 0
kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/suite/topics/TopicActionsTests.java

@@ -0,0 +1,259 @@
+package com.provectus.kafka.ui.suite.topics;
+
+import static com.provectus.kafka.ui.pages.NaviSideBar.SideMenuOption.TOPICS;
+import static com.provectus.kafka.ui.pages.topic.enums.CleanupPolicyValue.COMPACT;
+import static com.provectus.kafka.ui.pages.topic.enums.CleanupPolicyValue.DELETE;
+import static com.provectus.kafka.ui.pages.topic.enums.CustomParameterType.COMPRESSION_TYPE;
+import static com.provectus.kafka.ui.pages.topic.enums.MaxSizeOnDisk.SIZE_20_GB;
+import static com.provectus.kafka.ui.settings.Source.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 com.codeborne.selenide.Condition;
+import com.provectus.kafka.ui.base.BaseTest;
+import com.provectus.kafka.ui.models.Topic;
+import com.provectus.kafka.ui.pages.topic.TopicDetails;
+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.qameta.allure.Issue;
+import io.qase.api.annotation.CaseId;
+import java.util.ArrayList;
+import java.util.List;
+import org.assertj.core.api.SoftAssertions;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
+public class TopicActionsTests extends BaseTest {
+  private static final long SUITE_ID = 2;
+  private static final String SUITE_TITLE = "Topics";
+  private static final Topic TOPIC_TO_CREATE = new Topic()
+      .setName("new-topic-"+ randomAlphabetic(5))
+      .setPartitions("1")
+      .setCustomParameterType(COMPRESSION_TYPE)
+      .setCustomParameterValue("producer")
+      .setCleanupPolicyValue(DELETE);
+  private static final Topic TOPIC_FOR_UPDATE = new Topic()
+      .setName("topic-to-update-" + randomAlphabetic(5))
+      .setCleanupPolicyValue(COMPACT)
+      .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"));
+
+  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_FOR_UPDATE, TOPIC_FOR_DELETE));
+    TOPIC_LIST.forEach(topic -> apiHelper.createTopic(CLUSTER_NAME, topic.getName()));
+  }
+
+  @DisplayName("should create a topic")
+  @Suite(suiteId = 4, title = "Create new Topic")
+  @AutomationStatus(status = Status.AUTOMATED)
+  @CaseId(199)
+  @Test
+  public void createTopic() {
+    naviSideBar
+        .openSideMenu(TOPICS);
+    topicsList
+        .waitUntilScreenReady()
+        .clickAddTopicBtn();
+    topicCreateEditForm
+        .waitUntilScreenReady()
+        .setTopicName(TOPIC_TO_CREATE.getName())
+        .setPartitions(TOPIC_TO_CREATE.getPartitions())
+        .selectCleanupPolicy(TOPIC_TO_CREATE.getCleanupPolicyValue())
+        .clickCreateTopicBtn();
+    topicDetails
+        .waitUntilScreenReady();
+    naviSideBar
+        .openSideMenu(TOPICS);
+    topicsList
+        .waitUntilScreenReady()
+        .openTopic(TOPIC_TO_CREATE.getName());
+    SoftAssertions softly = new SoftAssertions();
+    softly.assertThat(topicDetails.isTopicHeaderVisible(TOPIC_TO_CREATE.getName())).as("isTopicHeaderVisible()").isTrue();
+    softly.assertThat(topicDetails.getCleanUpPolicy()).as("getCleanUpPolicy()").isEqualTo(TOPIC_TO_CREATE.getCleanupPolicyValue().toString());
+    softly.assertThat(topicDetails.getPartitions()).as("getPartitions()").isEqualTo(TOPIC_TO_CREATE.getPartitions());
+    softly.assertAll();
+    naviSideBar
+        .openSideMenu(TOPICS);
+    topicsList
+        .waitUntilScreenReady();
+    Assertions.assertTrue(topicsList.isTopicVisible(TOPIC_TO_CREATE.getName()), "isTopicVisible");
+    TOPIC_LIST.add(TOPIC_TO_CREATE);
+  }
+
+  @Disabled()
+  @Issue("https://github.com/provectus/kafka-ui/issues/2625")
+  @DisplayName("should update a topic")
+  @Suite(suiteId = SUITE_ID, title = SUITE_TITLE)
+  @AutomationStatus(status = Status.AUTOMATED)
+  @CaseId(197)
+  @Test
+  public void updateTopic() {
+    naviSideBar
+        .openSideMenu(TOPICS);
+    topicsList
+        .waitUntilScreenReady()
+        .openTopic(TOPIC_FOR_UPDATE.getName());
+    topicDetails
+        .waitUntilScreenReady()
+        .openDotMenu()
+        .clickEditSettingsMenu();
+    topicCreateEditForm
+        .waitUntilScreenReady()
+        .selectCleanupPolicy((TOPIC_FOR_UPDATE.getCleanupPolicyValue()))
+        .setMinInsyncReplicas(10)
+        .setTimeToRetainDataInMs(TOPIC_FOR_UPDATE.getTimeToRetainData())
+        .setMaxSizeOnDiskInGB(TOPIC_FOR_UPDATE.getMaxSizeOnDisk())
+        .setMaxMessageBytes(TOPIC_FOR_UPDATE.getMaxMessageBytes())
+        .clickCreateTopicBtn();
+    topicDetails
+        .waitUntilScreenReady();
+    naviSideBar
+        .openSideMenu(TOPICS);
+    topicsList
+        .waitUntilScreenReady()
+        .openTopic(TOPIC_FOR_UPDATE.getName());
+    topicDetails
+        .waitUntilScreenReady()
+        .openDotMenu()
+        .clickEditSettingsMenu();
+    SoftAssertions softly = new SoftAssertions();
+    softly.assertThat(topicCreateEditForm.getCleanupPolicy()).as("getCleanupPolicy()").isEqualTo(TOPIC_FOR_UPDATE.getCleanupPolicyValue().getVisibleText());
+    softly.assertThat(topicCreateEditForm.getTimeToRetain()).as("getTimeToRetain()").isEqualTo(TOPIC_FOR_UPDATE.getTimeToRetainData());
+    softly.assertThat(topicCreateEditForm.getMaxSizeOnDisk()).as("getMaxSizeOnDisk()").isEqualTo(TOPIC_FOR_UPDATE.getMaxSizeOnDisk().getVisibleText());
+    softly.assertThat(topicCreateEditForm.getMaxMessageBytes()).as("getMaxMessageBytes()").isEqualTo(TOPIC_FOR_UPDATE.getMaxMessageBytes());
+    softly.assertAll();
+  }
+
+  @DisplayName("should delete topic")
+  @Suite(suiteId = SUITE_ID, title = SUITE_TITLE)
+  @AutomationStatus(status = Status.AUTOMATED)
+  @CaseId(207)
+  @Test
+  public void deleteTopic() {
+    naviSideBar
+        .openSideMenu(TOPICS);
+    topicsList
+        .waitUntilScreenReady()
+        .openTopic(TOPIC_FOR_DELETE.getName());
+    topicDetails
+        .waitUntilScreenReady()
+        .openDotMenu()
+        .clickDeleteTopicMenu()
+        .clickConfirmDeleteBtn();
+    naviSideBar
+        .openSideMenu(TOPICS);
+    topicsList
+        .waitUntilScreenReady();
+    Assertions.assertFalse(topicsList.isTopicVisible(TOPIC_FOR_DELETE.getName()), "isTopicVisible");
+    TOPIC_LIST.remove(TOPIC_FOR_DELETE);
+  }
+
+  @DisplayName("Redirect to consumer from topic profile")
+  @Suite(suiteId = SUITE_ID, title = SUITE_TITLE)
+  @AutomationStatus(status = Status.AUTOMATED)
+  @CaseId(20)
+  @Test
+  void redirectToConsumerFromTopic() {
+    String topicName = "source-activities";
+    String consumerGroupId = "connect-sink_postgres_activities";
+    naviSideBar
+        .openSideMenu(TOPICS);
+    topicsList
+        .waitUntilScreenReady()
+        .openTopic(topicName);
+    topicDetails
+        .waitUntilScreenReady()
+        .openDetailsTab(TopicDetails.TopicMenu.CONSUMERS)
+        .openConsumerGroup(consumerGroupId);
+    consumersDetails
+        .waitUntilScreenReady();
+    assertThat(consumersDetails.isRedirectedConsumerTitleVisible(consumerGroupId))
+        .withFailMessage("isRedirectedConsumerTitleVisible").isTrue();
+    assertThat(consumersDetails.isTopicInConsumersDetailsVisible(topicName))
+        .withFailMessage("isTopicInConsumersDetailsVisible").isTrue();
+  }
+
+  @DisplayName("Checking Topic creation possibility in case of empty Topic Name")
+  @Suite(suiteId = SUITE_ID, title = SUITE_TITLE)
+  @AutomationStatus(status = Status.AUTOMATED)
+  @CaseId(4)
+  @Test
+  void checkTopicCreatePossibility() {
+    naviSideBar
+        .openSideMenu(TOPICS);
+    topicsList
+        .waitUntilScreenReady()
+        .clickAddTopicBtn();
+    topicCreateEditForm
+        .waitUntilScreenReady()
+        .setTopicName("");
+    assertThat(topicCreateEditForm.isCreateTopicButtonEnabled()).as("isCreateTopicButtonEnabled()").isFalse();
+    topicCreateEditForm
+        .setTopicName("testTopic1");
+    assertThat(topicCreateEditForm.isCreateTopicButtonEnabled()).as("isCreateTopicButtonEnabled()").isTrue();
+  }
+
+  @DisplayName("Checking requiredness of Custom parameters within 'Create new Topic'")
+  @Suite(suiteId = SUITE_ID, title = SUITE_TITLE)
+  @AutomationStatus(status = Status.AUTOMATED)
+  @CaseId(6)
+  @Test
+  void checkCustomParametersWithinCreateNewTopic() {
+    naviSideBar
+        .openSideMenu(TOPICS);
+    topicsList
+        .waitUntilScreenReady()
+        .clickAddTopicBtn();
+    topicCreateEditForm
+        .waitUntilScreenReady()
+        .setTopicName(TOPIC_TO_CREATE.getName())
+        .clickAddCustomParameterTypeButton()
+        .setCustomParameterType(TOPIC_TO_CREATE.getCustomParameterType());
+    assertThat(topicCreateEditForm.isDeleteCustomParameterButtonEnabled()).as("isDeleteCustomParameterButtonEnabled()")
+        .isTrue();
+    topicCreateEditForm
+        .clearCustomParameterValue();
+    assertThat(topicCreateEditForm.isValidationMessageCustomParameterValueVisible())
+        .as("isValidationMessageCustomParameterValueVisible()").isTrue();
+  }
+
+  @DisplayName("Checking Topics section within Kafka-ui Application")
+  @Suite(suiteId = SUITE_ID, title = SUITE_TITLE)
+  @AutomationStatus(status = Status.AUTOMATED)
+  @CaseId(2)
+  @Test
+  void checkTopicListElements(){
+    naviSideBar
+        .openSideMenu(TOPICS);
+    topicsList
+        .waitUntilScreenReady();
+    SoftAssertions softly = new SoftAssertions();
+    topicsList.getAllVisibleElements().forEach(
+        element -> softly.assertThat(element.is(Condition.visible)).as(element.getSearchCriteria() + " isVisible()")
+            .isTrue());
+    topicsList.getAllEnabledElements().forEach(
+        element -> softly.assertThat(element.is(Condition.enabled)).as(element.getSearchCriteria() + " isEnabled()")
+            .isTrue());
+    softly.assertAll();
+  }
+
+  @AfterAll
+  public void afterAll() {
+    TOPIC_LIST.forEach(topic -> apiHelper.deleteTopic(CLUSTER_NAME, topic.getName()));
+  }
+}

+ 133 - 0
kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/suite/topics/TopicMessagesTests.java

@@ -0,0 +1,133 @@
+package com.provectus.kafka.ui.suite.topics;
+
+import static com.provectus.kafka.ui.pages.BasePage.AlertHeader.SUCCESS;
+import static com.provectus.kafka.ui.pages.NaviSideBar.SideMenuOption.TOPICS;
+import static com.provectus.kafka.ui.settings.Source.CLUSTER_NAME;
+import static com.provectus.kafka.ui.utilities.FileUtils.fileToString;
+import static org.apache.commons.lang.RandomStringUtils.randomAlphabetic;
+
+import com.provectus.kafka.ui.base.BaseTest;
+import com.provectus.kafka.ui.models.Topic;
+import com.provectus.kafka.ui.pages.topic.TopicDetails;
+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.qameta.allure.Issue;
+import io.qase.api.annotation.CaseId;
+import java.util.ArrayList;
+import java.util.List;
+import org.assertj.core.api.SoftAssertions;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
+public class TopicMessagesTests extends BaseTest {
+  private static final long SUITE_ID = 2;
+  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"));
+  private static final List<Topic> TOPIC_LIST = new ArrayList<>();
+
+  @BeforeAll
+  public void beforeAll() {
+    TOPIC_LIST.addAll(List.of(TOPIC_FOR_MESSAGES));
+    TOPIC_LIST.forEach(topic -> apiHelper.createTopic(CLUSTER_NAME, topic.getName()));
+  }
+
+  @DisplayName("produce message")
+  @Suite(suiteId = SUITE_ID, title = SUITE_TITLE)
+  @AutomationStatus(status = Status.AUTOMATED)
+  @CaseId(222)
+  @Test
+  void produceMessage() {
+    naviSideBar
+        .openSideMenu(TOPICS);
+    topicsList
+        .waitUntilScreenReady()
+        .openTopic(TOPIC_FOR_MESSAGES.getName());
+    topicDetails
+        .waitUntilScreenReady()
+        .openDetailsTab(TopicDetails.TopicMenu.MESSAGES)
+        .clickProduceMessageBtn();
+    produceMessagePanel
+        .waitUntilScreenReady()
+        .setContentFiled(TOPIC_FOR_MESSAGES.getMessageContent())
+        .setKeyField(TOPIC_FOR_MESSAGES.getMessageKey())
+        .submitProduceMessage();
+    topicDetails
+        .waitUntilScreenReady();
+    SoftAssertions softly = new SoftAssertions();
+    softly.assertThat(topicDetails.isKeyMessageVisible((TOPIC_FOR_MESSAGES.getMessageKey()))).withFailMessage("isKeyMessageVisible()").isTrue();
+    softly.assertThat(topicDetails.isContentMessageVisible((TOPIC_FOR_MESSAGES.getMessageContent()).trim())).withFailMessage("isContentMessageVisible()").isTrue();
+    softly.assertAll();
+  }
+
+  @Disabled
+  @Issue("https://github.com/provectus/kafka-ui/issues/2778")
+  @DisplayName("clear message")
+  @Suite(suiteId = SUITE_ID, title = SUITE_TITLE)
+  @AutomationStatus(status = Status.AUTOMATED)
+  @CaseId(19)
+  @Test
+  void clearMessage() {
+    naviSideBar
+        .openSideMenu(TOPICS);
+    topicsList
+        .waitUntilScreenReady()
+        .openTopic(TOPIC_FOR_MESSAGES.getName());
+    topicDetails
+        .waitUntilScreenReady()
+        .openDetailsTab(TopicDetails.TopicMenu.OVERVIEW)
+        .clickProduceMessageBtn();
+    int messageAmount = topicDetails.getMessageCountAmount();
+    produceMessagePanel
+        .waitUntilScreenReady()
+        .setContentFiled(TOPIC_FOR_MESSAGES.getMessageContent())
+        .setKeyField(TOPIC_FOR_MESSAGES.getMessageKey())
+        .submitProduceMessage();
+    topicDetails
+        .waitUntilScreenReady();
+    Assertions.assertEquals(messageAmount + 1, topicDetails.getMessageCountAmount(), "getMessageCountAmount()");
+    topicDetails
+        .openDotMenu()
+        .clickClearMessagesMenu()
+        .waitUntilScreenReady();
+    Assertions.assertEquals(0, topicDetails.getMessageCountAmount(), "getMessageCountAmount()");
+  }
+
+  @Disabled
+  @Issue("https://github.com/provectus/kafka-ui/issues/2819")
+  @DisplayName("Message copy from topic profile")
+  @Suite(suiteId = SUITE_ID, title = SUITE_TITLE)
+  @AutomationStatus(status = Status.AUTOMATED)
+  @CaseId(21)
+  @Test
+  void copyMessageFromTopicProfile() {
+    String topicName = "_schemas";
+    naviSideBar
+        .openSideMenu(TOPICS);
+    topicsList
+        .waitUntilScreenReady()
+        .openTopic(topicName);
+    topicDetails
+        .waitUntilScreenReady()
+        .openDetailsTab(TopicDetails.TopicMenu.MESSAGES)
+        .getRandomMessage()
+        .openDotMenu()
+        .clickCopyToClipBoard();
+    Assertions.assertTrue(topicDetails.isAlertWithMessageVisible(SUCCESS, "Copied successfully!"),
+        "isAlertWithMessageVisible()");
+  }
+
+  @AfterAll
+  public void afterAll() {
+    TOPIC_LIST.forEach(topic -> apiHelper.deleteTopic(CLUSTER_NAME, topic.getName()));
+  }
+}

+ 0 - 329
kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/tests/TopicTests.java

@@ -1,329 +0,0 @@
-package com.provectus.kafka.ui.tests;
-
-import static com.provectus.kafka.ui.pages.BasePage.AlertHeader.SUCCESS;
-import static com.provectus.kafka.ui.pages.NaviSideBar.SideMenuOption.TOPICS;
-import static com.provectus.kafka.ui.pages.topic.enums.CleanupPolicyValue.COMPACT;
-import static com.provectus.kafka.ui.pages.topic.enums.CleanupPolicyValue.DELETE;
-import static com.provectus.kafka.ui.pages.topic.enums.CustomParameterType.COMPRESSION_TYPE;
-import static com.provectus.kafka.ui.pages.topic.enums.MaxSizeOnDisk.SIZE_20_GB;
-import static com.provectus.kafka.ui.settings.Source.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 com.provectus.kafka.ui.base.BaseTest;
-import com.provectus.kafka.ui.models.Topic;
-import com.provectus.kafka.ui.pages.BasePage;
-import com.provectus.kafka.ui.pages.topic.TopicDetails;
-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.qameta.allure.Issue;
-import io.qase.api.annotation.CaseId;
-import java.util.ArrayList;
-import java.util.List;
-import org.assertj.core.api.SoftAssertions;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Disabled;
-import org.junit.jupiter.api.DisplayName;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.TestInstance;
-
-@TestInstance(TestInstance.Lifecycle.PER_CLASS)
-public class TopicTests extends BaseTest {
-    private static final long SUITE_ID = 2;
-    private static final String SUITE_TITLE = "Topics";
-    private static final Topic TOPIC_TO_CREATE = new Topic()
-            .setName("new-topic-"+ randomAlphabetic(5))
-            .setPartitions("1")
-            .setCustomParameterType(COMPRESSION_TYPE)
-            .setCustomParameterValue("producer")
-            .setCleanupPolicyValue(DELETE);
-    private static final Topic TOPIC_FOR_UPDATE = new Topic()
-            .setName("topic-to-update-" + randomAlphabetic(5))
-            .setCleanupPolicyValue(COMPACT)
-            .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"));
-    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"));
-
-    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_FOR_UPDATE, TOPIC_FOR_DELETE, TOPIC_FOR_MESSAGES));
-        TOPIC_LIST.forEach(topic -> apiHelper.createTopic(CLUSTER_NAME, topic.getName()));
-    }
-
-    @DisplayName("should create a topic")
-    @Suite(suiteId = 4, title = "Create new Topic")
-    @AutomationStatus(status = Status.AUTOMATED)
-    @CaseId(199)
-    @Test
-    public void createTopic() {
-        naviSideBar
-                .openSideMenu(TOPICS);
-        topicsList
-                .waitUntilScreenReady()
-                .clickAddTopicBtn();
-        topicCreateEditForm
-                .waitUntilScreenReady()
-                .setTopicName(TOPIC_TO_CREATE.getName())
-                .setPartitions(TOPIC_TO_CREATE.getPartitions())
-                .selectCleanupPolicy(TOPIC_TO_CREATE.getCleanupPolicyValue())
-                .clickCreateTopicBtn();
-        topicDetails
-                .waitUntilScreenReady();
-        naviSideBar
-                .openSideMenu(TOPICS);
-        topicsList
-                .waitUntilScreenReady()
-                .openTopic(TOPIC_TO_CREATE.getName());
-        SoftAssertions softly = new SoftAssertions();
-        softly.assertThat(topicDetails.isTopicHeaderVisible(TOPIC_TO_CREATE.getName())).as("isTopicHeaderVisible()").isTrue();
-        softly.assertThat(topicDetails.getCleanUpPolicy()).as("getCleanUpPolicy()").isEqualTo(TOPIC_TO_CREATE.getCleanupPolicyValue().toString());
-        softly.assertThat(topicDetails.getPartitions()).as("getPartitions()").isEqualTo(TOPIC_TO_CREATE.getPartitions());
-        softly.assertAll();
-        naviSideBar
-                .openSideMenu(TOPICS);
-        topicsList
-                .waitUntilScreenReady();
-        Assertions.assertTrue(topicsList.isTopicVisible(TOPIC_TO_CREATE.getName()), "isTopicVisible");
-        TOPIC_LIST.add(TOPIC_TO_CREATE);
-    }
-
-    @Disabled()
-    @Issue("https://github.com/provectus/kafka-ui/issues/2625")
-    @DisplayName("should update a topic")
-    @Suite(suiteId = SUITE_ID, title = SUITE_TITLE)
-    @AutomationStatus(status = Status.AUTOMATED)
-    @CaseId(197)
-    @Test
-    public void updateTopic() {
-        naviSideBar
-                .openSideMenu(TOPICS);
-        topicsList
-                .waitUntilScreenReady()
-                .openTopic(TOPIC_FOR_UPDATE.getName());
-        topicDetails
-                .waitUntilScreenReady()
-                .openDotMenu()
-                .clickEditSettingsMenu();
-        topicCreateEditForm
-                .waitUntilScreenReady()
-                .selectCleanupPolicy((TOPIC_FOR_UPDATE.getCleanupPolicyValue()))
-                .setMinInsyncReplicas(10)
-                .setTimeToRetainDataInMs(TOPIC_FOR_UPDATE.getTimeToRetainData())
-                .setMaxSizeOnDiskInGB(TOPIC_FOR_UPDATE.getMaxSizeOnDisk())
-                .setMaxMessageBytes(TOPIC_FOR_UPDATE.getMaxMessageBytes())
-                .clickCreateTopicBtn();
-        topicDetails
-                .waitUntilScreenReady();
-        naviSideBar
-                .openSideMenu(TOPICS);
-        topicsList
-                .waitUntilScreenReady()
-                .openTopic(TOPIC_FOR_UPDATE.getName());
-        topicDetails
-                .waitUntilScreenReady()
-                .openDotMenu()
-                .clickEditSettingsMenu();
-        SoftAssertions softly = new SoftAssertions();
-        softly.assertThat(topicCreateEditForm.getCleanupPolicy()).as("getCleanupPolicy()").isEqualTo(TOPIC_FOR_UPDATE.getCleanupPolicyValue().getVisibleText());
-        softly.assertThat(topicCreateEditForm.getTimeToRetain()).as("getTimeToRetain()").isEqualTo(TOPIC_FOR_UPDATE.getTimeToRetainData());
-        softly.assertThat(topicCreateEditForm.getMaxSizeOnDisk()).as("getMaxSizeOnDisk()").isEqualTo(TOPIC_FOR_UPDATE.getMaxSizeOnDisk().getVisibleText());
-        softly.assertThat(topicCreateEditForm.getMaxMessageBytes()).as("getMaxMessageBytes()").isEqualTo(TOPIC_FOR_UPDATE.getMaxMessageBytes());
-        softly.assertAll();
-    }
-
-    @DisplayName("should delete topic")
-    @Suite(suiteId = SUITE_ID, title = SUITE_TITLE)
-    @AutomationStatus(status = Status.AUTOMATED)
-    @CaseId(207)
-    @Test
-    public void deleteTopic() {
-        naviSideBar
-                .openSideMenu(TOPICS);
-        topicsList
-                .waitUntilScreenReady()
-                .openTopic(TOPIC_FOR_DELETE.getName());
-        topicDetails
-                .waitUntilScreenReady()
-                .openDotMenu()
-                .clickDeleteTopicMenu()
-                .clickConfirmDeleteBtn();
-        naviSideBar
-                .openSideMenu(TOPICS);
-        topicsList
-                .waitUntilScreenReady();
-        Assertions.assertFalse(topicsList.isTopicVisible(TOPIC_FOR_DELETE.getName()), "isTopicVisible");
-        TOPIC_LIST.remove(TOPIC_FOR_DELETE);
-    }
-
-    @DisplayName("produce message")
-    @Suite(suiteId = SUITE_ID, title = SUITE_TITLE)
-    @AutomationStatus(status = Status.AUTOMATED)
-    @CaseId(222)
-    @Test
-    void produceMessage() {
-        naviSideBar
-                .openSideMenu(TOPICS);
-        topicsList
-                .waitUntilScreenReady()
-                .openTopic(TOPIC_FOR_MESSAGES.getName());
-        topicDetails
-                .waitUntilScreenReady()
-                .openDetailsTab(TopicDetails.TopicMenu.MESSAGES)
-                .clickProduceMessageBtn();
-        produceMessagePanel
-                .waitUntilScreenReady()
-                .setContentFiled(TOPIC_FOR_MESSAGES.getMessageContent())
-                .setKeyField(TOPIC_FOR_MESSAGES.getMessageKey())
-                .submitProduceMessage();
-        topicDetails
-                .waitUntilScreenReady();
-        SoftAssertions softly = new SoftAssertions();
-        softly.assertThat(topicDetails.isKeyMessageVisible((TOPIC_FOR_MESSAGES.getMessageKey()))).withFailMessage("isKeyMessageVisible()").isTrue();
-        softly.assertThat(topicDetails.isContentMessageVisible((TOPIC_FOR_MESSAGES.getMessageContent()).trim())).withFailMessage("isContentMessageVisible()").isTrue();
-        softly.assertAll();
-    }
-
-    @Disabled
-    @Issue("https://github.com/provectus/kafka-ui/issues/2778")
-    @DisplayName("clear message")
-    @Suite(suiteId = SUITE_ID, title = SUITE_TITLE)
-    @AutomationStatus(status = Status.AUTOMATED)
-    @CaseId(19)
-    @Test
-    void clearMessage() {
-      naviSideBar
-          .openSideMenu(TOPICS);
-      topicsList
-          .waitUntilScreenReady()
-          .openTopic(TOPIC_FOR_MESSAGES.getName());
-      topicDetails
-          .waitUntilScreenReady()
-          .openDetailsTab(TopicDetails.TopicMenu.OVERVIEW)
-          .clickProduceMessageBtn();
-      int messageAmount = topicDetails.getMessageCountAmount();
-      produceMessagePanel
-          .waitUntilScreenReady()
-          .setContentFiled(TOPIC_FOR_MESSAGES.getMessageContent())
-          .setKeyField(TOPIC_FOR_MESSAGES.getMessageKey())
-          .submitProduceMessage();
-      topicDetails
-          .waitUntilScreenReady();
-      Assertions.assertEquals(messageAmount + 1, topicDetails.getMessageCountAmount(), "getMessageCountAmount()");
-      topicDetails
-          .openDotMenu()
-          .clickClearMessagesMenu()
-          .waitUntilScreenReady();
-      Assertions.assertEquals(0, topicDetails.getMessageCountAmount(), "getMessageCountAmount()");
-    }
-
-    @DisplayName("Redirect to consumer from topic profile")
-    @Suite(suiteId = SUITE_ID, title = SUITE_TITLE)
-    @AutomationStatus(status = Status.AUTOMATED)
-    @CaseId(20)
-    @Test
-    void redirectToConsumerFromTopic() {
-        String topicName = "source-activities";
-        String consumerGroupId = "connect-sink_postgres_activities";
-        naviSideBar
-                .openSideMenu(TOPICS);
-        topicsList
-                .waitUntilScreenReady()
-                .openTopic(topicName);
-        topicDetails
-                .waitUntilScreenReady()
-                .openDetailsTab(TopicDetails.TopicMenu.CONSUMERS)
-                .openConsumerGroup(consumerGroupId);
-        consumersDetails
-                .waitUntilScreenReady();
-        assertThat(consumersDetails.isRedirectedConsumerTitleVisible(consumerGroupId))
-                .withFailMessage("isRedirectedConsumerTitleVisible").isTrue();
-        assertThat(consumersDetails.isTopicInConsumersDetailsVisible(topicName))
-                .withFailMessage("isTopicInConsumersDetailsVisible").isTrue();
-    }
-
-  @DisplayName("Checking Topic creation possibility in case of empty Topic Name")
-  @Suite(suiteId = SUITE_ID, title = SUITE_TITLE)
-  @AutomationStatus(status = Status.AUTOMATED)
-  @CaseId(4)
-  @Test
-  void checkTopicCreatePossibility() {
-    naviSideBar
-        .openSideMenu(TOPICS);
-    topicsList
-        .waitUntilScreenReady()
-        .clickAddTopicBtn();
-    topicCreateEditForm
-        .waitUntilScreenReady()
-        .setTopicName("");
-    assertThat(topicCreateEditForm.isCreateTopicButtonEnabled()).as("isCreateTopicButtonEnabled()").isFalse();
-    topicCreateEditForm
-        .setTopicName("testTopic1");
-    assertThat(topicCreateEditForm.isCreateTopicButtonEnabled()).as("isCreateTopicButtonEnabled()").isTrue();
-  }
-
-  @DisplayName("Checking requiredness of Custom parameters within 'Create new Topic'")
-  @Suite(suiteId = SUITE_ID, title = SUITE_TITLE)
-  @AutomationStatus(status = Status.AUTOMATED)
-  @CaseId(6)
-  @Test
-  void checkCustomParametersWithinCreateNewTopic() {
-    naviSideBar
-        .openSideMenu(TOPICS);
-    topicsList
-        .waitUntilScreenReady()
-        .clickAddTopicBtn();
-    topicCreateEditForm
-        .waitUntilScreenReady()
-        .setTopicName(TOPIC_TO_CREATE.getName())
-        .clickAddCustomParameterTypeButton()
-        .setCustomParameterType(TOPIC_TO_CREATE.getCustomParameterType());
-    assertThat(topicCreateEditForm.isDeleteCustomParameterButtonEnabled()).as("isDeleteCustomParameterButtonEnabled()")
-        .isTrue();
-    topicCreateEditForm
-        .clearCustomParameterValue();
-    assertThat(topicCreateEditForm.isValidationMessageCustomParameterValueVisible())
-        .as("isValidationMessageCustomParameterValueVisible()").isTrue();
-  }
-
-  @Disabled
-  @Issue("https://github.com/provectus/kafka-ui/issues/2819")
-  @DisplayName("Message copy from topic profile")
-  @Suite(suiteId = SUITE_ID, title = SUITE_TITLE)
-  @AutomationStatus(status = Status.AUTOMATED)
-  @CaseId(21)
-  @Test
-  void copyMessageFromTopicProfile() {
-    String topicName = "_schemas";
-    naviSideBar
-        .openSideMenu(TOPICS);
-    topicsList
-        .waitUntilScreenReady()
-        .openTopic(topicName);
-    topicDetails
-        .waitUntilScreenReady()
-        .openDetailsTab(TopicDetails.TopicMenu.MESSAGES)
-        .getRandomMessage()
-        .openDotMenu()
-        .clickCopyToClipBoard();
-    Assertions.assertTrue(topicDetails.isAlertWithMessageVisible(SUCCESS, "Copied successfully!"),
-        "isAlertWithMessageVisible()");
-  }
-
-    @AfterAll
-    public void afterAll() {
-        TOPIC_LIST.forEach(topic -> apiHelper.deleteTopic(CLUSTER_NAME, topic.getName()));
-    }
-}