Repository: provectus/kafka-ui
Issue: [e2e]Checking the URL redirections for kafka-ui pages
Labels: scope/QA
scope/AQA

Autotest implementation for:

https://app.qase.io/case/KAFKAUI-45
Description
Purpose of this case is to make sure that all the redirections are right.

Steps: 
- Login to kafka-ui
- Press Brokers
- Press Topics
- Press Consumers
- Press Schema Registry
- Press Kafka Connect
- Press KSQL DB

Expexted result:
- Should redirect to https://www.kafka-ui.provectus.io/
- Should redirect to https://www.kafka-ui.provectus.io/ui/clusters/local/brokers
- Should redirect to https://www.kafka-ui.provectus.io/ui/clusters/local/all-topics?perPage=25
- Should redirect to https://www.kafka-ui.provectus.io/ui/clusters/local/consumer-groups
- Should redirect to https://www.kafka-ui.provectus.io/ui/clusters/local/schemas
- Should redirect to https://www.kafka-ui.provectus.io/ui/clusters/local/connectors
- Should redirect to https://www.kafka-ui.provectus.io/ui/clusters/local/ksqldb/tables




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/consumers/ConsumersList.java b/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/consumers/ConsumersList.java
index b3a3be42a21..6d0c1d48f73 100644
--- a/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/consumers/ConsumersList.java
+++ b/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/consumers/ConsumersList.java
@@ -1,11 +1,20 @@
 package com.provectus.kafka.ui.pages.consumers;
 
+import com.codeborne.selenide.Condition;
 import com.codeborne.selenide.SelenideElement;
 import com.provectus.kafka.ui.pages.BasePage;
+import io.qameta.allure.Step;
 
 import static com.codeborne.selenide.Selenide.$x;
 
 public class ConsumersList extends BasePage {
 
     protected SelenideElement consumerListHeader = $x("//h1[text()='Consumers']");
+    
+    @Step
+    public ConsumersList waitUntilScreenReady() {
+        waitUntilSpinnerDisappear();
+        consumerListHeader.shouldHave(Condition.visible);
+        return this;
+    }
 }
diff --git a/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/variables/Url.java b/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/variables/Url.java
new file mode 100644
index 00000000000..f612d743a5c
--- /dev/null
+++ b/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/variables/Url.java
@@ -0,0 +1,11 @@
+package com.provectus.kafka.ui.variables;
+
+public interface Url {
+    
+    String BROKERS_LIST_URL = "http://%s:8080/ui/clusters/local/brokers";
+    String TOPICS_LIST_URL = "http://%s:8080/ui/clusters/local/all-topics?perPage=25";
+    String CONSUMERS_LIST_URL = "http://%s:8080/ui/clusters/local/consumer-groups";
+    String SCHEMA_REGISTRY_LIST_URL = "http://%s:8080/ui/clusters/local/schemas";
+    String KAFKA_CONNECT_LIST_URL = "http://%s:8080/ui/clusters/local/connectors";
+    String KSQL_DB_LIST_URL = "http://%s:8080/ui/clusters/local/ksqldb/tables";
+}


Test patch:
diff --git a/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/BaseTest.java b/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/BaseTest.java
index 399f81e1aa2..b2e7e007e58 100644
--- a/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/BaseTest.java
+++ b/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/BaseTest.java
@@ -22,7 +22,7 @@
 import java.time.Duration;
 import java.util.List;
 
-import static com.provectus.kafka.ui.pages.NaviSideBar.SideMenuOption.TOPICS;
+import static com.provectus.kafka.ui.pages.NaviSideBar.SideMenuOption.*;
 import static com.provectus.kafka.ui.settings.BaseSource.*;
 import static com.provectus.kafka.ui.settings.drivers.LocalWebDriver.*;
 import static com.provectus.kafka.ui.utilities.qaseUtils.QaseSetup.qaseIntegrationSetup;
@@ -108,6 +108,14 @@ public void beforeMethod() {
     public void afterMethod() {
         browserClear();
     }
+    
+    @Step
+    protected void navigateToBrokers() {
+        naviSideBar
+                .openSideMenu(BROKERS);
+        brokersList
+                .waitUntilScreenReady();
+    }
 
     @Step
     protected void navigateToTopics() {
@@ -127,7 +135,57 @@ protected void navigateToTopicsAndOpenDetails(String topicName) {
         topicDetails
                 .waitUntilScreenReady();
     }
-
+    
+    @Step
+    protected void navigateToConsumers() {
+        naviSideBar
+                .openSideMenu(CONSUMERS);
+        consumersList
+                .waitUntilScreenReady();
+    }
+    
+    @Step
+    protected void navigateToSchemaRegistry() {
+        naviSideBar
+                .openSideMenu(SCHEMA_REGISTRY);
+        schemaRegistryList
+                .waitUntilScreenReady();
+    }
+    
+    @Step
+    protected void navigateToSchemaRegistryAndOpenDetails(String schemaName) {
+        navigateToSchemaRegistry();
+        schemaRegistryList
+                .openSchema(schemaName);
+        schemaDetails
+                .waitUntilScreenReady();
+    }
+    
+    @Step
+    protected void navigateToConnectors() {
+        naviSideBar
+                .openSideMenu(KAFKA_CONNECT);
+        kafkaConnectList
+                .waitUntilScreenReady();
+    }
+    
+    @Step
+    protected void navigateToConnectorsAndOpenDetails(String connectorName) {
+        navigateToConnectors();
+        kafkaConnectList
+                .openConnector(connectorName);
+        connectorDetails
+                .waitUntilScreenReady();
+    }
+    
+    @Step
+    protected void navigateToKsqlDb() {
+        naviSideBar
+                .openSideMenu(KSQL_DB);
+        ksqlDbList
+                .waitUntilScreenReady();
+    }
+    
     @Step
     protected void verifyElementsCondition(List<SelenideElement> elementList, Condition expectedCondition) {
         SoftAssert softly = new SoftAssert();
diff --git a/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/manualSuite/suite/TopicsTest.java b/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/manualSuite/suite/TopicsTest.java
index d768f939ce0..35188e3f45e 100644
--- a/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/manualSuite/suite/TopicsTest.java
+++ b/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/manualSuite/suite/TopicsTest.java
@@ -21,75 +21,81 @@ public void testCaseA() {
     public void testCaseB() {
     }
 
+    @Automation(state = NOT_AUTOMATED)
+    @QaseId(21)
+    @Test()
+    public void testCaseC() {
+    }
+
     @Automation(state = NOT_AUTOMATED)
     @QaseId(22)
     @Test
-    public void testCaseC() {
+    public void testCaseD() {
     }
 
     @Automation(state = NOT_AUTOMATED)
     @QaseId(46)
     @Test
-    public void testCaseD() {
+    public void testCaseE() {
     }
 
     @Automation(state = NOT_AUTOMATED)
     @QaseId(47)
     @Test
-    public void testCaseE() {
+    public void testCaseF() {
     }
 
     @Automation(state = NOT_AUTOMATED)
     @QaseId(48)
     @Test
-    public void testCaseF() {
+    public void testCaseG() {
     }
 
     @Automation(state = NOT_AUTOMATED)
     @QaseId(49)
     @Test
-    public void testCaseG() {
+    public void testCaseH() {
     }
 
     @Automation(state = NOT_AUTOMATED)
     @QaseId(50)
     @Test
-    public void testCaseH() {
+    public void testCaseI() {
     }
 
     @Automation(state = NOT_AUTOMATED)
     @QaseId(57)
     @Test
-    public void testCaseI() {
+    public void testCaseJ() {
     }
 
     @Automation(state = NOT_AUTOMATED)
     @QaseId(58)
     @Test
-    public void testCaseJ() {
+    public void testCaseK() {
     }
 
     @Automation(state = NOT_AUTOMATED)
     @QaseId(269)
     @Test
-    public void testCaseK() {
+    public void testCaseL() {
     }
 
     @Automation(state = NOT_AUTOMATED)
     @QaseId(270)
     @Test
-    public void testCaseL() {
+    public void testCaseM() {
     }
 
     @Automation(state = NOT_AUTOMATED)
     @QaseId(271)
     @Test
-    public void testCaseM() {
+    public void testCaseN() {
     }
 
     @Automation(state = NOT_AUTOMATED)
     @QaseId(272)
     @Test
-    public void testCaseN() {
+    public void testCaseO() {
     }
 }
diff --git a/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/smokeSuite/SmokeTest.java b/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/smokeSuite/SmokeTest.java
index a0c4f05da23..0ea5d2eb827 100644
--- a/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/smokeSuite/SmokeTest.java
+++ b/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/smokeSuite/SmokeTest.java
@@ -1,13 +1,20 @@
 package com.provectus.kafka.ui.smokeSuite;
 
 import com.codeborne.selenide.Condition;
+import com.codeborne.selenide.WebDriverRunner;
 import com.provectus.kafka.ui.BaseTest;
+import io.qameta.allure.Step;
 import io.qase.api.annotation.QaseId;
+import org.testng.Assert;
 import org.testng.annotations.Test;
 
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
+import static com.provectus.kafka.ui.settings.BaseSource.BROWSER;
+import static com.provectus.kafka.ui.variables.Browser.LOCAL;
+import static com.provectus.kafka.ui.variables.Url.*;
+
 public class SmokeTest extends BaseTest {
 
     @QaseId(198)
@@ -20,4 +27,28 @@ public void checkBasePageElements() {
                 Stream.concat(topPanel.getAllEnabledElements().stream(), naviSideBar.getAllMenuButtons().stream())
                         .collect(Collectors.toList()), Condition.enabled);
     }
+
+    @QaseId(45)
+    @Test
+    public void checkUrlWhileNavigating() {
+        navigateToBrokers();
+        verifyCurrentUrl(BROKERS_LIST_URL);
+        navigateToTopics();
+        verifyCurrentUrl(TOPICS_LIST_URL);
+        navigateToConsumers();
+        verifyCurrentUrl(CONSUMERS_LIST_URL);
+        navigateToSchemaRegistry();
+        verifyCurrentUrl(SCHEMA_REGISTRY_LIST_URL);
+        navigateToConnectors();
+        verifyCurrentUrl(KAFKA_CONNECT_LIST_URL);
+        navigateToKsqlDb();
+        verifyCurrentUrl(KSQL_DB_LIST_URL);
+    }
+
+    @Step
+    private void verifyCurrentUrl(String expectedUrl) {
+        String host = BROWSER.equals(LOCAL) ? "localhost" : "host.testcontainers.internal";
+        Assert.assertEquals(WebDriverRunner.getWebDriver().getCurrentUrl(),
+                String.format(expectedUrl, host), "getCurrentUrl()");
+    }
 }
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 7b11aa6556c..c9029e30ae5 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
@@ -2,12 +2,10 @@
 
 import com.codeborne.selenide.Condition;
 import com.provectus.kafka.ui.BaseTest;
-import io.qameta.allure.Step;
 import io.qase.api.annotation.QaseId;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
-import static com.provectus.kafka.ui.pages.NaviSideBar.SideMenuOption.BROKERS;
 import static com.provectus.kafka.ui.pages.brokers.BrokersDetails.DetailsTab.CONFIGS;
 
 public class BrokersTest extends BaseTest {
@@ -40,12 +38,4 @@ public void checkExistingBrokersInCluster() {
         verifyElementsCondition(brokersConfigTab.getEditButtons(), Condition.enabled);
         Assert.assertTrue(brokersConfigTab.isSearchByKeyVisible(), "isSearchByKeyVisible()");
     }
-
-    @Step
-    private void navigateToBrokers() {
-        naviSideBar
-                .openSideMenu(BROKERS);
-        brokersList
-                .waitUntilScreenReady();
-    }
 }
diff --git a/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/smokeSuite/connectors/ConnectorsTest.java b/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/smokeSuite/connectors/ConnectorsTest.java
index 5291648014e..c54138d8c5a 100644
--- a/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/smokeSuite/connectors/ConnectorsTest.java
+++ b/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/smokeSuite/connectors/ConnectorsTest.java
@@ -3,7 +3,6 @@
 import com.provectus.kafka.ui.BaseTest;
 import com.provectus.kafka.ui.models.Connector;
 import com.provectus.kafka.ui.models.Topic;
-import io.qameta.allure.Step;
 import io.qase.api.annotation.QaseId;
 import org.testng.Assert;
 import org.testng.annotations.AfterClass;
@@ -14,7 +13,6 @@
 import java.util.List;
 
 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.utilities.FileUtils.getResourceAsString;
 import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic;
 
@@ -107,21 +105,4 @@ public void afterClass() {
                 apiService.deleteConnector(CONNECT_NAME, connector.getName()));
         TOPIC_LIST.forEach(topic -> apiService.deleteTopic(topic.getName()));
     }
-
-    @Step
-    private void navigateToConnectors() {
-        naviSideBar
-                .openSideMenu(KAFKA_CONNECT);
-        kafkaConnectList
-                .waitUntilScreenReady();
-    }
-
-    @Step
-    private void navigateToConnectorsAndOpenDetails(String connectorName) {
-        navigateToConnectors();
-        kafkaConnectList
-                .openConnector(connectorName);
-        connectorDetails
-                .waitUntilScreenReady();
-    }
 }
diff --git a/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/smokeSuite/ksqlDb/KsqlDbTest.java b/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/smokeSuite/ksqlDb/KsqlDbTest.java
index 3627f321df6..ab1705922a1 100644
--- a/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/smokeSuite/ksqlDb/KsqlDbTest.java
+++ b/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/smokeSuite/ksqlDb/KsqlDbTest.java
@@ -8,7 +8,6 @@
 import org.testng.annotations.Test;
 import org.testng.asserts.SoftAssert;
 
-import static com.provectus.kafka.ui.pages.NaviSideBar.SideMenuOption.KSQL_DB;
 import static com.provectus.kafka.ui.pages.ksqlDb.enums.KsqlQueryConfig.SHOW_TABLES;
 import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic;
 
@@ -34,10 +33,8 @@ public void beforeClass() {
     @QaseId(41)
     @Test(priority = 1)
     public void checkShowTablesRequestExecution() {
-        naviSideBar
-                .openSideMenu(KSQL_DB);
+        navigateToKsqlDb();
         ksqlDbList
-                .waitUntilScreenReady()
                 .clickExecuteKsqlRequestBtn();
         ksqlQueryForm
                 .waitUntilScreenReady()
@@ -53,10 +50,8 @@ public void checkShowTablesRequestExecution() {
     @QaseId(86)
     @Test(priority = 2)
     public void clearResultsForExecutedRequest() {
-        naviSideBar
-                .openSideMenu(KSQL_DB);
+        navigateToKsqlDb();
         ksqlDbList
-                .waitUntilScreenReady()
                 .clickExecuteKsqlRequestBtn();
         ksqlQueryForm
                 .waitUntilScreenReady()
diff --git a/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/smokeSuite/schemas/SchemasTest.java b/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/smokeSuite/schemas/SchemasTest.java
index 56ff2c0ff04..bc9519ee500 100644
--- a/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/smokeSuite/schemas/SchemasTest.java
+++ b/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/smokeSuite/schemas/SchemasTest.java
@@ -4,7 +4,6 @@
 import com.provectus.kafka.ui.BaseTest;
 import com.provectus.kafka.ui.api.model.CompatibilityLevel;
 import com.provectus.kafka.ui.models.Schema;
-import io.qameta.allure.Step;
 import io.qase.api.annotation.QaseId;
 import org.testng.Assert;
 import org.testng.annotations.AfterClass;
@@ -15,7 +14,6 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import static com.provectus.kafka.ui.pages.NaviSideBar.SideMenuOption.SCHEMA_REGISTRY;
 import static com.provectus.kafka.ui.utilities.FileUtils.fileToString;
 
 public class SchemasTest extends BaseTest {
@@ -188,21 +186,4 @@ public void deleteSchemaProtobuf() {
     public void afterClass() {
         SCHEMA_LIST.forEach(schema -> apiService.deleteSchema(schema.getName()));
     }
-
-    @Step
-    private void navigateToSchemaRegistry() {
-        naviSideBar
-                .openSideMenu(SCHEMA_REGISTRY);
-        schemaRegistryList
-                .waitUntilScreenReady();
-    }
-
-    @Step
-    private void navigateToSchemaRegistryAndOpenDetails(String schemaName) {
-        navigateToSchemaRegistry();
-        schemaRegistryList
-                .openSchema(schemaName);
-        schemaDetails
-                .waitUntilScreenReady();
-    }
 }
diff --git a/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/smokeSuite/topics/MessagesTest.java b/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/smokeSuite/topics/MessagesTest.java
index 9f8d18b6855..dc7fc403c82 100644
--- a/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/smokeSuite/topics/MessagesTest.java
+++ b/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/smokeSuite/topics/MessagesTest.java
@@ -147,21 +147,6 @@ public void checkPurgeMessagePossibility() {
         softly.assertAll();
     }
 
-    @Ignore
-    @Issue("https://github.com/provectus/kafka-ui/issues/2819")
-    @QaseId(21)
-    @Test(priority = 5)
-    public void copyMessageFromTopicProfile() {
-        navigateToTopicsAndOpenDetails(TOPIC_FOR_CHECK_FILTERS.getName());
-        topicDetails
-                .openDetailsTab(MESSAGES)
-                .getRandomMessage()
-                .openDotMenu()
-                .clickCopyToClipBoard();
-        Assert.assertTrue(topicDetails.isAlertWithMessageVisible(SUCCESS, "Copied successfully!"),
-                "isAlertWithMessageVisible()");
-    }
-
     @Ignore
     @Issue("https://github.com/provectus/kafka-ui/issues/2394")
     @QaseId(15)