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() { public void beforeAll() {
TOPIC_LIST.addAll(List.of(TOPIC_FOR_CREATE, TOPIC_FOR_DELETE, TOPIC_FOR_UPDATE)); TOPIC_LIST.addAll(List.of(TOPIC_FOR_CREATE, TOPIC_FOR_DELETE, TOPIC_FOR_UPDATE));
TOPIC_LIST.forEach(topic -> { TOPIC_LIST.forEach(topic -> {
apiHelpers.createTopic(CLUSTER_NAME, topic.getName()); apiHelper.createTopic(CLUSTER_NAME, topic.getName());
apiHelpers.sendMessage(CLUSTER_NAME, topic); apiHelper.sendMessage(CLUSTER_NAME, topic);
}); });
CONNECTOR_LIST.addAll(List.of(CONNECTOR_FOR_DELETE, CONNECTOR_FOR_UPDATE)); 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)); .createConnector(CLUSTER_NAME, CONNECT_NAME, connector));
} }
@ -77,10 +77,8 @@ public class ConnectorsTests extends BaseTest {
@CaseId(196) @CaseId(196)
@Test @Test
public void updateConnector() { public void updateConnector() {
connectorsList.goTo(CLUSTER_NAME) connectorsView.goTo(CLUSTER_NAME, CONNECTOR_FOR_UPDATE.getName())
.waitUntilScreenReady() .waitUntilScreenReady()
.openConnector(CONNECTOR_FOR_UPDATE.getName());
connectorsView.waitUntilScreenReady()
.openConfigTab() .openConfigTab()
.setConfig(CONNECTOR_FOR_UPDATE.getConfig()); .setConfig(CONNECTOR_FOR_UPDATE.getConfig());
connectorsList.goTo(CLUSTER_NAME); connectorsList.goTo(CLUSTER_NAME);
@ -93,10 +91,8 @@ public class ConnectorsTests extends BaseTest {
@CaseId(195) @CaseId(195)
@Test @Test
public void deleteConnector() { public void deleteConnector() {
connectorsList.goTo(CLUSTER_NAME) connectorsView.goTo(CLUSTER_NAME, CONNECTOR_FOR_DELETE.getName())
.waitUntilScreenReady() .clickDeleteButton();
.openConnector(CONNECTOR_FOR_DELETE.getName());
connectorsView.clickDeleteButton();
connectorsList.goTo(CLUSTER_NAME); 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); CONNECTOR_LIST.remove(CONNECTOR_FOR_DELETE);
@ -105,7 +101,7 @@ public class ConnectorsTests extends BaseTest {
@AfterAll @AfterAll
public void afterAll() { public void afterAll() {
CONNECTOR_LIST.forEach(connector -> CONNECTOR_LIST.forEach(connector ->
apiHelpers.deleteConnector(CLUSTER_NAME, CONNECT_NAME, connector.getName())); apiHelper.deleteConnector(CLUSTER_NAME, CONNECT_NAME, connector.getName()));
TOPIC_LIST.forEach(topic -> apiHelpers.deleteTopic(CLUSTER_NAME, topic.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.base.BaseTest;
import com.provectus.kafka.ui.models.Schema; import com.provectus.kafka.ui.models.Schema;
import com.provectus.kafka.ui.pages.MainPage; 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.AutomationStatus;
import com.provectus.kafka.ui.utilities.qaseIoUtils.annotations.Suite; import com.provectus.kafka.ui.utilities.qaseIoUtils.annotations.Suite;
import com.provectus.kafka.ui.utilities.qaseIoUtils.enums.Status; import com.provectus.kafka.ui.utilities.qaseIoUtils.enums.Status;
@ -32,7 +30,7 @@ public class SchemasTests extends BaseTest {
@SneakyThrows @SneakyThrows
public void beforeAll() { public void beforeAll() {
SCHEMA_LIST.addAll(List.of(AVRO_API, JSON_API, PROTOBUF_API)); 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") @DisplayName("should create AVRO schema")
@ -45,7 +43,7 @@ public class SchemasTests extends BaseTest {
Schema schemaAvro = Schema.createSchemaAvro(); Schema schemaAvro = Schema.createSchemaAvro();
mainPage.goTo() mainPage.goTo()
.goToSideMenu(CLUSTER_NAME, MainPage.SideMenuOptions.SCHEMA_REGISTRY); .goToSideMenu(CLUSTER_NAME, MainPage.SideMenuOptions.SCHEMA_REGISTRY);
schemaRegistry.clickCreateSchema() schemaRegistryList.clickCreateSchema()
.setSubjectName(schemaAvro.getName()) .setSubjectName(schemaAvro.getName())
.setSchemaField(fileToString(schemaAvro.getValuePath())) .setSchemaField(fileToString(schemaAvro.getValuePath()))
.selectSchemaTypeFromDropdown(schemaAvro.getType()) .selectSchemaTypeFromDropdown(schemaAvro.getType())
@ -53,7 +51,7 @@ public class SchemasTests extends BaseTest {
.waitUntilScreenReady(); .waitUntilScreenReady();
mainPage.goTo() mainPage.goTo()
.goToSideMenu(CLUSTER_NAME, MainPage.SideMenuOptions.SCHEMA_REGISTRY); .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); 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"); AVRO_API.setValuePath(System.getProperty("user.dir") + "/src/main/resources/testData/schema_avro_for_update.json");
mainPage.goTo() mainPage.goTo()
.goToSideMenu(CLUSTER_NAME, MainPage.SideMenuOptions.SCHEMA_REGISTRY); .goToSideMenu(CLUSTER_NAME, MainPage.SideMenuOptions.SCHEMA_REGISTRY);
schemaRegistry.openSchema(AVRO_API.getName()) schemaRegistryList.openSchema(AVRO_API.getName())
.waitUntilScreenReady() .waitUntilScreenReady()
.openEditSchema(); .openEditSchema();
Assertions.assertTrue(new SchemaEditView().isSchemaDropDownDisabled(),"isSchemaDropDownDisabled()"); Assertions.assertTrue(schemaEditView.isSchemaDropDownDisabled(), "isSchemaDropDownDisabled()");
new SchemaEditView().selectCompatibilityLevelFromDropdown(CompatibilityLevel.CompatibilityEnum.NONE) schemaEditView.selectCompatibilityLevelFromDropdown(CompatibilityLevel.CompatibilityEnum.NONE)
.setNewSchemaValue(fileToString(AVRO_API.getValuePath())) .setNewSchemaValue(fileToString(AVRO_API.getValuePath()))
.clickSubmit() .clickSubmit()
.waitUntilScreenReady(); .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") @DisplayName("should delete AVRO schema")
@ -87,10 +85,10 @@ public class SchemasTests extends BaseTest {
void deleteSchemaAvro() { void deleteSchemaAvro() {
mainPage.goTo() mainPage.goTo()
.goToSideMenu(CLUSTER_NAME, MainPage.SideMenuOptions.SCHEMA_REGISTRY); .goToSideMenu(CLUSTER_NAME, MainPage.SideMenuOptions.SCHEMA_REGISTRY);
schemaRegistry.openSchema(AVRO_API.getName()) schemaRegistryList.openSchema(AVRO_API.getName())
.waitUntilScreenReady() .waitUntilScreenReady()
.removeSchema(); .removeSchema();
Assertions.assertFalse(schemaRegistry.isSchemaVisible(AVRO_API.getName()),"isSchemaVisible()"); Assertions.assertFalse(schemaRegistryList.isSchemaVisible(AVRO_API.getName()), "isSchemaVisible()");
SCHEMA_LIST.remove(AVRO_API); SCHEMA_LIST.remove(AVRO_API);
} }
@ -104,14 +102,14 @@ public class SchemasTests extends BaseTest {
Schema schemaJson = Schema.createSchemaJson(); Schema schemaJson = Schema.createSchemaJson();
mainPage.goTo() mainPage.goTo()
.goToSideMenu(CLUSTER_NAME, MainPage.SideMenuOptions.SCHEMA_REGISTRY); .goToSideMenu(CLUSTER_NAME, MainPage.SideMenuOptions.SCHEMA_REGISTRY);
schemaRegistry.clickCreateSchema() schemaRegistryList.clickCreateSchema()
.setSubjectName(schemaJson.getName()) .setSubjectName(schemaJson.getName())
.setSchemaField(fileToString(schemaJson.getValuePath())) .setSchemaField(fileToString(schemaJson.getValuePath()));
.selectSchemaTypeFromDropdown(schemaJson.getType()) schemaEditView.selectSchemaTypeFromDropdown(schemaJson.getType())
.clickSubmit() .clickSubmit()
.waitUntilScreenReady(); .waitUntilScreenReady();
mainPage.goToSideMenu(CLUSTER_NAME, MainPage.SideMenuOptions.SCHEMA_REGISTRY); 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); SCHEMA_LIST.add(schemaJson);
} }
@ -124,10 +122,10 @@ public class SchemasTests extends BaseTest {
void deleteSchemaJson() { void deleteSchemaJson() {
mainPage.goTo() mainPage.goTo()
.goToSideMenu(CLUSTER_NAME, MainPage.SideMenuOptions.SCHEMA_REGISTRY); .goToSideMenu(CLUSTER_NAME, MainPage.SideMenuOptions.SCHEMA_REGISTRY);
schemaRegistry.openSchema(JSON_API.getName()) schemaRegistryList.openSchema(JSON_API.getName())
.waitUntilScreenReady() .waitUntilScreenReady()
.removeSchema(); .removeSchema();
Assertions.assertFalse(schemaRegistry.isSchemaVisible(JSON_API.getName()),"isSchemaVisible()"); Assertions.assertFalse(schemaRegistryList.isSchemaVisible(JSON_API.getName()), "isSchemaVisible()");
SCHEMA_LIST.remove(JSON_API); SCHEMA_LIST.remove(JSON_API);
} }
@ -141,14 +139,14 @@ public class SchemasTests extends BaseTest {
Schema schemaProtobuf = Schema.createSchemaProtobuf(); Schema schemaProtobuf = Schema.createSchemaProtobuf();
mainPage.goTo() mainPage.goTo()
.goToSideMenu(CLUSTER_NAME, MainPage.SideMenuOptions.SCHEMA_REGISTRY); .goToSideMenu(CLUSTER_NAME, MainPage.SideMenuOptions.SCHEMA_REGISTRY);
schemaRegistry.clickCreateSchema() schemaRegistryList.clickCreateSchema()
.setSubjectName(schemaProtobuf.getName()) .setSubjectName(schemaProtobuf.getName())
.setSchemaField(fileToString(schemaProtobuf.getValuePath())) .setSchemaField(fileToString(schemaProtobuf.getValuePath()));
.selectSchemaTypeFromDropdown(schemaProtobuf.getType()) schemaEditView.selectSchemaTypeFromDropdown(schemaProtobuf.getType())
.clickSubmit() .clickSubmit()
.waitUntilScreenReady(); .waitUntilScreenReady();
mainPage.goToSideMenu(CLUSTER_NAME, MainPage.SideMenuOptions.SCHEMA_REGISTRY); 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); SCHEMA_LIST.add(schemaProtobuf);
} }
@ -161,15 +159,15 @@ public class SchemasTests extends BaseTest {
void deleteSchemaProtobuf() { void deleteSchemaProtobuf() {
mainPage.goTo() mainPage.goTo()
.goToSideMenu(CLUSTER_NAME, MainPage.SideMenuOptions.SCHEMA_REGISTRY); .goToSideMenu(CLUSTER_NAME, MainPage.SideMenuOptions.SCHEMA_REGISTRY);
schemaRegistry.openSchema(PROTOBUF_API.getName()) schemaRegistryList.openSchema(PROTOBUF_API.getName())
.waitUntilScreenReady() .waitUntilScreenReady()
.removeSchema(); .removeSchema();
Assertions.assertFalse(schemaRegistry.isSchemaVisible(PROTOBUF_API.getName()),"isSchemaVisible()"); Assertions.assertFalse(schemaRegistryList.isSchemaVisible(PROTOBUF_API.getName()), "isSchemaVisible()");
SCHEMA_LIST.remove(PROTOBUF_API); SCHEMA_LIST.remove(PROTOBUF_API);
} }
@AfterAll @AfterAll
public void 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.base.BaseTest;
import com.provectus.kafka.ui.models.Topic; 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.pages.topic.TopicView;
import com.provectus.kafka.ui.utilities.qaseIoUtils.annotations.AutomationStatus; 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.annotations.Suite;
@ -35,7 +33,7 @@ public class TopicTests extends BaseTest {
@BeforeAll @BeforeAll
public void beforeAll() { public void beforeAll() {
TOPIC_LIST.addAll(List.of(TOPIC_FOR_UPDATE, TOPIC_FOR_DELETE)); 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") @DisplayName("should create a topic")
@ -45,14 +43,14 @@ public class TopicTests extends BaseTest {
@Test @Test
public void createTopic() { public void createTopic() {
Topic topicToCreate = new Topic().setName("new-topic"); Topic topicToCreate = new Topic().setName("new-topic");
mainPage.goTo() topicsList.goTo(CLUSTER_NAME)
.goToSideMenu(CLUSTER_NAME, MainPage.SideMenuOptions.TOPICS); .waitUntilScreenReady()
topicsList.pressCreateNewTopic() .pressCreateNewTopic()
.setTopicName(topicToCreate.getName()) .setTopicName(topicToCreate.getName())
.sendData() .sendData()
.waitUntilScreenReady(); .waitUntilScreenReady();
mainPage.goTo() topicsList.goTo(CLUSTER_NAME)
.goToSideMenu(CLUSTER_NAME, MainPage.SideMenuOptions.TOPICS); .waitUntilScreenReady();
Assertions.assertTrue(topicsList.isTopicVisible(topicToCreate.getName()), "isTopicVisible"); Assertions.assertTrue(topicsList.isTopicVisible(topicToCreate.getName()), "isTopicVisible");
TOPIC_LIST.add(topicToCreate); TOPIC_LIST.add(topicToCreate);
} }
@ -82,10 +80,10 @@ public class TopicTests extends BaseTest {
.waitUntilScreenReady() .waitUntilScreenReady()
.openEditSettings(); .openEditSettings();
SoftAssertions softly = new SoftAssertions(); SoftAssertions softly = new SoftAssertions();
softly.assertThat(new TopicCreateEditSettingsView().getCleanupPolicy()).as("Cleanup Policy").isEqualTo(TOPIC_FOR_UPDATE.getCompactPolicyValue()); softly.assertThat(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(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(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.getMaxMessageBytes()).as("Max message bytes").isEqualTo(TOPIC_FOR_UPDATE.getMaxMessageBytes());
softly.assertAll(); softly.assertAll();
} }
@ -129,6 +127,6 @@ public class TopicTests extends BaseTest {
@AfterAll @AfterAll
public void afterAll() { public void afterAll() {
TOPIC_LIST.forEach(topic -> apiHelpers.deleteTopic(CLUSTER_NAME, topic.getName())); TOPIC_LIST.forEach(topic -> apiHelper.deleteTopic(CLUSTER_NAME, topic.getName()));
} }
} }