Repository: provectus/kafka-ui
Issue: [e2e] create object models and implement them into tests
Labels: type/enhancement
scope/QA
status/accepted

need to create 'models' package in java/
create class with regarding name for used objects in framework, for example User.class or Topic.class
using lombok library need to create related options for objects

Issue comments:

Pull request review comments:
is this additional line needed? why we can't call this instance inside the lambda?
why did we add this step?
the goal of this PR is to make test interact with objects. why did you leave constants like this?
is that topic or topic name? i've asked you to refactor naming or create objects here
is this instance really message?? here we also have an discussion
Refactored
Deleted this step
Refactored
Done 
discuss and refactored 

Patch that resolved the issue:
diff --git a/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/helpers/ApiHelper.java b/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/helpers/ApiHelper.java
index 62d8477fc0b..b094a243a8f 100644
--- a/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/helpers/ApiHelper.java
+++ b/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/helpers/ApiHelper.java
@@ -6,7 +6,13 @@
 import com.provectus.kafka.ui.api.api.MessagesApi;
 import com.provectus.kafka.ui.api.api.SchemasApi;
 import com.provectus.kafka.ui.api.api.TopicsApi;
-import com.provectus.kafka.ui.api.model.*;
+import com.provectus.kafka.ui.api.model.CreateTopicMessage;
+import com.provectus.kafka.ui.api.model.NewConnector;
+import com.provectus.kafka.ui.api.model.NewSchemaSubject;
+import com.provectus.kafka.ui.api.model.TopicCreation;
+import com.provectus.kafka.ui.models.Connector;
+import com.provectus.kafka.ui.models.Schema;
+import com.provectus.kafka.ui.models.Topic;
 import lombok.SneakyThrows;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.reactive.function.client.WebClientResponseException;
@@ -15,6 +21,7 @@
 import java.util.Map;
 
 import static com.codeborne.selenide.Selenide.sleep;
+import static com.provectus.kafka.ui.extensions.FileUtils.fileToString;
 
 
 @Slf4j
@@ -67,11 +74,11 @@ public void deleteTopic(String clusterName, String topicName) {
     }
 
     @SneakyThrows
-    public void createSchema(String clusterName, String schemaName, SchemaType type, String schemaValue) {
+    public void createSchema(String clusterName, Schema schema) {
         NewSchemaSubject schemaSubject = new NewSchemaSubject();
-        schemaSubject.setSubject(schemaName);
-        schemaSubject.setSchema(schemaValue);
-        schemaSubject.setSchemaType(type);
+        schemaSubject.setSubject(schema.getName());
+        schemaSubject.setSchema(fileToString(schema.getValuePath()));
+        schemaSubject.setSchemaType(schema.getType());
         try {
             schemaApi().createNewSchema(clusterName, schemaSubject).block();
         } catch (WebClientResponseException ex) {
@@ -96,16 +103,16 @@ public void deleteConnector(String clusterName, String connectName, String conne
     }
 
     @SneakyThrows
-    public void createConnector(String clusterName, String connectName, String connectorName, String configJson) {
-        NewConnector connector = new NewConnector();
-        connector.setName(connectorName);
-        Map<String, Object> configMap = new ObjectMapper().readValue(configJson, HashMap.class);
-        connector.setConfig(configMap);
+    public 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);
+        connectorProperties.setConfig(configMap);
         try {
-            connectorApi().deleteConnector(clusterName, connectName, connectorName).block();
+            connectorApi().deleteConnector(clusterName, connectName, connector.getName()).block();
         } catch (WebClientResponseException ignored) {
         }
-        connectorApi().createConnector(clusterName, connectName, connector).block();
+        connectorApi().createConnector(clusterName, connectName, connectorProperties).block();
     }
 
     public String getFirstConnectName(String clusterName) {
@@ -113,14 +120,13 @@ public String getFirstConnectName(String clusterName) {
     }
 
     @SneakyThrows
-    public void sendMessage(String clusterName, String topicName, String messageContentJson,
-                            String messageKey) {
+    public void sendMessage(String clusterName, Topic topic) {
         CreateTopicMessage createMessage = new CreateTopicMessage();
         createMessage.partition(0);
-        createMessage.setContent(messageContentJson);
-        createMessage.setKey(messageKey);
+        createMessage.setContent(topic.getMessageContent());
+        createMessage.setKey(topic.getMessageKey());
         try {
-            messageApi().sendTopicMessages(clusterName, topicName, createMessage).block();
+            messageApi().sendTopicMessages(clusterName, topic.getName(), createMessage).block();
         } catch (WebClientResponseException ex) {
             ex.getRawStatusCode();
         }
diff --git a/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/models/Connector.java b/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/models/Connector.java
new file mode 100644
index 00000000000..9e30ba9f196
--- /dev/null
+++ b/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/models/Connector.java
@@ -0,0 +1,12 @@
+package com.provectus.kafka.ui.models;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+@Data
+@Accessors(chain = true)
+public class Connector {
+
+    private String name, config;
+
+}
diff --git a/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/models/Schema.java b/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/models/Schema.java
new file mode 100644
index 00000000000..8097c2e7d72
--- /dev/null
+++ b/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/models/Schema.java
@@ -0,0 +1,33 @@
+package com.provectus.kafka.ui.models;
+
+import com.provectus.kafka.ui.api.model.SchemaType;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import static org.apache.commons.lang.RandomStringUtils.randomAlphabetic;
+
+@Data
+@Accessors(chain = true)
+public class Schema {
+
+    private String name,valuePath;
+    private SchemaType type;
+
+    public static Schema createSchemaAvro(){
+        return new Schema().setName(randomAlphabetic(10))
+                .setType(SchemaType.AVRO)
+                .setValuePath(System.getProperty("user.dir") + "/src/main/resources/testData/schema_avro_value.json");
+    }
+
+    public static Schema createSchemaJson(){
+        return new Schema().setName(randomAlphabetic(10))
+                .setType(SchemaType.JSON)
+                .setValuePath(System.getProperty("user.dir") + "/src/main/resources/testData/schema_Json_Value.json");
+    }
+
+    public static Schema createSchemaProtobuf(){
+        return new Schema().setName(randomAlphabetic(10))
+                .setType(SchemaType.PROTOBUF)
+                .setValuePath(System.getProperty("user.dir") + "/src/main/resources/testData/schema_protobuf_value.txt");
+    }
+}
diff --git a/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/models/Topic.java b/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/models/Topic.java
new file mode 100644
index 00000000000..725db0dd8dd
--- /dev/null
+++ b/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/models/Topic.java
@@ -0,0 +1,10 @@
+package com.provectus.kafka.ui.models;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+@Data
+@Accessors(chain = true)
+public class Topic {
+    private String name, compactPolicyValue, timeToRetainData, maxSizeOnDisk, maxMessageBytes, messageKey, messageContent ;
+}
diff --git a/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/schema/SchemaCreateView.java b/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/schema/SchemaCreateView.java
index 11940326f42..c41153bbdb4 100644
--- a/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/schema/SchemaCreateView.java
+++ b/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/schema/SchemaCreateView.java
@@ -1,6 +1,7 @@
 package com.provectus.kafka.ui.pages.schema;
 
 import com.codeborne.selenide.SelenideElement;
+import com.provectus.kafka.ui.api.model.SchemaType;
 import com.provectus.kafka.ui.utils.BrowserUtils;
 import io.qameta.allure.Step;
 import org.openqa.selenium.By;
@@ -34,19 +35,4 @@ public SchemaCreateView setSchemaField(String text) {
         schemaField.setValue(text);
         return this;
     }
-
-    public enum SchemaType {
-        AVRO("AVRO"),
-        JSON("JSON"),
-        PROTOBUF("PROTOBUF");
-
-        final String value;
-
-        SchemaType(String value) {
-            this.value = value;
-        }
-        public String getValue(){
-            return value;
-        }
-    }
 }
diff --git a/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/schema/SchemaEditView.java b/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/schema/SchemaEditView.java
index 716e7ef80c1..9e853908e5f 100644
--- a/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/schema/SchemaEditView.java
+++ b/kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/schema/SchemaEditView.java
@@ -4,6 +4,7 @@
 import com.codeborne.selenide.Selenide;
 import com.codeborne.selenide.SelenideElement;
 import com.provectus.kafka.ui.api.model.CompatibilityLevel;
+import com.provectus.kafka.ui.api.model.SchemaType;
 import com.provectus.kafka.ui.utils.BrowserUtils;
 import io.qameta.allure.Step;
 import org.openqa.selenium.By;
@@ -18,7 +19,7 @@ public class SchemaEditView {
     protected SelenideElement schemaTypeDropDown = $x("//ul[@name='schemaType']");
 
     @Step
-    public SchemaEditView selectSchemaTypeFromDropdown(SchemaCreateView.SchemaType schemaType) {
+    public SchemaEditView selectSchemaTypeFromDropdown(SchemaType schemaType) {
         $x("//ul[@name='schemaType']").click();
         $x("//li[text()='" + schemaType.getValue() + "']").click();
         return this;


Test patch:
diff --git a/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/tests/ConnectorsTests.java b/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/tests/ConnectorsTests.java
index 5f11151c8b0..19682d4be0c 100644
--- a/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/tests/ConnectorsTests.java
+++ b/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/tests/ConnectorsTests.java
@@ -1,8 +1,9 @@
 package com.provectus.kafka.ui.tests;
 
 import com.provectus.kafka.ui.base.BaseTest;
-import com.provectus.kafka.ui.helpers.ApiHelper;
 import com.provectus.kafka.ui.helpers.Helpers;
+import com.provectus.kafka.ui.models.Connector;
+import com.provectus.kafka.ui.models.Topic;
 import com.provectus.kafka.ui.utils.qaseIO.Status;
 import com.provectus.kafka.ui.utils.qaseIO.annotation.AutomationStatus;
 import com.provectus.kafka.ui.utils.qaseIO.annotation.Suite;
@@ -12,98 +13,102 @@
 import org.junit.jupiter.api.DisplayName;
 import org.junit.jupiter.api.Test;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import static com.provectus.kafka.ui.extensions.FileUtils.getResourceAsString;
 
 public class ConnectorsTests extends BaseTest {
-
-    private final long suiteId = 10;
-    private final String suiteTitle = "Kafka Connect";
-    public static final String SINK_CONNECTOR = "sink_postgres_activities_e2e_checks";
-    public static final String TOPIC_FOR_CONNECTOR = "topic_for_connector";
-    public static final String TOPIC_FOR_DELETE_CONNECTOR = "topic_for_delete_connector";
-    public static final String TOPIC_FOR_UPDATE_CONNECTOR = "topic_for_update_connector";
-    public static final String FIRST_CONNECTOR = "first";
-    public static final String CONNECTOR_FOR_DELETE = "sink_postgres_activities_e2e_checks_for_delete";
-    public static final String CONNECTOR_FOR_UPDATE = "sink_postgres_activities_e2e_checks_for_update";
+    private static final long SUITE_ID = 10;
+    private static final String SUITE_TITLE = "Kafka Connect";
+    private static final String CONNECT_NAME = "first";
+    private static final List<Topic> TOPIC_LIST = new ArrayList<>();
+    private static final List<Connector> CONNECTOR_LIST = new ArrayList<>();
+    private static final String MESSAGE_CONTENT = "message_content_create_topic.json";
+    private static final String MESSAGE_KEY = " ";
+    private static final Topic TOPIC_FOR_CREATE = new Topic()
+            .setName("topic_for_create_connector")
+            .setMessageContent(MESSAGE_CONTENT).setMessageKey(MESSAGE_KEY);
+    private static final Topic TOPIC_FOR_DELETE = new Topic()
+            .setName("topic_for_delete_connector")
+            .setMessageContent(MESSAGE_CONTENT).setMessageKey(MESSAGE_KEY);
+    private static final Topic TOPIC_FOR_UPDATE = new Topic()
+            .setName("topic_for_update_connector")
+            .setMessageContent(MESSAGE_CONTENT).setMessageKey(MESSAGE_KEY);
+    private static final Connector CONNECTOR_FOR_DELETE = new Connector()
+            .setName("sink_postgres_activities_e2e_checks_for_delete")
+            .setConfig(getResourceAsString("delete_connector_config.json"));
+    private static final Connector CONNECTOR_FOR_UPDATE = new Connector()
+            .setName("sink_postgres_activities_e2e_checks_for_update")
+            .setConfig(getResourceAsString("config_for_create_connector_via_api.json"));
 
     @BeforeAll
     public static void beforeAll() {
-        ApiHelper apiHelper = Helpers.INSTANCE.apiHelper;
-
-        String connectorToDelete = getResourceAsString("delete_connector_config.json");
-        String connectorToUpdate = getResourceAsString("config_for_create_connector_via_api.json");
-        String message = getResourceAsString("message_content_create_topic.json");
-
-        apiHelper.deleteTopic(CLUSTER_NAME, CONNECTOR_FOR_DELETE);
-
-        apiHelper.createTopic(CLUSTER_NAME, TOPIC_FOR_CONNECTOR);
-        apiHelper.sendMessage(CLUSTER_NAME, TOPIC_FOR_CONNECTOR, message, " ");
-
-        apiHelper.createTopic(CLUSTER_NAME, TOPIC_FOR_DELETE_CONNECTOR);
-        apiHelper.sendMessage(CLUSTER_NAME, TOPIC_FOR_DELETE_CONNECTOR, message, " ");
-
-        apiHelper.createTopic(CLUSTER_NAME, TOPIC_FOR_UPDATE_CONNECTOR);
-        apiHelper.sendMessage(CLUSTER_NAME, TOPIC_FOR_UPDATE_CONNECTOR, message, " ");
-
-        apiHelper.createConnector(CLUSTER_NAME, FIRST_CONNECTOR, CONNECTOR_FOR_DELETE, connectorToDelete);
-        apiHelper.createConnector(CLUSTER_NAME, FIRST_CONNECTOR, CONNECTOR_FOR_UPDATE, connectorToUpdate);
-    }
-
-    @AfterAll
-    public static void afterAll() {
-        ApiHelper apiHelper = Helpers.INSTANCE.apiHelper;
-        apiHelper.deleteConnector(CLUSTER_NAME, FIRST_CONNECTOR, SINK_CONNECTOR);
-        apiHelper.deleteConnector(CLUSTER_NAME, FIRST_CONNECTOR, CONNECTOR_FOR_UPDATE);
-        apiHelper.deleteTopic(CLUSTER_NAME, TOPIC_FOR_CONNECTOR);
-        apiHelper.deleteTopic(CLUSTER_NAME, TOPIC_FOR_DELETE_CONNECTOR);
-        apiHelper.deleteTopic(CLUSTER_NAME, TOPIC_FOR_UPDATE_CONNECTOR);
+        TOPIC_LIST.addAll(List.of(TOPIC_FOR_CREATE, TOPIC_FOR_DELETE, TOPIC_FOR_UPDATE));
+        TOPIC_LIST.forEach(topic -> {
+            Helpers.INSTANCE.apiHelper.createTopic(CLUSTER_NAME, topic.getName());
+            Helpers.INSTANCE.apiHelper.sendMessage(CLUSTER_NAME, topic);
+        });
+        CONNECTOR_LIST.addAll(List.of(CONNECTOR_FOR_DELETE, CONNECTOR_FOR_UPDATE));
+        CONNECTOR_LIST.forEach(connector -> Helpers.INSTANCE.apiHelper
+                .createConnector(CLUSTER_NAME, CONNECT_NAME, connector));
     }
 
     @DisplayName("should create a connector")
-    @Suite(suiteId = suiteId, title = suiteTitle)
+    @Suite(suiteId = SUITE_ID, title = SUITE_TITLE)
     @AutomationStatus(status = Status.AUTOMATED)
     @CaseId(42)
     @Test
     public void createConnector() {
+        Connector connectorForCreate = new Connector()
+                .setName("sink_postgres_activities_e2e_checks")
+                .setConfig(getResourceAsString("config_for_create_connector.json"));
         pages.openConnectorsList(CLUSTER_NAME)
                 .waitUntilScreenReady()
                 .clickCreateConnectorButton()
                 .waitUntilScreenReady()
-                .setConnectorConfig(
-                        SINK_CONNECTOR,
-                        getResourceAsString("config_for_create_connector.json"));
+                .setConnectorConfig(connectorForCreate.getName(), connectorForCreate.getConfig());
         pages.openConnectorsList(CLUSTER_NAME)
                 .waitUntilScreenReady()
-                .connectorIsVisibleInList(SINK_CONNECTOR, TOPIC_FOR_CONNECTOR);
+                .connectorIsVisibleInList(connectorForCreate.getName(), TOPIC_FOR_CREATE.getName());
+        CONNECTOR_LIST.add(connectorForCreate);
     }
 
     @DisplayName("should update a connector")
-    @Suite(suiteId = suiteId, title = suiteTitle)
+    @Suite(suiteId = SUITE_ID, title = SUITE_TITLE)
     @AutomationStatus(status = Status.AUTOMATED)
     @CaseId(196)
     @Test
     public void updateConnector() {
         pages.openConnectorsList(CLUSTER_NAME)
                 .waitUntilScreenReady()
-                .openConnector(CONNECTOR_FOR_UPDATE);
+                .openConnector(CONNECTOR_FOR_UPDATE.getName());
         pages.connectorsView.connectorIsVisibleOnOverview();
         pages.connectorsView.openEditConfig()
-                .updConnectorConfig(getResourceAsString("config_for_update_connector.json"));
+                .updConnectorConfig(CONNECTOR_FOR_UPDATE.getConfig());
         pages.openConnectorsList(CLUSTER_NAME)
-                .connectorIsVisibleInList(CONNECTOR_FOR_UPDATE, TOPIC_FOR_UPDATE_CONNECTOR);
+                .connectorIsVisibleInList(CONNECTOR_FOR_UPDATE.getName(), TOPIC_FOR_UPDATE.getName());
     }
 
     @DisplayName("should delete connector")
-    @Suite(suiteId = suiteId, title = suiteTitle)
+    @Suite(suiteId = SUITE_ID, title = SUITE_TITLE)
     @AutomationStatus(status = Status.AUTOMATED)
     @CaseId(195)
     @Test
     public void deleteConnector() {
         pages.openConnectorsList(CLUSTER_NAME)
                 .waitUntilScreenReady()
-                .openConnector(CONNECTOR_FOR_DELETE);
+                .openConnector(CONNECTOR_FOR_DELETE.getName());
         pages.connectorsView.clickDeleteButton();
         pages.openConnectorsList(CLUSTER_NAME)
-                .isNotVisible(CONNECTOR_FOR_DELETE);
+                .isNotVisible(CONNECTOR_FOR_DELETE.getName());
+        CONNECTOR_LIST.remove(CONNECTOR_FOR_DELETE);
+    }
+
+    @AfterAll
+    public static void afterAll() {
+        CONNECTOR_LIST.forEach(connector ->
+                Helpers.INSTANCE.apiHelper.deleteConnector(CLUSTER_NAME, CONNECT_NAME, connector.getName()));
+        TOPIC_LIST.forEach(topic -> Helpers.INSTANCE.apiHelper.deleteTopic(CLUSTER_NAME, topic.getName()));
     }
 }
diff --git a/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/tests/SchemasTests.java b/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/tests/SchemasTests.java
index 22c8db453d9..9218548d9de 100644
--- a/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/tests/SchemasTests.java
+++ b/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/tests/SchemasTests.java
@@ -1,99 +1,85 @@
 package com.provectus.kafka.ui.tests;
 
 import com.provectus.kafka.ui.api.model.CompatibilityLevel;
-import com.provectus.kafka.ui.api.model.SchemaType;
 import com.provectus.kafka.ui.base.BaseTest;
 import com.provectus.kafka.ui.helpers.Helpers;
+import com.provectus.kafka.ui.models.Schema;
 import com.provectus.kafka.ui.pages.MainPage;
-import com.provectus.kafka.ui.pages.schema.SchemaCreateView;
 import com.provectus.kafka.ui.pages.schema.SchemaEditView;
 import com.provectus.kafka.ui.utils.qaseIO.Status;
 import com.provectus.kafka.ui.utils.qaseIO.annotation.AutomationStatus;
 import com.provectus.kafka.ui.utils.qaseIO.annotation.Suite;
 import io.qase.api.annotation.CaseId;
+import lombok.SneakyThrows;
 import org.junit.jupiter.api.*;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import static com.provectus.kafka.ui.extensions.FileUtils.fileToString;
 
+
 @TestMethodOrder(MethodOrderer.OrderAnnotation.class)
 public class SchemasTests extends BaseTest {
-
-    private final long suiteId = 11;
-    private final String suiteTitle = "Schema Registry";
-    public static final String SCHEMA_AVRO_CREATE = "avro_schema";
-    public static final String SCHEMA_JSON_CREATE = "json_schema";
-    public static final String SCHEMA_PROTOBUF_CREATE = "protobuf_schema";
-    public static final String SCHEMA_AVRO_API_UPDATE = "avro_schema_for_update_api";
-    public static final String SCHEMA_AVRO_API = "avro_schema_api";
-    public static final String SCHEMA_JSON_API = "json_schema_api";
-    public static final String SCHEMA_PROTOBUF_API = "protobuf_schema_api";
-    private static final String PATH_AVRO_VALUE = System.getProperty("user.dir") + "/src/test/resources/schema_avro_value.json";
-    private static final String PATH_AVRO_FOR_UPDATE = System.getProperty("user.dir") + "/src/test/resources/schema_avro_for_update.json";
-    private static final String PATH_PROTOBUF_VALUE = System.getProperty("user.dir") + "/src/test/resources/schema_protobuf_value.txt";
-    private static final String PATH_JSON_VALUE = System.getProperty("user.dir") + "/src/test/resources/schema_Json_Value.json";
+    private static final long SUITE_ID = 11;
+    private static final String SUITE_TITLE = "Schema Registry";
+    private static final List<Schema> SCHEMA_LIST = new ArrayList<>();
+    private static final Schema AVRO_API = Schema.createSchemaAvro();
+    private static final Schema JSON_API = Schema.createSchemaJson();
+    private static final Schema PROTOBUF_API = Schema.createSchemaProtobuf();
 
     @BeforeAll
+    @SneakyThrows
     public static void beforeAll() {
-        Helpers.INSTANCE.apiHelper.createSchema(CLUSTER_NAME, SCHEMA_AVRO_API_UPDATE, SchemaType.AVRO, fileToString(PATH_AVRO_VALUE));
-        Helpers.INSTANCE.apiHelper.createSchema(CLUSTER_NAME, SCHEMA_AVRO_API, SchemaType.AVRO, fileToString(PATH_AVRO_VALUE));
-        Helpers.INSTANCE.apiHelper.createSchema(CLUSTER_NAME, SCHEMA_JSON_API, SchemaType.JSON, fileToString(PATH_JSON_VALUE));
-        Helpers.INSTANCE.apiHelper.createSchema(CLUSTER_NAME, SCHEMA_PROTOBUF_API, SchemaType.PROTOBUF, fileToString(PATH_PROTOBUF_VALUE));
-    }
-
-    @AfterAll
-    public static void afterAll() {
-        Helpers.INSTANCE.apiHelper.deleteSchema(CLUSTER_NAME, SCHEMA_AVRO_CREATE);
-        Helpers.INSTANCE.apiHelper.deleteSchema(CLUSTER_NAME, SCHEMA_JSON_CREATE);
-        Helpers.INSTANCE.apiHelper.deleteSchema(CLUSTER_NAME, SCHEMA_PROTOBUF_CREATE);
-        Helpers.INSTANCE.apiHelper.deleteSchema(CLUSTER_NAME, SCHEMA_AVRO_API_UPDATE);
-        Helpers.INSTANCE.apiHelper.deleteSchema(CLUSTER_NAME, SCHEMA_AVRO_API);
-        Helpers.INSTANCE.apiHelper.deleteSchema(CLUSTER_NAME, SCHEMA_JSON_API);
-        Helpers.INSTANCE.apiHelper.deleteSchema(CLUSTER_NAME, SCHEMA_PROTOBUF_API);
-
+        SCHEMA_LIST.addAll(List.of(AVRO_API, JSON_API, PROTOBUF_API));
+        SCHEMA_LIST.forEach(schema -> Helpers.INSTANCE.apiHelper.createSchema(CLUSTER_NAME, schema));
     }
 
     @DisplayName("should create AVRO schema")
-    @Suite(suiteId = suiteId, title = suiteTitle)
+    @Suite(suiteId = SUITE_ID, title = SUITE_TITLE)
     @AutomationStatus(status = Status.AUTOMATED)
     @CaseId(43)
     @Test
     @Order(1)
     void createSchemaAvro() {
+        Schema schemaAvro = Schema.createSchemaAvro();
         pages.openMainPage()
                 .goToSideMenu(CLUSTER_NAME, MainPage.SideMenuOptions.SCHEMA_REGISTRY);
         pages.schemaRegistry.clickCreateSchema()
-                .setSubjectName(SCHEMA_AVRO_CREATE)
-                .setSchemaField(fileToString(PATH_AVRO_VALUE))
-                .selectSchemaTypeFromDropdown(SchemaCreateView.SchemaType.AVRO)
+                .setSubjectName(schemaAvro.getName())
+                .setSchemaField(fileToString(schemaAvro.getValuePath()))
+                .selectSchemaTypeFromDropdown(schemaAvro.getType())
                 .clickSubmit()
                 .waitUntilScreenReady();
         pages.mainPage
                 .goToSideMenu(CLUSTER_NAME, MainPage.SideMenuOptions.SCHEMA_REGISTRY);
-        pages.schemaRegistry.isSchemaVisible(SCHEMA_AVRO_CREATE);
+        pages.schemaRegistry.isSchemaVisible(schemaAvro.getName());
+        SCHEMA_LIST.add(schemaAvro);
     }
 
     @DisplayName("should update AVRO schema")
-    @Suite(suiteId = suiteId, title = suiteTitle)
+    @Suite(suiteId = SUITE_ID, title = SUITE_TITLE)
     @AutomationStatus(status = Status.AUTOMATED)
     @CaseId(186)
     @Test
     @Order(2)
     void updateSchemaAvro() {
+        AVRO_API.setValuePath(System.getProperty("user.dir") + "/src/main/resources/testData/schema_avro_for_update.json");
         pages.openMainPage()
                 .goToSideMenu(CLUSTER_NAME, MainPage.SideMenuOptions.SCHEMA_REGISTRY);
-        pages.schemaRegistry.openSchema(SCHEMA_AVRO_API_UPDATE)
+        pages.schemaRegistry.openSchema(AVRO_API.getName())
                 .waitUntilScreenReady()
                 .openEditSchema();
         Assertions.assertTrue(new SchemaEditView().isSchemaDropDownDisabled(),"isSchemaDropDownDisabled()");
         new SchemaEditView().selectCompatibilityLevelFromDropdown(CompatibilityLevel.CompatibilityEnum.NONE)
-                .setNewSchemaValue(fileToString(PATH_AVRO_FOR_UPDATE))
+                .setNewSchemaValue(fileToString(AVRO_API.getValuePath()))
                 .clickSubmit()
                 .waitUntilScreenReady()
                 .isCompatibility(CompatibilityLevel.CompatibilityEnum.NONE);
     }
 
     @DisplayName("should delete AVRO schema")
-    @Suite(suiteId = suiteId, title = suiteTitle)
+    @Suite(suiteId = SUITE_ID, title = SUITE_TITLE)
     @AutomationStatus(status = Status.AUTOMATED)
     @CaseId(187)
     @Test
@@ -101,34 +87,37 @@ void updateSchemaAvro() {
     void deleteSchemaAvro() {
         pages.openMainPage()
                 .goToSideMenu(CLUSTER_NAME, MainPage.SideMenuOptions.SCHEMA_REGISTRY);
-        pages.schemaRegistry.openSchema(SCHEMA_AVRO_API)
+        pages.schemaRegistry.openSchema(AVRO_API.getName())
                 .waitUntilScreenReady()
                 .removeSchema()
-                .isNotVisible(SCHEMA_AVRO_API);
+                .isNotVisible(AVRO_API.getName());
+        SCHEMA_LIST.remove(AVRO_API);
     }
 
     @DisplayName("should create JSON schema")
-    @Suite(suiteId = suiteId, title = suiteTitle)
+    @Suite(suiteId = SUITE_ID, title = SUITE_TITLE)
     @AutomationStatus(status = Status.AUTOMATED)
     @CaseId(89)
     @Test
     @Order(4)
     void createSchemaJson() {
+        Schema schemaJson = Schema.createSchemaJson();
         pages.openMainPage()
                 .goToSideMenu(CLUSTER_NAME, MainPage.SideMenuOptions.SCHEMA_REGISTRY);
         pages.schemaRegistry.clickCreateSchema()
-                .setSubjectName(SCHEMA_JSON_CREATE)
-                .setSchemaField(fileToString(PATH_JSON_VALUE))
-                .selectSchemaTypeFromDropdown(SchemaCreateView.SchemaType.JSON)
+                .setSubjectName(schemaJson.getName())
+                .setSchemaField(fileToString(schemaJson.getValuePath()))
+                .selectSchemaTypeFromDropdown(schemaJson.getType())
                 .clickSubmit()
                 .waitUntilScreenReady();
         pages.mainPage
                 .goToSideMenu(CLUSTER_NAME, MainPage.SideMenuOptions.SCHEMA_REGISTRY);
-        pages.schemaRegistry.isSchemaVisible(SCHEMA_JSON_CREATE);
+        pages.schemaRegistry.isSchemaVisible(schemaJson.getName());
+        SCHEMA_LIST.add(schemaJson);
     }
 
     @DisplayName("should delete JSON schema")
-    @Suite(suiteId = suiteId, title = suiteTitle)
+    @Suite(suiteId = SUITE_ID, title = SUITE_TITLE)
     @AutomationStatus(status = Status.AUTOMATED)
     @CaseId(189)
     @Test
@@ -136,34 +125,37 @@ void createSchemaJson() {
     void deleteSchemaJson() {
         pages.openMainPage()
                 .goToSideMenu(CLUSTER_NAME, MainPage.SideMenuOptions.SCHEMA_REGISTRY);
-        pages.schemaRegistry.openSchema(SCHEMA_JSON_API)
+        pages.schemaRegistry.openSchema(JSON_API.getName())
                 .waitUntilScreenReady()
                 .removeSchema()
-                .isNotVisible(SCHEMA_JSON_API);
+                .isNotVisible(JSON_API.getName());
+        SCHEMA_LIST.remove(JSON_API);
     }
 
     @DisplayName("should create PROTOBUF schema")
-    @Suite(suiteId = suiteId, title = suiteTitle)
+    @Suite(suiteId = SUITE_ID, title = SUITE_TITLE)
     @AutomationStatus(status = Status.AUTOMATED)
     @CaseId(91)
     @Test
     @Order(6)
     void createSchemaProtobuf() {
+        Schema schemaProtobuf = Schema.createSchemaProtobuf();
         pages.openMainPage()
                 .goToSideMenu(CLUSTER_NAME, MainPage.SideMenuOptions.SCHEMA_REGISTRY);
         pages.schemaRegistry.clickCreateSchema()
-                .setSubjectName(SCHEMA_PROTOBUF_CREATE)
-                .setSchemaField(fileToString(PATH_PROTOBUF_VALUE))
-                .selectSchemaTypeFromDropdown(SchemaCreateView.SchemaType.PROTOBUF)
+                .setSubjectName(schemaProtobuf.getName())
+                .setSchemaField(fileToString(schemaProtobuf.getValuePath()))
+                .selectSchemaTypeFromDropdown(schemaProtobuf.getType())
                 .clickSubmit()
                 .waitUntilScreenReady();
         pages.mainPage
                 .goToSideMenu(CLUSTER_NAME, MainPage.SideMenuOptions.SCHEMA_REGISTRY);
-        pages.schemaRegistry.isSchemaVisible(SCHEMA_PROTOBUF_CREATE);
+        pages.schemaRegistry.isSchemaVisible(schemaProtobuf.getName());
+        SCHEMA_LIST.add(schemaProtobuf);
     }
 
     @DisplayName("should delete PROTOBUF schema")
-    @Suite(suiteId = suiteId, title = suiteTitle)
+    @Suite(suiteId = SUITE_ID, title = SUITE_TITLE)
     @AutomationStatus(status = Status.AUTOMATED)
     @CaseId(223)
     @Test
@@ -171,9 +163,15 @@ void createSchemaProtobuf() {
     void deleteSchemaProtobuf() {
         pages.openMainPage()
                 .goToSideMenu(CLUSTER_NAME, MainPage.SideMenuOptions.SCHEMA_REGISTRY);
-        pages.schemaRegistry.openSchema(SCHEMA_PROTOBUF_API)
+        pages.schemaRegistry.openSchema(PROTOBUF_API.getName())
                 .waitUntilScreenReady()
                 .removeSchema()
-                .isNotVisible(SCHEMA_PROTOBUF_API);
+                .isNotVisible(PROTOBUF_API.getName());
+        SCHEMA_LIST.remove(PROTOBUF_API);
+    }
+
+    @AfterAll
+    public static void afterAll() {
+        SCHEMA_LIST.forEach(schema -> Helpers.INSTANCE.apiHelper.deleteSchema(CLUSTER_NAME, schema.getName()));
     }
 }
diff --git a/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/tests/TopicTests.java b/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/tests/TopicTests.java
index 37d3f9b01d0..8f74109631d 100644
--- a/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/tests/TopicTests.java
+++ b/kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/tests/TopicTests.java
@@ -2,6 +2,7 @@
 
 import com.provectus.kafka.ui.base.BaseTest;
 import com.provectus.kafka.ui.helpers.Helpers;
+import com.provectus.kafka.ui.models.Topic;
 import com.provectus.kafka.ui.pages.MainPage;
 import com.provectus.kafka.ui.pages.topic.TopicView;
 import com.provectus.kafka.ui.utils.qaseIO.Status;
@@ -11,32 +12,29 @@
 import io.qase.api.annotation.CaseId;
 import org.junit.jupiter.api.*;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import static com.provectus.kafka.ui.extensions.FileUtils.fileToString;
 
 public class TopicTests extends BaseTest {
-
-    public static final String NEW_TOPIC = "new-topic";
-    public static final String TOPIC_TO_UPDATE = "topic-to-update";
-    public static final String TOPIC_TO_DELETE = "topic-to-delete";
-    public static final String COMPACT_POLICY_VALUE = "Compact";
-    public static final String UPDATED_TIME_TO_RETAIN_VALUE = "604800001";
-    public static final String UPDATED_MAX_SIZE_ON_DISK = "20 GB";
-    public static final String UPDATED_MAX_MESSAGE_BYTES = "1000020";
-    private static final String KEY_TO_PRODUCE_MESSAGE = System.getProperty("user.dir") + "/src/test/resources/producedkey.txt";
-    private static final String CONTENT_TO_PRODUCE_MESSAGE = System.getProperty("user.dir") + "/src/test/resources/testData.txt";
-
+    private static final long SUITE_ID = 2;
+    private static final String SUITE_TITLE = "Topics";
+    private static final Topic TOPIC_FOR_UPDATE = new Topic()
+            .setName("topic-to-update")
+            .setCompactPolicyValue("Compact")
+            .setTimeToRetainData("604800001")
+            .setMaxSizeOnDisk("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");
+    private static final List<Topic> TOPIC_LIST = new ArrayList<>();
 
     @BeforeAll
     public static void beforeAll() {
-        Helpers.INSTANCE.apiHelper.createTopic(CLUSTER_NAME, TOPIC_TO_UPDATE);
-        Helpers.INSTANCE.apiHelper.createTopic(CLUSTER_NAME, TOPIC_TO_DELETE);
-    }
-
-    @AfterAll
-    public static void afterAll() {
-        Helpers.INSTANCE.apiHelper.deleteTopic(CLUSTER_NAME, TOPIC_TO_UPDATE);
-        Helpers.INSTANCE.apiHelper.deleteTopic(CLUSTER_NAME, TOPIC_TO_DELETE);
-        Helpers.INSTANCE.apiHelper.deleteTopic(CLUSTER_NAME, NEW_TOPIC);
+        TOPIC_LIST.addAll(List.of(TOPIC_FOR_UPDATE, TOPIC_FOR_DELETE));
+        TOPIC_LIST.forEach(topic -> Helpers.INSTANCE.apiHelper.createTopic(CLUSTER_NAME, topic.getName()));
     }
 
     @DisplayName("should create a topic")
@@ -45,84 +43,88 @@ public static void afterAll() {
     @CaseId(199)
     @Test
     public void createTopic() {
+        Topic topicToCreate = new Topic().setName("new-topic");
         pages.open()
                 .goToSideMenu(CLUSTER_NAME, MainPage.SideMenuOptions.TOPICS);
         pages.topicsList.pressCreateNewTopic()
-                .setTopicName(NEW_TOPIC)
+                .setTopicName(topicToCreate.getName())
                 .sendData()
                 .waitUntilScreenReady();
         pages.open()
                 .goToSideMenu(CLUSTER_NAME, MainPage.SideMenuOptions.TOPICS)
-                .topicIsVisible(NEW_TOPIC);
-        helpers.apiHelper.deleteTopic(CLUSTER_NAME, NEW_TOPIC);
-        pages.open()
-                .goToSideMenu(CLUSTER_NAME, MainPage.SideMenuOptions.TOPICS)
-                .topicIsNotVisible(NEW_TOPIC);
+                .topicIsVisible(topicToCreate.getName());
+        TOPIC_LIST.add(topicToCreate);
     }
+
     @Disabled("Due to issue https://github.com/provectus/kafka-ui/issues/1500 ignore this test")
     @DisplayName("should update a topic")
     @Issue("1500")
-    @Suite(suiteId = 2, title = "Topics")
+    @Suite(suiteId = SUITE_ID, title = SUITE_TITLE)
     @AutomationStatus(status = Status.AUTOMATED)
     @CaseId(197)
     @Test
     public void updateTopic() {
         pages.openTopicsList(CLUSTER_NAME)
                 .waitUntilScreenReady();
-        pages.openTopicView(CLUSTER_NAME, TOPIC_TO_UPDATE)
+        pages.openTopicView(CLUSTER_NAME, TOPIC_FOR_UPDATE.getName())
                 .waitUntilScreenReady()
                 .openEditSettings()
-                .selectCleanupPolicy(COMPACT_POLICY_VALUE)
+                .selectCleanupPolicy(TOPIC_FOR_UPDATE.getCompactPolicyValue())
                 .setMinInsyncReplicas(10)
-                .setTimeToRetainDataInMs(UPDATED_TIME_TO_RETAIN_VALUE)
-                .setMaxSizeOnDiskInGB(UPDATED_MAX_SIZE_ON_DISK)
-                .setMaxMessageBytes(UPDATED_MAX_MESSAGE_BYTES)
+                .setTimeToRetainDataInMs(TOPIC_FOR_UPDATE.getTimeToRetainData())
+                .setMaxSizeOnDiskInGB(TOPIC_FOR_UPDATE.getMaxSizeOnDisk())
+                .setMaxMessageBytes(TOPIC_FOR_UPDATE.getMaxMessageBytes())
                 .sendData()
                 .waitUntilScreenReady();
-
         pages.openTopicsList(CLUSTER_NAME)
                 .waitUntilScreenReady();
-        pages.openTopicView(CLUSTER_NAME, TOPIC_TO_UPDATE)
+        pages.openTopicView(CLUSTER_NAME, TOPIC_FOR_UPDATE.getName())
                 .openEditSettings()
                 // Assertions
-                .cleanupPolicyIs(COMPACT_POLICY_VALUE)
-                .timeToRetainIs(UPDATED_TIME_TO_RETAIN_VALUE)
-                .maxSizeOnDiskIs(UPDATED_MAX_SIZE_ON_DISK)
-                .maxMessageBytesIs(UPDATED_MAX_MESSAGE_BYTES);
+                .cleanupPolicyIs(TOPIC_FOR_UPDATE.getCompactPolicyValue())
+                .timeToRetainIs(TOPIC_FOR_UPDATE.getTimeToRetainData())
+                .maxSizeOnDiskIs(TOPIC_FOR_UPDATE.getMaxSizeOnDisk())
+                .maxMessageBytesIs(TOPIC_FOR_UPDATE.getMaxMessageBytes());
     }
 
     @DisplayName("should delete topic")
-    @Suite(suiteId = 2, title = "Topics")
+    @Suite(suiteId = SUITE_ID, title = SUITE_TITLE)
     @AutomationStatus(status = Status.AUTOMATED)
     @CaseId(207)
     @Test
     public void deleteTopic() {
         pages.openTopicsList(CLUSTER_NAME)
                 .waitUntilScreenReady()
-                .openTopic(TOPIC_TO_DELETE)
+                .openTopic(TOPIC_FOR_DELETE.getName())
                 .waitUntilScreenReady()
                 .deleteTopic();
         pages.openTopicsList(CLUSTER_NAME)
                 .waitUntilScreenReady()
-                .isTopicNotVisible(TOPIC_TO_DELETE);
+                .isTopicNotVisible(TOPIC_FOR_DELETE.getName());
+        TOPIC_LIST.remove(TOPIC_FOR_DELETE);
     }
 
     @DisplayName("produce message")
-    @Suite(suiteId = 2, title = "Topics")
+    @Suite(suiteId = SUITE_ID, title = SUITE_TITLE)
     @AutomationStatus(status = Status.AUTOMATED)
     @CaseId(222)
     @Test
     void produceMessage() {
         pages.openTopicsList(CLUSTER_NAME)
                 .waitUntilScreenReady()
-                .openTopic(TOPIC_TO_UPDATE)
+                .openTopic(TOPIC_FOR_UPDATE.getName())
                 .waitUntilScreenReady()
                 .openTopicMenu(TopicView.TopicMenu.MESSAGES)
                 .clickOnButton("Produce Message")
-                .setContentFiled(fileToString(CONTENT_TO_PRODUCE_MESSAGE))
-                .setKeyField(fileToString(KEY_TO_PRODUCE_MESSAGE))
+                .setContentFiled(TOPIC_FOR_UPDATE.getMessageContent())
+                .setKeyField(TOPIC_FOR_UPDATE.getMessageKey())
                 .submitProduceMessage();
-        Assertions.assertTrue(pages.topicView.isKeyMessageVisible(fileToString(KEY_TO_PRODUCE_MESSAGE)));
-        Assertions.assertTrue(pages.topicView.isContentMessageVisible(fileToString(CONTENT_TO_PRODUCE_MESSAGE).trim()));
+        Assertions.assertTrue(pages.topicView.isKeyMessageVisible(TOPIC_FOR_UPDATE.getMessageKey()));
+        Assertions.assertTrue(pages.topicView.isContentMessageVisible(TOPIC_FOR_UPDATE.getMessageContent().trim()));
+    }
+
+    @AfterAll
+    public static void afterAll() {
+        TOPIC_LIST.forEach(topic -> Helpers.INSTANCE.apiHelper.deleteTopic(CLUSTER_NAME, topic.getName()));
     }
 }