Fix and refactored test classes

This commit is contained in:
anezboretskiy 2022-09-28 15:40:32 +03:00
parent 7d4882d910
commit b0890b32ca
3 changed files with 44 additions and 52 deletions

View file

@ -43,11 +43,11 @@ public class ConnectorsTests extends BaseTest {
public void beforeAll() {
TOPIC_LIST.addAll(List.of(TOPIC_FOR_CREATE, TOPIC_FOR_DELETE, TOPIC_FOR_UPDATE));
TOPIC_LIST.forEach(topic -> {
apiHelpers.createTopic(CLUSTER_NAME, topic.getName());
apiHelpers.sendMessage(CLUSTER_NAME, topic);
apiHelper.createTopic(CLUSTER_NAME, topic.getName());
apiHelper.sendMessage(CLUSTER_NAME, topic);
});
CONNECTOR_LIST.addAll(List.of(CONNECTOR_FOR_DELETE, CONNECTOR_FOR_UPDATE));
CONNECTOR_LIST.forEach(connector -> apiHelpers
CONNECTOR_LIST.forEach(connector -> apiHelper
.createConnector(CLUSTER_NAME, CONNECT_NAME, connector));
}
@ -67,7 +67,7 @@ public class ConnectorsTests extends BaseTest {
.setConnectorConfig(connectorForCreate.getName(), connectorForCreate.getConfig());
connectorsList.goTo(CLUSTER_NAME)
.waitUntilScreenReady();
Assertions.assertTrue(connectorsList.isConnectorVisible(connectorForCreate.getName()),"isConnectorVisible()");
Assertions.assertTrue(connectorsList.isConnectorVisible(connectorForCreate.getName()), "isConnectorVisible()");
CONNECTOR_LIST.add(connectorForCreate);
}
@ -77,10 +77,8 @@ public class ConnectorsTests extends BaseTest {
@CaseId(196)
@Test
public void updateConnector() {
connectorsList.goTo(CLUSTER_NAME)
connectorsView.goTo(CLUSTER_NAME, CONNECTOR_FOR_UPDATE.getName())
.waitUntilScreenReady()
.openConnector(CONNECTOR_FOR_UPDATE.getName());
connectorsView.waitUntilScreenReady()
.openConfigTab()
.setConfig(CONNECTOR_FOR_UPDATE.getConfig());
connectorsList.goTo(CLUSTER_NAME);
@ -93,19 +91,17 @@ public class ConnectorsTests extends BaseTest {
@CaseId(195)
@Test
public void deleteConnector() {
connectorsList.goTo(CLUSTER_NAME)
.waitUntilScreenReady()
.openConnector(CONNECTOR_FOR_DELETE.getName());
connectorsView.clickDeleteButton();
connectorsView.goTo(CLUSTER_NAME, CONNECTOR_FOR_DELETE.getName())
.clickDeleteButton();
connectorsList.goTo(CLUSTER_NAME);
Assertions.assertFalse(connectorsList.isConnectorVisible(CONNECTOR_FOR_DELETE.getName()),"isConnectorVisible()");
Assertions.assertFalse(connectorsList.isConnectorVisible(CONNECTOR_FOR_DELETE.getName()), "isConnectorVisible()");
CONNECTOR_LIST.remove(CONNECTOR_FOR_DELETE);
}
@AfterAll
public void afterAll() {
CONNECTOR_LIST.forEach(connector ->
apiHelpers.deleteConnector(CLUSTER_NAME, CONNECT_NAME, connector.getName()));
TOPIC_LIST.forEach(topic -> apiHelpers.deleteTopic(CLUSTER_NAME, topic.getName()));
apiHelper.deleteConnector(CLUSTER_NAME, CONNECT_NAME, connector.getName()));
TOPIC_LIST.forEach(topic -> apiHelper.deleteTopic(CLUSTER_NAME, topic.getName()));
}
}

View file

@ -4,8 +4,6 @@ import com.provectus.kafka.ui.api.model.CompatibilityLevel;
import com.provectus.kafka.ui.base.BaseTest;
import com.provectus.kafka.ui.models.Schema;
import com.provectus.kafka.ui.pages.MainPage;
import com.provectus.kafka.ui.pages.schema.SchemaEditView;
import com.provectus.kafka.ui.pages.schema.SchemaView;
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;
@ -32,7 +30,7 @@ public class SchemasTests extends BaseTest {
@SneakyThrows
public void beforeAll() {
SCHEMA_LIST.addAll(List.of(AVRO_API, JSON_API, PROTOBUF_API));
SCHEMA_LIST.forEach(schema -> apiHelpers.createSchema(CLUSTER_NAME, schema));
SCHEMA_LIST.forEach(schema -> apiHelper.createSchema(CLUSTER_NAME, schema));
}
@DisplayName("should create AVRO schema")
@ -45,7 +43,7 @@ public class SchemasTests extends BaseTest {
Schema schemaAvro = Schema.createSchemaAvro();
mainPage.goTo()
.goToSideMenu(CLUSTER_NAME, MainPage.SideMenuOptions.SCHEMA_REGISTRY);
schemaRegistry.clickCreateSchema()
schemaRegistryList.clickCreateSchema()
.setSubjectName(schemaAvro.getName())
.setSchemaField(fileToString(schemaAvro.getValuePath()))
.selectSchemaTypeFromDropdown(schemaAvro.getType())
@ -53,7 +51,7 @@ public class SchemasTests extends BaseTest {
.waitUntilScreenReady();
mainPage.goTo()
.goToSideMenu(CLUSTER_NAME, MainPage.SideMenuOptions.SCHEMA_REGISTRY);
Assertions.assertTrue(schemaRegistry.isSchemaVisible(schemaAvro.getName()),"isSchemaVisible()");
Assertions.assertTrue(schemaRegistryList.isSchemaVisible(schemaAvro.getName()), "isSchemaVisible()");
SCHEMA_LIST.add(schemaAvro);
}
@ -67,15 +65,15 @@ public class SchemasTests extends BaseTest {
AVRO_API.setValuePath(System.getProperty("user.dir") + "/src/main/resources/testData/schema_avro_for_update.json");
mainPage.goTo()
.goToSideMenu(CLUSTER_NAME, MainPage.SideMenuOptions.SCHEMA_REGISTRY);
schemaRegistry.openSchema(AVRO_API.getName())
schemaRegistryList.openSchema(AVRO_API.getName())
.waitUntilScreenReady()
.openEditSchema();
Assertions.assertTrue(new SchemaEditView().isSchemaDropDownDisabled(),"isSchemaDropDownDisabled()");
new SchemaEditView().selectCompatibilityLevelFromDropdown(CompatibilityLevel.CompatibilityEnum.NONE)
Assertions.assertTrue(schemaEditView.isSchemaDropDownDisabled(), "isSchemaDropDownDisabled()");
schemaEditView.selectCompatibilityLevelFromDropdown(CompatibilityLevel.CompatibilityEnum.NONE)
.setNewSchemaValue(fileToString(AVRO_API.getValuePath()))
.clickSubmit()
.waitUntilScreenReady();
Assertions.assertEquals(CompatibilityLevel.CompatibilityEnum.NONE.toString(), new SchemaView().getCompatibility(), "getCompatibility()");
Assertions.assertEquals(CompatibilityLevel.CompatibilityEnum.NONE.toString(), schemaView.getCompatibility(), "getCompatibility()");
}
@DisplayName("should delete AVRO schema")
@ -87,10 +85,10 @@ public class SchemasTests extends BaseTest {
void deleteSchemaAvro() {
mainPage.goTo()
.goToSideMenu(CLUSTER_NAME, MainPage.SideMenuOptions.SCHEMA_REGISTRY);
schemaRegistry.openSchema(AVRO_API.getName())
schemaRegistryList.openSchema(AVRO_API.getName())
.waitUntilScreenReady()
.removeSchema();
Assertions.assertFalse(schemaRegistry.isSchemaVisible(AVRO_API.getName()),"isSchemaVisible()");
Assertions.assertFalse(schemaRegistryList.isSchemaVisible(AVRO_API.getName()), "isSchemaVisible()");
SCHEMA_LIST.remove(AVRO_API);
}
@ -104,14 +102,14 @@ public class SchemasTests extends BaseTest {
Schema schemaJson = Schema.createSchemaJson();
mainPage.goTo()
.goToSideMenu(CLUSTER_NAME, MainPage.SideMenuOptions.SCHEMA_REGISTRY);
schemaRegistry.clickCreateSchema()
schemaRegistryList.clickCreateSchema()
.setSubjectName(schemaJson.getName())
.setSchemaField(fileToString(schemaJson.getValuePath()))
.selectSchemaTypeFromDropdown(schemaJson.getType())
.setSchemaField(fileToString(schemaJson.getValuePath()));
schemaEditView.selectSchemaTypeFromDropdown(schemaJson.getType())
.clickSubmit()
.waitUntilScreenReady();
mainPage.goToSideMenu(CLUSTER_NAME, MainPage.SideMenuOptions.SCHEMA_REGISTRY);
Assertions.assertTrue(schemaRegistry.isSchemaVisible(schemaJson.getName()),"isSchemaVisible()");
Assertions.assertTrue(schemaRegistryList.isSchemaVisible(schemaJson.getName()), "isSchemaVisible()");
SCHEMA_LIST.add(schemaJson);
}
@ -124,10 +122,10 @@ public class SchemasTests extends BaseTest {
void deleteSchemaJson() {
mainPage.goTo()
.goToSideMenu(CLUSTER_NAME, MainPage.SideMenuOptions.SCHEMA_REGISTRY);
schemaRegistry.openSchema(JSON_API.getName())
schemaRegistryList.openSchema(JSON_API.getName())
.waitUntilScreenReady()
.removeSchema();
Assertions.assertFalse(schemaRegistry.isSchemaVisible(JSON_API.getName()),"isSchemaVisible()");
Assertions.assertFalse(schemaRegistryList.isSchemaVisible(JSON_API.getName()), "isSchemaVisible()");
SCHEMA_LIST.remove(JSON_API);
}
@ -141,14 +139,14 @@ public class SchemasTests extends BaseTest {
Schema schemaProtobuf = Schema.createSchemaProtobuf();
mainPage.goTo()
.goToSideMenu(CLUSTER_NAME, MainPage.SideMenuOptions.SCHEMA_REGISTRY);
schemaRegistry.clickCreateSchema()
schemaRegistryList.clickCreateSchema()
.setSubjectName(schemaProtobuf.getName())
.setSchemaField(fileToString(schemaProtobuf.getValuePath()))
.selectSchemaTypeFromDropdown(schemaProtobuf.getType())
.setSchemaField(fileToString(schemaProtobuf.getValuePath()));
schemaEditView.selectSchemaTypeFromDropdown(schemaProtobuf.getType())
.clickSubmit()
.waitUntilScreenReady();
mainPage.goToSideMenu(CLUSTER_NAME, MainPage.SideMenuOptions.SCHEMA_REGISTRY);
Assertions.assertTrue(schemaRegistry.isSchemaVisible(schemaProtobuf.getName()),"isSchemaVisible()");
Assertions.assertTrue(schemaRegistryList.isSchemaVisible(schemaProtobuf.getName()), "isSchemaVisible()");
SCHEMA_LIST.add(schemaProtobuf);
}
@ -161,15 +159,15 @@ public class SchemasTests extends BaseTest {
void deleteSchemaProtobuf() {
mainPage.goTo()
.goToSideMenu(CLUSTER_NAME, MainPage.SideMenuOptions.SCHEMA_REGISTRY);
schemaRegistry.openSchema(PROTOBUF_API.getName())
schemaRegistryList.openSchema(PROTOBUF_API.getName())
.waitUntilScreenReady()
.removeSchema();
Assertions.assertFalse(schemaRegistry.isSchemaVisible(PROTOBUF_API.getName()),"isSchemaVisible()");
Assertions.assertFalse(schemaRegistryList.isSchemaVisible(PROTOBUF_API.getName()), "isSchemaVisible()");
SCHEMA_LIST.remove(PROTOBUF_API);
}
@AfterAll
public void afterAll() {
SCHEMA_LIST.forEach(schema -> apiHelpers.deleteSchema(CLUSTER_NAME, schema.getName()));
SCHEMA_LIST.forEach(schema -> apiHelper.deleteSchema(CLUSTER_NAME, schema.getName()));
}
}

View file

@ -2,8 +2,6 @@ package com.provectus.kafka.ui.tests;
import com.provectus.kafka.ui.base.BaseTest;
import com.provectus.kafka.ui.models.Topic;
import com.provectus.kafka.ui.pages.MainPage;
import com.provectus.kafka.ui.pages.topic.TopicCreateEditSettingsView;
import com.provectus.kafka.ui.pages.topic.TopicView;
import com.provectus.kafka.ui.utilities.qaseIoUtils.annotations.AutomationStatus;
import com.provectus.kafka.ui.utilities.qaseIoUtils.annotations.Suite;
@ -35,7 +33,7 @@ public class TopicTests extends BaseTest {
@BeforeAll
public void beforeAll() {
TOPIC_LIST.addAll(List.of(TOPIC_FOR_UPDATE, TOPIC_FOR_DELETE));
TOPIC_LIST.forEach(topic -> apiHelpers.createTopic(CLUSTER_NAME, topic.getName()));
TOPIC_LIST.forEach(topic -> apiHelper.createTopic(CLUSTER_NAME, topic.getName()));
}
@DisplayName("should create a topic")
@ -45,15 +43,15 @@ public class TopicTests extends BaseTest {
@Test
public void createTopic() {
Topic topicToCreate = new Topic().setName("new-topic");
mainPage.goTo()
.goToSideMenu(CLUSTER_NAME, MainPage.SideMenuOptions.TOPICS);
topicsList.pressCreateNewTopic()
topicsList.goTo(CLUSTER_NAME)
.waitUntilScreenReady()
.pressCreateNewTopic()
.setTopicName(topicToCreate.getName())
.sendData()
.waitUntilScreenReady();
mainPage.goTo()
.goToSideMenu(CLUSTER_NAME, MainPage.SideMenuOptions.TOPICS);
Assertions.assertTrue(topicsList.isTopicVisible(topicToCreate.getName()),"isTopicVisible");
topicsList.goTo(CLUSTER_NAME)
.waitUntilScreenReady();
Assertions.assertTrue(topicsList.isTopicVisible(topicToCreate.getName()), "isTopicVisible");
TOPIC_LIST.add(topicToCreate);
}
@ -82,10 +80,10 @@ public class TopicTests extends BaseTest {
.waitUntilScreenReady()
.openEditSettings();
SoftAssertions softly = new SoftAssertions();
softly.assertThat(new TopicCreateEditSettingsView().getCleanupPolicy()).as("Cleanup Policy").isEqualTo(TOPIC_FOR_UPDATE.getCompactPolicyValue());
softly.assertThat(new TopicCreateEditSettingsView().getTimeToRetain()).as("Time to retain").isEqualTo(TOPIC_FOR_UPDATE.getTimeToRetainData());
softly.assertThat(new TopicCreateEditSettingsView().getMaxSizeOnDisk()).as("Max size on disk").isEqualTo(TOPIC_FOR_UPDATE.getMaxSizeOnDisk());
softly.assertThat(new TopicCreateEditSettingsView().getMaxMessageBytes()).as("Max message bytes").isEqualTo(TOPIC_FOR_UPDATE.getMaxMessageBytes());
softly.assertThat(topicCreateEditSettingsView.getCleanupPolicy()).as("Cleanup Policy").isEqualTo(TOPIC_FOR_UPDATE.getCompactPolicyValue());
softly.assertThat(topicCreateEditSettingsView.getTimeToRetain()).as("Time to retain").isEqualTo(TOPIC_FOR_UPDATE.getTimeToRetainData());
softly.assertThat(topicCreateEditSettingsView.getMaxSizeOnDisk()).as("Max size on disk").isEqualTo(TOPIC_FOR_UPDATE.getMaxSizeOnDisk());
softly.assertThat(topicCreateEditSettingsView.getMaxMessageBytes()).as("Max message bytes").isEqualTo(TOPIC_FOR_UPDATE.getMaxMessageBytes());
softly.assertAll();
}
@ -129,6 +127,6 @@ public class TopicTests extends BaseTest {
@AfterAll
public void afterAll() {
TOPIC_LIST.forEach(topic -> apiHelpers.deleteTopic(CLUSTER_NAME, topic.getName()));
TOPIC_LIST.forEach(topic -> apiHelper.deleteTopic(CLUSTER_NAME, topic.getName()));
}
}