Repository: provectus/kafka-ui
Issue: TopicTests.removeTopicFromAllTopics : Remove topic from all topics
Labels: scope/QA
scope/AQA

Description:
No set

Pre-conditions:
No set

Post-conditions:
No set

Steps:
1. Navigate to Topics
2. Select "Remove topic" from 3 dot menu for Topic
Expected result
"Confirm the action" pop up should open
3. Press "Confirm" button
Expected result
Topic should be removed

Issue comments:

Pull request review comments:
can't we use TOPIC_TO_UPDATE here?
i believe we should rename in in this case
now need to add this topic in your flow
Done

Patch that resolved the issue:
diff --git a/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/topic/TopicsList.java b/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/topic/TopicsList.java
index afe5633e440..9db1d18c8bd 100644
--- a/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/topic/TopicsList.java
+++ b/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/topic/TopicsList.java
@@ -26,6 +26,7 @@ public class TopicsList extends BasePage {
     protected SelenideElement purgeMessagesOfSelectedTopicsBtn = $x("//button[text()='Purge messages of selected topics']");
     protected SelenideElement clearMessagesBtn = $x("//ul[contains(@class ,'open')]//div[text()='Clear Messages']");
     protected SelenideElement recreateTopicBtn = $x("//ul[contains(@class ,'open')]//div[text()='Recreate Topic']");
+    protected SelenideElement removeTopicBtn = $x("//ul[contains(@class ,'open')]//div[text()='Remove Topic']");
 
     @Step
     public TopicsList waitUntilScreenReady() {
@@ -98,6 +99,12 @@ public TopicsList clickRecreateTopicBtn(){
       return this;
     }
 
+    @Step
+    public TopicsList clickRemoveTopicBtn(){
+      clickByJavaScript(removeTopicBtn.shouldBe(visible));
+      return this;
+    }
+
     @Step
     public TopicsList clickConfirmBtnMdl() {
     clickConfirmButton();


Test patch:
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 b5f4e0d9778..b70daa33079 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
@@ -47,8 +47,8 @@ public class TopicsTests extends BaseTest {
       .setCustomParameterType(COMPRESSION_TYPE)
       .setCustomParameterValue("producer")
       .setCleanupPolicyValue(DELETE);
-  private static final Topic TOPIC_TO_UPDATE = new Topic()
-      .setName("topic-to-update-" + randomAlphabetic(5))
+  private static final Topic TOPIC_TO_UPDATE_AND_DELETE = new Topic()
+      .setName("topic-to-update-and-delete-" + randomAlphabetic(5))
       .setNumberOfPartitions(1)
       .setCleanupPolicyValue(COMPACT)
       .setTimeToRetainData("604800001")
@@ -66,7 +66,7 @@ public class TopicsTests extends BaseTest {
 
   @BeforeAll
   public void beforeAll() {
-    TOPIC_LIST.addAll(List.of(TOPIC_TO_UPDATE, TOPIC_FOR_DELETE));
+    TOPIC_LIST.addAll(List.of(TOPIC_TO_UPDATE_AND_DELETE, TOPIC_FOR_DELETE));
     TOPIC_LIST.forEach(topic -> apiService.createTopic(topic.getName()));
   }
 
@@ -127,42 +127,60 @@ void checkAvailableOperations() {
   @Test
   @Order(3)
   public void updateTopic() {
-    navigateToTopicsAndOpenDetails(TOPIC_TO_UPDATE.getName());
+    navigateToTopicsAndOpenDetails(TOPIC_TO_UPDATE_AND_DELETE.getName());
     topicDetails
         .openDotMenu()
         .clickEditSettingsMenu();
     topicCreateEditForm
         .waitUntilScreenReady()
-        .selectCleanupPolicy((TOPIC_TO_UPDATE.getCleanupPolicyValue()))
+        .selectCleanupPolicy((TOPIC_TO_UPDATE_AND_DELETE.getCleanupPolicyValue()))
         .setMinInsyncReplicas(10)
-        .setTimeToRetainDataInMs(TOPIC_TO_UPDATE.getTimeToRetainData())
-        .setMaxSizeOnDiskInGB(TOPIC_TO_UPDATE.getMaxSizeOnDisk())
-        .setMaxMessageBytes(TOPIC_TO_UPDATE.getMaxMessageBytes())
+        .setTimeToRetainDataInMs(TOPIC_TO_UPDATE_AND_DELETE.getTimeToRetainData())
+        .setMaxSizeOnDiskInGB(TOPIC_TO_UPDATE_AND_DELETE.getMaxSizeOnDisk())
+        .setMaxMessageBytes(TOPIC_TO_UPDATE_AND_DELETE.getMaxMessageBytes())
         .clickCreateTopicBtn();
     topicDetails
         .waitUntilScreenReady();
-    navigateToTopicsAndOpenDetails(TOPIC_TO_UPDATE.getName());
+    navigateToTopicsAndOpenDetails(TOPIC_TO_UPDATE_AND_DELETE.getName());
     topicDetails
         .openDotMenu()
         .clickEditSettingsMenu();
     SoftAssertions softly = new SoftAssertions();
     softly.assertThat(topicCreateEditForm.getCleanupPolicy()).as("getCleanupPolicy()")
-        .isEqualTo(TOPIC_TO_UPDATE.getCleanupPolicyValue().getVisibleText());
+        .isEqualTo(TOPIC_TO_UPDATE_AND_DELETE.getCleanupPolicyValue().getVisibleText());
     softly.assertThat(topicCreateEditForm.getTimeToRetain()).as("getTimeToRetain()")
-        .isEqualTo(TOPIC_TO_UPDATE.getTimeToRetainData());
+        .isEqualTo(TOPIC_TO_UPDATE_AND_DELETE.getTimeToRetainData());
     softly.assertThat(topicCreateEditForm.getMaxSizeOnDisk()).as("getMaxSizeOnDisk()")
-        .isEqualTo(TOPIC_TO_UPDATE.getMaxSizeOnDisk().getVisibleText());
+        .isEqualTo(TOPIC_TO_UPDATE_AND_DELETE.getMaxSizeOnDisk().getVisibleText());
     softly.assertThat(topicCreateEditForm.getMaxMessageBytes()).as("getMaxMessageBytes()")
-        .isEqualTo(TOPIC_TO_UPDATE.getMaxMessageBytes());
+        .isEqualTo(TOPIC_TO_UPDATE_AND_DELETE.getMaxMessageBytes());
     softly.assertAll();
   }
 
+  @DisplayName("TopicTests.removeTopicFromAllTopics : Remove topic from 'all topics'/'TopicList'")
+  @Suite(suiteId = SUITE_ID, title = SUITE_TITLE)
+  @AutomationStatus(status = Status.AUTOMATED)
+  @CaseId(242)
+  @Test
+  @Order(4)
+  public void removeTopicFromTopicList() {
+    navigateToTopics();
+    topicsList
+        .openDotMenuByTopicName(TOPIC_TO_UPDATE_AND_DELETE.getName())
+        .clickRemoveTopicBtn()
+        .clickConfirmBtnMdl();
+    Assertions.assertTrue(topicsList.isAlertWithMessageVisible(SUCCESS,
+            String.format("Topic %s successfully deleted!", TOPIC_TO_UPDATE_AND_DELETE.getName())),
+        "isAlertWithMessageVisible()");
+    TOPIC_LIST.remove(TOPIC_TO_UPDATE_AND_DELETE);
+  }
+
   @DisplayName("should delete topic")
   @Suite(suiteId = SUITE_ID, title = SUITE_TITLE)
   @AutomationStatus(status = Status.AUTOMATED)
   @CaseId(207)
   @Test
-  @Order(4)
+  @Order(5)
   public void deleteTopic() {
     navigateToTopicsAndOpenDetails(TOPIC_FOR_DELETE.getName());
     topicDetails
@@ -179,7 +197,7 @@ public void deleteTopic() {
   @AutomationStatus(status = Status.AUTOMATED)
   @CaseId(20)
   @Test
-  @Order(5)
+  @Order(6)
   void redirectToConsumerFromTopic() {
     String topicName = "source-activities";
     String consumerGroupId = "connect-sink_postgres_activities";
@@ -200,7 +218,7 @@ void redirectToConsumerFromTopic() {
   @AutomationStatus(status = Status.AUTOMATED)
   @CaseId(4)
   @Test
-  @Order(6)
+  @Order(7)
   void checkTopicCreatePossibility() {
     navigateToTopics();
     topicsList
@@ -225,7 +243,7 @@ void checkTopicCreatePossibility() {
   @AutomationStatus(status = Status.AUTOMATED)
   @CaseId(266)
   @Test
-  @Order(7)
+  @Order(8)
   void checkTimeToRetainDataCustomValueWithEditingTopic() {
     Topic topicToRetainData = new Topic()
         .setName("topic-to-retain-data-" + randomAlphabetic(5))
@@ -260,7 +278,7 @@ void checkTimeToRetainDataCustomValueWithEditingTopic() {
   @AutomationStatus(status = Status.AUTOMATED)
   @CaseId(6)
   @Test
-  @Order(8)
+  @Order(9)
   void checkCustomParametersWithinCreateNewTopic() {
     navigateToTopics();
     topicsList
@@ -283,7 +301,7 @@ void checkCustomParametersWithinCreateNewTopic() {
   @AutomationStatus(status = Status.AUTOMATED)
   @CaseId(2)
   @Test
-  @Order(9)
+  @Order(10)
   void checkTopicListElements() {
     navigateToTopics();
     verifyElementsCondition(topicsList.getAllVisibleElements(), Condition.visible);
@@ -295,7 +313,7 @@ void checkTopicListElements() {
   @AutomationStatus(status = Status.AUTOMATED)
   @CaseId(12)
   @Test
-  @Order(10)
+  @Order(11)
   void addingNewFilterWithinTopic() {
     String filterName = randomAlphabetic(5);
     navigateToTopicsAndOpenDetails("_schemas");
@@ -322,7 +340,7 @@ void addingNewFilterWithinTopic() {
   @AutomationStatus(status = Status.AUTOMATED)
   @CaseId(13)
   @Test
-  @Order(11)
+  @Order(12)
   void checkFilterSavingWithinSavedFilters() {
     String displayName = randomAlphabetic(5);
     navigateToTopicsAndOpenDetails("my_ksql_1ksql_processing_log");
@@ -347,7 +365,7 @@ void checkFilterSavingWithinSavedFilters() {
   @AutomationStatus(status = Status.AUTOMATED)
   @CaseId(14)
   @Test
-  @Order(12)
+  @Order(13)
   void checkingApplyingSavedFilterWithinTopicMessages() {
     String displayName = randomAlphabetic(5);
     navigateToTopicsAndOpenDetails("my_ksql_1ksql_processing_log");
@@ -371,7 +389,7 @@ void checkingApplyingSavedFilterWithinTopicMessages() {
   @AutomationStatus(status = Status.AUTOMATED)
   @CaseId(11)
   @Test
-  @Order(13)
+  @Order(14)
   void checkShowInternalTopicsButtonFunctionality(){
     navigateToTopics();
     SoftAssertions softly = new SoftAssertions();
@@ -391,6 +409,7 @@ void checkShowInternalTopicsButtonFunctionality(){
   @AutomationStatus(status = Status.AUTOMATED)
   @CaseId(56)
   @Test
+  @Order(15)
   void checkRetentionBytesAccordingToMaxSizeOnDisk(){
     navigateToTopics();
     topicsList
@@ -442,6 +461,7 @@ void checkRetentionBytesAccordingToMaxSizeOnDisk(){
   @AutomationStatus(status = Status.AUTOMATED)
   @CaseId(247)
   @Test
+  @Order(16)
   void recreateTopicFromTopicProfile(){
     Topic topicToRecreate = new Topic()
         .setName("topic-to-recreate-" + randomAlphabetic(5))
@@ -473,6 +493,7 @@ void recreateTopicFromTopicProfile(){
   @AutomationStatus(status = Status.AUTOMATED)
   @CaseId(8)
   @Test
+  @Order(17)
   void checkCopyTopicPossibility(){
     Topic topicToCopy = new Topic()
         .setName("topic-to-copy-" + randomAlphabetic(5))