Repository: provectus/kafka-ui
Issue: [e2e]Checking Broker's config search
Labels: scope/QA
scope/AQA

Autotest implementation for:

https://app.qase.io/case/KAFKAUI-330
Description:
The purpose of this case is to make sure that Broker config search is working for all pages

Pre-conditions:
Not set
Post-conditions:
Not set

Steps:
- Login to kafka-ui
- Navigate to Brokers
- Select the Broker
- Turn to Configs tab
- Turn to next page
- Search for Config existing in a first page.
Expected results:
- Check the configs in the first page
- The searched config should be displayed




Issue comments:

Pull request review comments:

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 8bd7901a635..d2e201191ab 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
@@ -67,6 +67,14 @@ protected void clickSubmitBtn() {
     clickByJavaScript(submitBtn);
   }
 
+  protected void clickNextBtn() {
+    clickByJavaScript(nextBtn);
+  }
+
+  protected void clickBackBtn() {
+    clickByJavaScript(backBtn);
+  }
+
   protected void setJsonInputValue(SelenideElement jsonInput, String jsonConfig) {
     sendKeysByActions(jsonInput, jsonConfig.replace("  ", ""));
     new Actions(WebDriverRunner.getWebDriver())
diff --git a/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/brokers/BrokersConfigTab.java b/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/brokers/BrokersConfigTab.java
index f358614dc87..a3756d3bdfb 100644
--- a/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/brokers/BrokersConfigTab.java
+++ b/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/brokers/BrokersConfigTab.java
@@ -3,29 +3,37 @@
 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.util.ArrayList;
 import java.util.List;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
 public class BrokersConfigTab extends BasePage {
 
-  protected List<SelenideElement> editBtn = $$x("//button[@aria-label='editAction']");
-  protected SelenideElement searchByKeyField = $x("//input[@placeholder='Search by Key']");
+  protected ElementsCollection editBtns = $$x("//button[@aria-label='editAction']");
 
   @Step
   public BrokersConfigTab waitUntilScreenReady() {
     waitUntilSpinnerDisappear();
-    searchByKeyField.shouldBe(Condition.visible);
+    searchFld.shouldBe(Condition.visible);
     return this;
   }
 
   @Step
   public boolean isSearchByKeyVisible() {
-    return isVisible(searchByKeyField);
+    return isVisible(searchFld);
+  }
+
+  @Step
+  public BrokersConfigTab searchConfig(String key) {
+    searchItem(key);
+    return this;
   }
 
   public List<SelenideElement> getColumnHeaders() {
@@ -35,6 +43,61 @@ public List<SelenideElement> getColumnHeaders() {
   }
 
   public List<SelenideElement> getEditButtons() {
-    return editBtn;
+    return editBtns;
+  }
+
+  @Step
+  public BrokersConfigTab clickNextButton() {
+    clickNextBtn();
+    waitUntilSpinnerDisappear(1);
+    return this;
+  }
+
+  private List<BrokersConfigTab.BrokersConfigItem> initGridItems() {
+    List<BrokersConfigTab.BrokersConfigItem> gridItemList = new ArrayList<>();
+    gridItems.shouldHave(CollectionCondition.sizeGreaterThan(0))
+        .forEach(item -> gridItemList.add(new BrokersConfigTab.BrokersConfigItem(item)));
+    return gridItemList;
+  }
+
+  @Step
+  public BrokersConfigTab.BrokersConfigItem getConfig(String key) {
+    return initGridItems().stream()
+        .filter(e -> e.getKey().equals(key))
+        .findFirst().orElseThrow();
+  }
+
+  @Step
+  public List<BrokersConfigTab.BrokersConfigItem> getAllConfigs() {
+    return initGridItems();
+  }
+
+  public static class BrokersConfigItem extends BasePage {
+
+    private final SelenideElement element;
+
+    public BrokersConfigItem(SelenideElement element) {
+      this.element = element;
+    }
+
+    @Step
+    public String getKey() {
+      return element.$x("./td[1]").getText().trim();
+    }
+
+    @Step
+    public String getValue() {
+      return element.$x("./td[2]//span").getText().trim();
+    }
+
+    @Step
+    public void edit() {
+      element.$x("./td[2]//button").shouldBe(Condition.enabled).click();
+    }
+
+    @Step
+    public String getSource() {
+      return element.$x("./td[3]").getText().trim();
+    }
   }
 }
diff --git a/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/brokers/BrokersDetails.java b/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/brokers/BrokersDetails.java
index 4eca65f1f47..05d571116ea 100644
--- a/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/brokers/BrokersDetails.java
+++ b/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/brokers/BrokersDetails.java
@@ -1,6 +1,5 @@
 package com.provectus.kafka.ui.pages.brokers;
 
-import static com.codeborne.selenide.Selenide.$;
 import static com.codeborne.selenide.Selenide.$x;
 
 import com.codeborne.selenide.Condition;
@@ -8,28 +7,24 @@
 import com.provectus.kafka.ui.pages.BasePage;
 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 org.openqa.selenium.By;
 
 public class BrokersDetails extends BasePage {
 
-  protected SelenideElement logDirectoriesTab = $x("//a[text()='Log directories']");
-  protected SelenideElement metricsTab = $x("//a[text()='Metrics']");
   protected String brokersTabLocator = "//a[text()='%s']";
 
   @Step
   public BrokersDetails waitUntilScreenReady() {
     waitUntilSpinnerDisappear();
-    Arrays.asList(logDirectoriesTab, metricsTab).forEach(element -> element.shouldBe(Condition.visible));
+    $x(String.format(brokersTabLocator, DetailsTab.LOG_DIRECTORIES)).shouldBe(Condition.visible);
     return this;
   }
 
   @Step
   public BrokersDetails openDetailsTab(DetailsTab menu) {
-    $(By.linkText(menu.toString())).shouldBe(Condition.enabled).click();
+    $x(String.format(brokersTabLocator, menu.toString())).shouldBe(Condition.enabled).click();
     waitUntilSpinnerDisappear();
     return this;
   }
diff --git a/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/brokers/BrokersList.java b/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/brokers/BrokersList.java
index 9e81a0795cc..9e0741fe747 100644
--- a/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/brokers/BrokersList.java
+++ b/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/brokers/BrokersList.java
@@ -24,7 +24,7 @@ public BrokersList waitUntilScreenReady() {
 
   @Step
   public BrokersList openBroker(int brokerId) {
-    getBrokerItem(brokerId).openItem();
+    getBroker(brokerId).openItem();
     return this;
   }
 
@@ -59,30 +59,30 @@ public List<SelenideElement> getAllEnabledElements() {
     return getEnabledColumnHeaders();
   }
 
-  private List<BrokersList.BrokerGridItem> initGridItems() {
-    List<BrokersList.BrokerGridItem> gridItemList = new ArrayList<>();
+  private List<BrokersGridItem> initGridItems() {
+    List<BrokersGridItem> gridItemList = new ArrayList<>();
     gridItems.shouldHave(CollectionCondition.sizeGreaterThan(0))
-        .forEach(item -> gridItemList.add(new BrokersList.BrokerGridItem(item)));
+        .forEach(item -> gridItemList.add(new BrokersGridItem(item)));
     return gridItemList;
   }
 
   @Step
-  public BrokerGridItem getBrokerItem(int id) {
+  public BrokersGridItem getBroker(int id) {
     return initGridItems().stream()
         .filter(e -> e.getId() == id)
         .findFirst().orElseThrow();
   }
 
   @Step
-  public List<BrokerGridItem> getAllBrokers() {
+  public List<BrokersGridItem> getAllBrokers() {
     return initGridItems();
   }
 
-  public static class BrokerGridItem extends BasePage {
+  public static class BrokersGridItem extends BasePage {
 
     private final SelenideElement element;
 
-    public BrokerGridItem(SelenideElement element) {
+    public BrokersGridItem(SelenideElement element) {
       this.element = element;
     }
 
diff --git a/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/topics/TopicDetails.java b/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/topics/TopicDetails.java
index b7d03dcf3a7..8341450c6cb 100644
--- a/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/topics/TopicDetails.java
+++ b/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/topics/TopicDetails.java
@@ -186,7 +186,7 @@ public TopicDetails clickMessagesAddFiltersBtn() {
 
   @Step
   public TopicDetails clickNextButton() {
-    nextBtn.shouldBe(Condition.enabled).click();
+    clickNextBtn();
     waitUntilSpinnerDisappear();
     return this;
   }
diff --git a/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/topics/TopicsList.java b/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/topics/TopicsList.java
index 184178423d4..c3ef098ff0f 100644
--- a/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/topics/TopicsList.java
+++ b/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/topics/TopicsList.java
@@ -68,6 +68,17 @@ public TopicsList setShowInternalRadioButton(boolean select) {
     return this;
   }
 
+  @Step
+  public TopicsList goToLastPage() {
+    if (nextBtn.exists()) {
+      while (nextBtn.isEnabled()) {
+        clickNextBtn();
+        waitUntilSpinnerDisappear(1);
+      }
+    }
+    return this;
+  }
+
   @Step
   public TopicsList openTopic(String topicName) {
     getTopicItem(topicName).openItem();


Test patch:
diff --git a/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/manualsuite/backlog/SmokeBacklog.java b/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/manualsuite/backlog/SmokeBacklog.java
index 593cb82c65d..f96be5deecc 100644
--- a/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/manualsuite/backlog/SmokeBacklog.java
+++ b/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/manualsuite/backlog/SmokeBacklog.java
@@ -15,94 +15,87 @@
 
 public class SmokeBacklog extends BaseManualTest {
 
-  @Automation(state = TO_BE_AUTOMATED)
-  @Suite(id = BROKERS_SUITE_ID)
-  @QaseId(330)
-  @Test
-  public void testCaseA() {
-  }
-
   @Automation(state = TO_BE_AUTOMATED)
   @Suite(id = BROKERS_SUITE_ID)
   @QaseId(331)
   @Test
-  public void testCaseB() {
+  public void testCaseA() {
   }
 
   @Automation(state = TO_BE_AUTOMATED)
   @Suite(id = BROKERS_SUITE_ID)
   @QaseId(332)
   @Test
-  public void testCaseC() {
+  public void testCaseB() {
   }
 
   @Automation(state = TO_BE_AUTOMATED)
   @Suite(id = TOPICS_PROFILE_SUITE_ID)
   @QaseId(335)
   @Test
-  public void testCaseD() {
+  public void testCaseC() {
   }
 
   @Automation(state = TO_BE_AUTOMATED)
   @Suite(id = TOPICS_PROFILE_SUITE_ID)
   @QaseId(336)
   @Test
-  public void testCaseE() {
+  public void testCaseD() {
   }
 
   @Automation(state = TO_BE_AUTOMATED)
   @Suite(id = TOPICS_PROFILE_SUITE_ID)
   @QaseId(343)
   @Test
-  public void testCaseF() {
+  public void testCaseE() {
   }
 
   @Automation(state = TO_BE_AUTOMATED)
   @Suite(id = SCHEMAS_SUITE_ID)
   @QaseId(345)
   @Test
-  public void testCaseG() {
+  public void testCaseF() {
   }
 
   @Automation(state = TO_BE_AUTOMATED)
   @Suite(id = SCHEMAS_SUITE_ID)
   @QaseId(346)
   @Test
-  public void testCaseH() {
+  public void testCaseG() {
   }
 
   @Automation(state = TO_BE_AUTOMATED)
   @Suite(id = TOPICS_PROFILE_SUITE_ID)
   @QaseId(347)
   @Test
-  public void testCaseI() {
+  public void testCaseH() {
   }
 
   @Automation(state = TO_BE_AUTOMATED)
   @Suite(id = BROKERS_SUITE_ID)
   @QaseId(348)
   @Test
-  public void testCaseJ() {
+  public void testCaseI() {
   }
 
   @Automation(state = TO_BE_AUTOMATED)
   @Suite(id = BROKERS_SUITE_ID)
   @QaseId(350)
   @Test
-  public void testCaseK() {
+  public void testCaseJ() {
   }
 
   @Automation(state = NOT_AUTOMATED)
   @Suite(id = TOPICS_SUITE_ID)
   @QaseId(50)
   @Test
-  public void testCaseL() {
+  public void testCaseK() {
   }
 
   @Automation(state = NOT_AUTOMATED)
   @Suite(id = SCHEMAS_SUITE_ID)
   @QaseId(351)
   @Test
-  public void testCaseM() {
+  public void testCaseL() {
   }
 }
diff --git a/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/smokesuite/brokers/BrokersTest.java b/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/smokesuite/brokers/BrokersTest.java
index 8fd1ffde159..b58e0f678c3 100644
--- a/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/smokesuite/brokers/BrokersTest.java
+++ b/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/smokesuite/brokers/BrokersTest.java
@@ -4,12 +4,17 @@
 
 import com.codeborne.selenide.Condition;
 import com.provectus.kafka.ui.BaseTest;
+import com.provectus.kafka.ui.pages.brokers.BrokersConfigTab;
+import io.qameta.allure.Issue;
 import io.qase.api.annotation.QaseId;
 import org.testng.Assert;
+import org.testng.annotations.Ignore;
 import org.testng.annotations.Test;
 
 public class BrokersTest extends BaseTest {
 
+  public static final int DEFAULT_BROKER_ID = 1;
+
   @QaseId(1)
   @Test
   public void checkBrokersOverview() {
@@ -25,7 +30,7 @@ public void checkExistingBrokersInCluster() {
     navigateToBrokers();
     Assert.assertTrue(brokersList.getAllBrokers().size() > 0, "getAllBrokers()");
     brokersList
-        .openBroker(1);
+        .openBroker(DEFAULT_BROKER_ID);
     brokersDetails
         .waitUntilScreenReady();
     verifyElementsCondition(brokersDetails.getAllVisibleElements(), Condition.visible);
@@ -38,4 +43,30 @@ public void checkExistingBrokersInCluster() {
     verifyElementsCondition(brokersConfigTab.getEditButtons(), Condition.enabled);
     Assert.assertTrue(brokersConfigTab.isSearchByKeyVisible(), "isSearchByKeyVisible()");
   }
+
+  @Ignore
+  @Issue("https://github.com/provectus/kafka-ui/issues/3347")
+  @QaseId(330)
+  @Test
+  public void brokersConfigSearchCheck() {
+    navigateToBrokersAndOpenDetails(DEFAULT_BROKER_ID);
+    brokersDetails
+        .openDetailsTab(CONFIGS);
+    String anyConfigKey = brokersConfigTab
+        .getAllConfigs().stream()
+        .findAny().orElseThrow()
+        .getKey();
+    brokersConfigTab
+        .clickNextButton();
+    Assert.assertFalse(brokersConfigTab.getAllConfigs().stream()
+            .map(BrokersConfigTab.BrokersConfigItem::getKey)
+            .toList().contains(anyConfigKey),
+        String.format("getAllConfigs().contains(%s)", anyConfigKey));
+    brokersConfigTab
+        .searchConfig(anyConfigKey);
+    Assert.assertTrue(brokersConfigTab.getAllConfigs().stream()
+            .map(BrokersConfigTab.BrokersConfigItem::getKey)
+            .toList().contains(anyConfigKey),
+        String.format("getAllConfigs().contains(%s)", anyConfigKey));
+  }
 }
diff --git a/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/smokesuite/topics/TopicsTest.java b/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/smokesuite/topics/TopicsTest.java
index bad6a9fcde0..f9e79b0a723 100644
--- a/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/smokesuite/topics/TopicsTest.java
+++ b/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/smokesuite/topics/TopicsTest.java
@@ -365,12 +365,13 @@ public void checkShowInternalTopicsButton() {
     navigateToTopics();
     topicsList
         .setShowInternalRadioButton(true);
-    SoftAssert softly = new SoftAssert();
-    softly.assertTrue(topicsList.getInternalTopics().size() > 0, "getInternalTopics()");
-    softly.assertTrue(topicsList.getNonInternalTopics().size() > 0, "getNonInternalTopics()");
-    softly.assertAll();
+    Assert.assertTrue(topicsList.getInternalTopics().size() > 0, "getInternalTopics()");
+    topicsList
+        .goToLastPage();
+    Assert.assertTrue(topicsList.getNonInternalTopics().size() > 0, "getNonInternalTopics()");
     topicsList
         .setShowInternalRadioButton(false);
+    SoftAssert softly = new SoftAssert();
     softly.assertEquals(topicsList.getInternalTopics().size(), 0, "getInternalTopics()");
     softly.assertTrue(topicsList.getNonInternalTopics().size() > 0, "getNonInternalTopics()");
     softly.assertAll();