[e2e] review tests to use more object details while creating and updating #2699 (#2864)

* [e2e] review tests to use more object details while creating and updating#2699

* [e2e] review tests to use more object details while creating and updating#2699

* [e2e] review tests to use more object details while creating and updating#2699

* [e2e] review tests to use more object details while creating and updating#2699

* [e2e] review tests to use more object details while creating and updating#2699

* [e2e]Fix review tests to use more object details while creating and updating#2699

* [e2e]Fix2 review tests to use more object details while creating and updating#2699

* [e2e]Fix3 review tests to use more object details while creating and updating#2699

* [e2e]Fix3 review tests to use more object details while creating and updating#2699

* [e2e]Fix3 review tests to use more object details while creating and updating#2699

* [e2e]Fix3 review tests to use more object details while creating and updating#2699

* [e2e]Fix3 review tests to use more object details while creating and updating#2699

* [e2e]Fix without loadingSpinner.

* [e2e]Fix without loadingSpinner.

* [e2e]Fix without configTab.

* fix KafkaConnectList()

* [e2e]Fix with refresh.

* fix ConnectorsTests()

Co-authored-by: VladSenyuta <vlad.senyuta@gmail.com>
This commit is contained in:
Arthur 2022-11-04 14:03:33 +02:00 committed by GitHub
parent c4bbbbe3da
commit b1891c021b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 226 additions and 90 deletions

View file

@ -14,19 +14,19 @@ public class Schema {
private SchemaType type; private SchemaType type;
public static Schema createSchemaAvro(){ public static Schema createSchemaAvro(){
return new Schema().setName(randomAlphabetic(10)) return new Schema().setName("schema_avro-" + randomAlphabetic(5))
.setType(SchemaType.AVRO) .setType(SchemaType.AVRO)
.setValuePath(System.getProperty("user.dir") + "/src/main/resources/testData/schema_avro_value.json"); .setValuePath(System.getProperty("user.dir") + "/src/main/resources/testData/schema_avro_value.json");
} }
public static Schema createSchemaJson(){ public static Schema createSchemaJson(){
return new Schema().setName(randomAlphabetic(10)) return new Schema().setName("schema_json-" + randomAlphabetic(5))
.setType(SchemaType.JSON) .setType(SchemaType.JSON)
.setValuePath(System.getProperty("user.dir") + "/src/main/resources/testData/schema_Json_Value.json"); .setValuePath(System.getProperty("user.dir") + "/src/main/resources/testData/schema_Json_Value.json");
} }
public static Schema createSchemaProtobuf(){ public static Schema createSchemaProtobuf(){
return new Schema().setName(randomAlphabetic(10)) return new Schema().setName("schema_protobuf-" + randomAlphabetic(5))
.setType(SchemaType.PROTOBUF) .setType(SchemaType.PROTOBUF)
.setValuePath(System.getProperty("user.dir") + "/src/main/resources/testData/schema_protobuf_value.txt"); .setValuePath(System.getProperty("user.dir") + "/src/main/resources/testData/schema_protobuf_value.txt");
} }

View file

@ -1,10 +1,14 @@
package com.provectus.kafka.ui.models; package com.provectus.kafka.ui.models;
import com.provectus.kafka.ui.pages.topic.TopicCreateEditForm;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
@Data @Data
@Accessors(chain = true) @Accessors(chain = true)
public class Topic { public class Topic {
private String name, cleanupPolicyValue, timeToRetainData, maxSizeOnDisk, maxMessageBytes, messageKey, messageContent ; private String name, timeToRetainData, maxMessageBytes, messageKey, messageContent,
partitions, customParameter;
private TopicCreateEditForm.CleanupPolicyValue cleanupPolicyValue;
private TopicCreateEditForm.MaxSizeOnDisk maxSizeOnDisk;
} }

View file

@ -11,6 +11,7 @@ import java.util.stream.Stream;
import static com.codeborne.selenide.Selenide.$x; import static com.codeborne.selenide.Selenide.$x;
import static com.provectus.kafka.ui.settings.Source.CLUSTER_NAME; import static com.provectus.kafka.ui.settings.Source.CLUSTER_NAME;
import static com.provectus.kafka.ui.utilities.WebUtils.clickByActions;
public class NaviSideBar { public class NaviSideBar {
@ -22,7 +23,7 @@ public class NaviSideBar {
private SelenideElement expandCluster(String clusterName) { private SelenideElement expandCluster(String clusterName) {
SelenideElement clusterElement = $x(String.format(clusterElementLocator, clusterName)).shouldBe(Condition.visible); SelenideElement clusterElement = $x(String.format(clusterElementLocator, clusterName)).shouldBe(Condition.visible);
if (clusterElement.parent().$$x(".//ul").size() == 0) { if (clusterElement.parent().$$x(".//ul").size() == 0) {
clusterElement.click(); clickByActions(clusterElement);
} }
return clusterElement; return clusterElement;
} }
@ -36,10 +37,8 @@ public class NaviSideBar {
@Step @Step
public NaviSideBar openSideMenu(String clusterName, SideMenuOption option) { public NaviSideBar openSideMenu(String clusterName, SideMenuOption option) {
expandCluster(clusterName) clickByActions(expandCluster(clusterName).parent()
.parent() .$x(String.format(sideMenuOptionElementLocator, option.value)));
.$x(String.format(sideMenuOptionElementLocator, option.value))
.click();
return this; return this;
} }

View file

@ -5,6 +5,7 @@ import com.codeborne.selenide.SelenideElement;
import io.qameta.allure.Step; import io.qameta.allure.Step;
import static com.codeborne.selenide.Selenide.$x; import static com.codeborne.selenide.Selenide.$x;
import static com.codeborne.selenide.Selenide.refresh;
import static com.provectus.kafka.ui.utilities.WebUtils.clickByJavaScript; import static com.provectus.kafka.ui.utilities.WebUtils.clickByJavaScript;
public class ConnectorCreateForm { public class ConnectorCreateForm {
@ -23,11 +24,16 @@ public class ConnectorCreateForm {
} }
@Step @Step
public ConnectorCreateForm setConnectorConfig(String connectName, String configJson) { public ConnectorCreateForm setConnectorDetails(String connectName, String configJson) {
nameField.shouldBe(Condition.enabled).setValue(connectName); nameField.shouldBe(Condition.enabled).setValue(connectName);
configField.shouldBe(Condition.enabled).click(); configField.shouldBe(Condition.enabled).click();
contentTextArea.setValue(configJson); contentTextArea.setValue(configJson);
nameField.shouldBe(Condition.enabled).click(); nameField.shouldBe(Condition.enabled).click();
return this;
}
@Step
public ConnectorCreateForm clickSubmitButton() {
clickByJavaScript(submitBtn); clickByJavaScript(submitBtn);
loadingSpinner.shouldBe(Condition.disappear); loadingSpinner.shouldBe(Condition.disappear);
return this; return this;

View file

@ -1,14 +1,15 @@
package com.provectus.kafka.ui.pages.connector; package com.provectus.kafka.ui.pages.connector;
import com.codeborne.selenide.Condition;
import com.codeborne.selenide.SelenideElement;
import io.qameta.allure.Step;
import java.util.Arrays;
import static com.codeborne.selenide.Selenide.$x; import static com.codeborne.selenide.Selenide.$x;
import static com.provectus.kafka.ui.utilities.WebUtils.clearByKeyboard; import static com.provectus.kafka.ui.utilities.WebUtils.clearByKeyboard;
import static com.provectus.kafka.ui.utilities.WebUtils.clickByJavaScript; import static com.provectus.kafka.ui.utilities.WebUtils.clickByJavaScript;
import static com.provectus.kafka.ui.utilities.WebUtils.isVisible;
import com.codeborne.selenide.Condition;
import com.codeborne.selenide.SelenideElement;
import io.qameta.allure.Step;
import java.time.Duration;
import java.util.Arrays;
public class ConnectorDetails { public class ConnectorDetails {
@ -22,12 +23,12 @@ public class ConnectorDetails {
protected SelenideElement configTab = $x("//a[contains(text(),'Config')]"); protected SelenideElement configTab = $x("//a[contains(text(),'Config')]");
protected SelenideElement configField = $x("//div[@id='config']"); protected SelenideElement configField = $x("//div[@id='config']");
protected SelenideElement successAlertMessage = $x("//div[contains(text(),'Config successfully updated')]"); protected SelenideElement successAlertMessage = $x("//div[contains(text(),'Config successfully updated')]");
protected String connectorHeaderLocator = "//h1[contains(text(),'%s')]";
@Step @Step
public ConnectorDetails waitUntilScreenReady() { public ConnectorDetails waitUntilScreenReady() {
loadingSpinner.shouldBe(Condition.disappear); loadingSpinner.shouldBe(Condition.disappear);
Arrays.asList(taskTab,configTab).forEach(elementsMenu -> elementsMenu.shouldBe(Condition.visible)); dotMenuBtn.shouldBe(Condition.visible);
return this; return this;
} }
@ -43,6 +44,11 @@ public class ConnectorDetails {
clearByKeyboard(contentTextArea); clearByKeyboard(contentTextArea);
contentTextArea.setValue(configJson); contentTextArea.setValue(configJson);
configField.shouldBe(Condition.enabled).click(); configField.shouldBe(Condition.enabled).click();
return this;
}
@Step
public ConnectorDetails clickSubmitButton() {
clickByJavaScript(submitBtn); clickByJavaScript(submitBtn);
successAlertMessage.shouldBe(Condition.visible); successAlertMessage.shouldBe(Condition.visible);
return this; return this;
@ -74,4 +80,9 @@ public class ConnectorDetails {
clickConfirmBtn(); clickConfirmBtn();
return this; return this;
} }
@Step
public boolean isConnectorHeaderVisible(String connectorName) {
return isVisible($x(String.format(connectorHeaderLocator,connectorName)));
}
} }

View file

@ -15,15 +15,14 @@ import static com.provectus.kafka.ui.utilities.WebUtils.isVisible;
public class KafkaConnectList { public class KafkaConnectList {
protected SelenideElement loadingSpinner = $x("//*[contains(text(),'Loading')]"); protected SelenideElement loadingSpinner = $x("//*[contains(text(),'Loading')]");
protected SelenideElement pageTitle = $x("//h1[text()='Connectors']");
protected SelenideElement createConnectorBtn = $x("//button[contains(text(),'Create Connector')]"); protected SelenideElement createConnectorBtn = $x("//button[contains(text(),'Create Connector')]");
protected SelenideElement connectorsGrid = $x("//table"); protected SelenideElement connectorsGrid = $x("//table");
protected String tabElementLocator = "//td[contains(text(),'%s')]"; protected String connectorNameLocator = "//td[contains(text(),'%s')]";
@Step @Step
public KafkaConnectList waitUntilScreenReady() { public KafkaConnectList waitUntilScreenReady() {
loadingSpinner.shouldBe(Condition.disappear); loadingSpinner.shouldBe(Condition.disappear);
pageTitle.shouldBe(Condition.visible); createConnectorBtn.shouldBe(Condition.visible);
return this; return this;
} }
@ -35,7 +34,7 @@ public class KafkaConnectList {
@Step @Step
public KafkaConnectList openConnector(String connectorName) { public KafkaConnectList openConnector(String connectorName) {
$x(String.format(tabElementLocator,connectorName)) $x(String.format(connectorNameLocator, connectorName))
.shouldBe(Condition.enabled).click(); .shouldBe(Condition.enabled).click();
return this; return this;
} }
@ -43,13 +42,13 @@ public class KafkaConnectList {
@Step @Step
public boolean isConnectorVisible(String connectorName) { public boolean isConnectorVisible(String connectorName) {
connectorsGrid.shouldBe(Condition.visible); connectorsGrid.shouldBe(Condition.visible);
return isVisible($x(String.format(tabElementLocator,connectorName))); return isVisible($x(String.format(connectorNameLocator,connectorName)));
} }
@Step @Step
public KafkaConnectList connectorIsUpdatedInList(String connectorName, String topicName) { public KafkaConnectList connectorIsUpdatedInList(String connectorName, String topicName) {
$x(String.format(tabElementLocator,connectorName)).shouldBe(Condition.visible); $x(String.format(connectorNameLocator,connectorName)).shouldBe(Condition.visible);
By.xpath(String.format(tabElementLocator,topicName)).refreshUntil(Condition.visible); By.xpath(String.format(connectorNameLocator,topicName)).refreshUntil(Condition.visible);
return this; return this;
} }
} }

View file

@ -7,6 +7,7 @@ import io.qameta.allure.Step;
import static com.codeborne.selenide.Selenide.$$x; import static com.codeborne.selenide.Selenide.$$x;
import static com.codeborne.selenide.Selenide.$x; import static com.codeborne.selenide.Selenide.$x;
import static com.provectus.kafka.ui.utilities.WebUtils.clickByJavaScript; import static com.provectus.kafka.ui.utilities.WebUtils.clickByJavaScript;
import static com.provectus.kafka.ui.utilities.WebUtils.isVisible;
public class SchemaDetails { public class SchemaDetails {
@ -17,6 +18,8 @@ public class SchemaDetails {
protected SelenideElement editSchemaBtn = $x("//button[contains(text(),'Edit Schema')]"); protected SelenideElement editSchemaBtn = $x("//button[contains(text(),'Edit Schema')]");
protected SelenideElement removeBtn = $x("//*[contains(text(),'Remove')]"); protected SelenideElement removeBtn = $x("//*[contains(text(),'Remove')]");
protected SelenideElement confirmBtn = $x("//div[@role='dialog']//button[contains(text(),'Confirm')]"); protected SelenideElement confirmBtn = $x("//div[@role='dialog']//button[contains(text(),'Confirm')]");
protected SelenideElement schemaTypeDdl = $x("//h4[contains(text(),'Type')]/../p");
protected String schemaHeaderLocator = "//h1[contains(text(),'%s')]";
@Step @Step
public SchemaDetails waitUntilScreenReady() { public SchemaDetails waitUntilScreenReady() {
@ -30,6 +33,16 @@ public class SchemaDetails {
return compatibilityField.getText(); return compatibilityField.getText();
} }
@Step
public boolean isSchemaHeaderVisible(String schemaName) {
return isVisible($x(String.format(schemaHeaderLocator,schemaName)));
}
@Step
public String getSchemaType() {
return schemaTypeDdl.getText();
}
@Step @Step
public SchemaDetails openEditSchema(){ public SchemaDetails openEditSchema(){
editSchemaBtn.shouldBe(Condition.visible).click(); editSchemaBtn.shouldBe(Condition.visible).click();

View file

@ -14,12 +14,14 @@ public class TopicCreateEditForm {
protected SelenideElement loadingSpinner = $x("//*[contains(text(),'Loading')]"); protected SelenideElement loadingSpinner = $x("//*[contains(text(),'Loading')]");
protected SelenideElement timeToRetainField = $x("//input[@id='timeToRetain']"); protected SelenideElement timeToRetainField = $x("//input[@id='timeToRetain']");
protected SelenideElement partitionsField = $x("//input[@name='partitions']");
protected SelenideElement nameField = $x("//input[@name='name']"); protected SelenideElement nameField = $x("//input[@name='name']");
protected SelenideElement maxMessageBytesField = $x("//input[@name='maxMessageBytes']"); protected SelenideElement maxMessageBytesField = $x("//input[@name='maxMessageBytes']");
protected SelenideElement minInSyncReplicasField = $x("//input[@name='minInSyncReplicas']"); protected SelenideElement minInSyncReplicasField = $x("//input[@name='minInSyncReplicas']");
protected SelenideElement cleanUpPolicyDdl = $x("//ul[@id='topicFormCleanupPolicy']"); protected SelenideElement cleanUpPolicyDdl = $x("//ul[@id='topicFormCleanupPolicy']");
protected SelenideElement maxSizeOnDiscDdl = $x("//ul[@id='topicFormRetentionBytes']");
protected SelenideElement createTopicBtn = $x("//button[@type='submit']"); protected SelenideElement createTopicBtn = $x("//button[@type='submit']");
protected String cleanUpPolicyTypeLocator = "//li[text()='%s']"; protected String ddlElementLocator = "//li[@value='%s']";
@Step @Step
public TopicCreateEditForm waitUntilScreenReady(){ public TopicCreateEditForm waitUntilScreenReady(){
@ -53,8 +55,9 @@ public class TopicCreateEditForm {
} }
@Step @Step
public TopicCreateEditForm setMaxSizeOnDiskInGB(String value) { public TopicCreateEditForm setMaxSizeOnDiskInGB(MaxSizeOnDisk MaxSizeOnDisk) {
new KafkaUISelectElement("retentionBytes").selectByVisibleText(value); maxSizeOnDiscDdl.shouldBe(Condition.visible).click();
$x(String.format(ddlElementLocator, MaxSizeOnDisk.getOptionValue())).shouldBe(Condition.visible).click();
return this; return this;
} }
@ -69,6 +72,12 @@ public class TopicCreateEditForm {
return setMaxMessageBytes(Long.parseLong(bytes)); return setMaxMessageBytes(Long.parseLong(bytes));
} }
@Step
public TopicCreateEditForm setPartitions(String partitions){
partitionsField.setValue(partitions);
return this;
}
@Step @Step
public TopicCreateEditForm setTimeToRetainDataInMsUsingButtons(String value) { public TopicCreateEditForm setTimeToRetainDataInMsUsingButtons(String value) {
timeToRetainField timeToRetainField
@ -81,15 +90,9 @@ public class TopicCreateEditForm {
} }
@Step @Step
public TopicCreateEditForm selectCleanupPolicy(CleanupPolicyValue cleanupPolicyValue) { public TopicCreateEditForm selectCleanupPolicy(CleanupPolicyValue cleanupPolicyOptionValue) {
return selectFromDropDownByOptionValue("cleanupPolicy",
cleanupPolicyValue.getOptionValue());
}
@Step
public TopicCreateEditForm selectCleanupPolicy(String cleanupPolicyOptionValue) {
cleanUpPolicyDdl.shouldBe(Condition.visible).click(); cleanUpPolicyDdl.shouldBe(Condition.visible).click();
$x(String.format(cleanUpPolicyTypeLocator,cleanupPolicyOptionValue)).shouldBe(Condition.visible).click(); $x(String.format(ddlElementLocator,cleanupPolicyOptionValue.getOptionValue())).shouldBe(Condition.visible).click();
return this; return this;
} }
@ -242,6 +245,30 @@ public class TopicCreateEditForm {
} }
} }
public enum MaxSizeOnDisk {
NOT_SET("-1", "Not Set"),
SIZE_1_GB("1073741824", "1 GB"),
SIZE_10_GB("10737418240", "10 GB"),
SIZE_20_GB("21474836480", "20 GB"),
SIZE_50_GB("53687091200", "50 GB");
private final String optionValue;
private final String visibleText;
MaxSizeOnDisk(String optionValue, String visibleText) {
this.optionValue = optionValue;
this.visibleText = visibleText;
}
public String getOptionValue() {
return optionValue;
}
public String getVisibleText() {
return visibleText;
}
}
private TopicCreateEditForm selectFromDropDownByOptionValue(String dropDownElementName, private TopicCreateEditForm selectFromDropDownByOptionValue(String dropDownElementName,
String optionValue) { String optionValue) {
KafkaUISelectElement select = new KafkaUISelectElement(dropDownElementName); KafkaUISelectElement select = new KafkaUISelectElement(dropDownElementName);

View file

@ -11,6 +11,7 @@ import java.util.Arrays;
import static com.codeborne.selenide.Selenide.*; import static com.codeborne.selenide.Selenide.*;
import static com.provectus.kafka.ui.utilities.WebUtils.clickByJavaScript; import static com.provectus.kafka.ui.utilities.WebUtils.clickByJavaScript;
import static com.provectus.kafka.ui.utilities.WebUtils.isVisible;
@ExtensionMethod({WaitUtils.class}) @ExtensionMethod({WaitUtils.class})
public class TopicDetails { public class TopicDetails {
@ -26,7 +27,10 @@ public class TopicDetails {
protected SelenideElement confirmBtn = $x("//div[@role='dialog']//button[contains(text(),'Confirm')]"); protected SelenideElement confirmBtn = $x("//div[@role='dialog']//button[contains(text(),'Confirm')]");
protected SelenideElement produceMessageBtn = $x("//div//button[text()='Produce Message']"); protected SelenideElement produceMessageBtn = $x("//div//button[text()='Produce Message']");
protected SelenideElement contentMessageTab = $x("//html//div[@id='root']/div/main//table//p"); protected SelenideElement contentMessageTab = $x("//html//div[@id='root']/div/main//table//p");
protected SelenideElement cleanUpPolicyField = $x("//div[contains(text(),'Clean Up Policy')]/../span/*");
protected SelenideElement partitionsField = $x("//div[contains(text(),'Partitions')]/../span");
protected String consumerIdLocator = "//a[@title='%s']"; protected String consumerIdLocator = "//a[@title='%s']";
protected String topicHeaderLocator = "//h1[contains(text(),'%s')]";
@Step @Step
public TopicDetails waitUntilScreenReady() { public TopicDetails waitUntilScreenReady() {
@ -54,6 +58,21 @@ public class TopicDetails {
return this; return this;
} }
@Step
public String getCleanUpPolicy(){
return cleanUpPolicyField.getText();
}
@Step
public String getPartitions(){
return partitionsField.getText();
}
@Step
public boolean isTopicHeaderVisible(String topicName) {
return isVisible($x(String.format(topicHeaderLocator,topicName)));
}
@Step @Step
public TopicDetails clickClearMessagesBtn() { public TopicDetails clickClearMessagesBtn() {
clearMessagesBtn.shouldBe(Condition.visible.because("Clear Messages invisible")).click(); clearMessagesBtn.shouldBe(Condition.visible.because("Clear Messages invisible")).click();
@ -74,7 +93,6 @@ public class TopicDetails {
clickByJavaScript(produceMessageBtn); clickByJavaScript(produceMessageBtn);
return this; return this;
} }
@Step @Step
public TopicDetails openConsumerGroup(String consumerId) { public TopicDetails openConsumerGroup(String consumerId) {
$x(String.format(consumerIdLocator, consumerId)).click(); $x(String.format(consumerIdLocator, consumerId)).click();

View file

@ -2,14 +2,25 @@ package com.provectus.kafka.ui.utilities;
import com.codeborne.selenide.Condition; import com.codeborne.selenide.Condition;
import com.codeborne.selenide.SelenideElement; import com.codeborne.selenide.SelenideElement;
import com.codeborne.selenide.WebDriverRunner;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.openqa.selenium.Keys; import org.openqa.selenium.Keys;
import org.openqa.selenium.interactions.Actions;
import static com.codeborne.selenide.Selenide.executeJavaScript; import static com.codeborne.selenide.Selenide.executeJavaScript;
@Slf4j @Slf4j
public class WebUtils { public class WebUtils {
public static void clickByActions(SelenideElement element) {
log.debug("\nclickByActions: {}", element.getSearchCriteria());
element.shouldBe(Condition.enabled);
new Actions(WebDriverRunner.getWebDriver())
.moveToElement(element)
.click(element)
.perform();
}
public static void clickByJavaScript(SelenideElement element) { public static void clickByJavaScript(SelenideElement element) {
log.debug("\nclickByJavaScript: {}", element.getSearchCriteria()); log.debug("\nclickByJavaScript: {}", element.getSearchCriteria());
element.shouldBe(Condition.enabled); element.shouldBe(Condition.enabled);
@ -34,4 +45,5 @@ public class WebUtils {
} }
return isVisible; return isVisible;
} }
} }

View file

@ -15,6 +15,7 @@ import java.util.List;
import static com.provectus.kafka.ui.pages.NaviSideBar.SideMenuOption.KAFKA_CONNECT; import static com.provectus.kafka.ui.pages.NaviSideBar.SideMenuOption.KAFKA_CONNECT;
import static com.provectus.kafka.ui.settings.Source.CLUSTER_NAME; import static com.provectus.kafka.ui.settings.Source.CLUSTER_NAME;
import static com.provectus.kafka.ui.utilities.FileUtils.getResourceAsString; import static com.provectus.kafka.ui.utilities.FileUtils.getResourceAsString;
import static org.apache.commons.lang.RandomStringUtils.randomAlphabetic;
@TestInstance(TestInstance.Lifecycle.PER_CLASS) @TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class ConnectorsTests extends BaseTest { public class ConnectorsTests extends BaseTest {
@ -26,19 +27,19 @@ public class ConnectorsTests extends BaseTest {
private static final String MESSAGE_CONTENT = "message_content_create_topic.json"; private static final String MESSAGE_CONTENT = "message_content_create_topic.json";
private static final String MESSAGE_KEY = " "; private static final String MESSAGE_KEY = " ";
private static final Topic TOPIC_FOR_CREATE = new Topic() private static final Topic TOPIC_FOR_CREATE = new Topic()
.setName("topic_for_create_connector") .setName("topic_for_create_connector-" + randomAlphabetic(5))
.setMessageContent(MESSAGE_CONTENT).setMessageKey(MESSAGE_KEY); .setMessageContent(MESSAGE_CONTENT).setMessageKey(MESSAGE_KEY);
private static final Topic TOPIC_FOR_DELETE = new Topic() private static final Topic TOPIC_FOR_DELETE = new Topic()
.setName("topic_for_delete_connector") .setName("topic_for_delete_connector-" + randomAlphabetic(5))
.setMessageContent(MESSAGE_CONTENT).setMessageKey(MESSAGE_KEY); .setMessageContent(MESSAGE_CONTENT).setMessageKey(MESSAGE_KEY);
private static final Topic TOPIC_FOR_UPDATE = new Topic() private static final Topic TOPIC_FOR_UPDATE = new Topic()
.setName("topic_for_update_connector") .setName("topic_for_update_connector-" + randomAlphabetic(5))
.setMessageContent(MESSAGE_CONTENT).setMessageKey(MESSAGE_KEY); .setMessageContent(MESSAGE_CONTENT).setMessageKey(MESSAGE_KEY);
private static final Connector CONNECTOR_FOR_DELETE = new Connector() private static final Connector CONNECTOR_FOR_DELETE = new Connector()
.setName("sink_postgres_activities_e2e_checks_for_delete") .setName("sink_postgres_activities_e2e_checks_for_delete-" + randomAlphabetic(5))
.setConfig(getResourceAsString("delete_connector_config.json")); .setConfig(getResourceAsString("delete_connector_config.json"));
private static final Connector CONNECTOR_FOR_UPDATE = new Connector() private static final Connector CONNECTOR_FOR_UPDATE = new Connector()
.setName("sink_postgres_activities_e2e_checks_for_update") .setName("sink_postgres_activities_e2e_checks_for_update-" + randomAlphabetic(5))
.setConfig(getResourceAsString("config_for_create_connector_via_api.json")); .setConfig(getResourceAsString("config_for_create_connector_via_api.json"));
@BeforeAll @BeforeAll
@ -60,7 +61,7 @@ public class ConnectorsTests extends BaseTest {
@Test @Test
public void createConnector() { public void createConnector() {
Connector connectorForCreate = new Connector() Connector connectorForCreate = new Connector()
.setName("sink_postgres_activities_e2e_checks") .setName("sink_postgres_activities_e2e_checks-" + randomAlphabetic(5))
.setConfig(getResourceAsString("config_for_create_connector.json")); .setConfig(getResourceAsString("config_for_create_connector.json"));
naviSideBar naviSideBar
.openSideMenu(KAFKA_CONNECT); .openSideMenu(KAFKA_CONNECT);
@ -69,12 +70,23 @@ public class ConnectorsTests extends BaseTest {
.clickCreateConnectorBtn(); .clickCreateConnectorBtn();
connectorCreateForm connectorCreateForm
.waitUntilScreenReady() .waitUntilScreenReady()
.setConnectorConfig(connectorForCreate.getName(), connectorForCreate.getConfig()); .setConnectorDetails(connectorForCreate.getName(), connectorForCreate.getConfig())
.clickSubmitButton();
connectorDetails
.waitUntilScreenReady();
naviSideBar
.openSideMenu(KAFKA_CONNECT);
kafkaConnectList
.waitUntilScreenReady()
.openConnector(connectorForCreate.getName());
connectorDetails
.waitUntilScreenReady();
Assertions.assertTrue(connectorDetails.isConnectorHeaderVisible(connectorForCreate.getName()),"isConnectorTitleVisible()");
naviSideBar naviSideBar
.openSideMenu(KAFKA_CONNECT); .openSideMenu(KAFKA_CONNECT);
kafkaConnectList kafkaConnectList
.waitUntilScreenReady(); .waitUntilScreenReady();
Assertions.assertTrue(kafkaConnectList.isConnectorVisible(connectorForCreate.getName()), "isConnectorVisible()"); Assertions.assertTrue(kafkaConnectList.isConnectorVisible(CONNECTOR_FOR_DELETE.getName()), "isConnectorVisible()");
CONNECTOR_LIST.add(connectorForCreate); CONNECTOR_LIST.add(connectorForCreate);
} }
@ -92,7 +104,8 @@ public class ConnectorsTests extends BaseTest {
connectorDetails connectorDetails
.waitUntilScreenReady() .waitUntilScreenReady()
.openConfigTab() .openConfigTab()
.setConfig(CONNECTOR_FOR_UPDATE.getConfig()); .setConfig(CONNECTOR_FOR_UPDATE.getConfig())
.clickSubmitButton();
naviSideBar naviSideBar
.openSideMenu(KAFKA_CONNECT); .openSideMenu(KAFKA_CONNECT);
kafkaConnectList kafkaConnectList

View file

@ -8,6 +8,7 @@ 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;
import io.qase.api.annotation.CaseId; import io.qase.api.annotation.CaseId;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import org.assertj.core.api.SoftAssertions;
import org.junit.jupiter.api.*; import org.junit.jupiter.api.*;
import java.util.ArrayList; import java.util.ArrayList;
@ -54,11 +55,16 @@ public class SchemasTests extends BaseTest {
.clickSubmitBtn(); .clickSubmitBtn();
schemaDetails schemaDetails
.waitUntilScreenReady(); .waitUntilScreenReady();
SoftAssertions softly = new SoftAssertions();
softly.assertThat(schemaDetails.isSchemaHeaderVisible(schemaAvro.getName())).as("isSchemaHeaderVisible()").isTrue();
softly.assertThat(schemaDetails.getSchemaType()).as("getSchemaType()").isEqualTo(schemaAvro.getType().getValue());
softly.assertThat(schemaDetails.getCompatibility()).as("getCompatibility()").isEqualTo(CompatibilityLevel.CompatibilityEnum.BACKWARD.getValue());
softly.assertAll();
naviSideBar naviSideBar
.openSideMenu(SCHEMA_REGISTRY); .openSideMenu(SCHEMA_REGISTRY);
schemaRegistryList schemaRegistryList
.waitUntilScreenReady(); .waitUntilScreenReady();
Assertions.assertTrue(schemaRegistryList.isSchemaVisible(schemaAvro.getName()),"isSchemaVisible()"); Assertions.assertTrue(schemaRegistryList.isSchemaVisible(AVRO_API.getName()),"isSchemaVisible()");
SCHEMA_LIST.add(schemaAvro); SCHEMA_LIST.add(schemaAvro);
} }
@ -131,11 +137,16 @@ public class SchemasTests extends BaseTest {
.clickSubmitBtn(); .clickSubmitBtn();
schemaDetails schemaDetails
.waitUntilScreenReady(); .waitUntilScreenReady();
SoftAssertions softly = new SoftAssertions();
softly.assertThat(schemaDetails.isSchemaHeaderVisible(schemaJson.getName())).as("isSchemaHeaderVisible()").isTrue();
softly.assertThat(schemaDetails.getSchemaType()).as("getSchemaType()").isEqualTo(schemaJson.getType().getValue());
softly.assertThat(schemaDetails.getCompatibility()).as("getCompatibility()").isEqualTo(CompatibilityLevel.CompatibilityEnum.BACKWARD.getValue());
softly.assertAll();
naviSideBar naviSideBar
.openSideMenu(SCHEMA_REGISTRY); .openSideMenu(SCHEMA_REGISTRY);
schemaRegistryList schemaRegistryList
.waitUntilScreenReady(); .waitUntilScreenReady();
Assertions.assertTrue(schemaRegistryList.isSchemaVisible(schemaJson.getName()),"isSchemaVisible()"); Assertions.assertTrue(schemaRegistryList.isSchemaVisible(JSON_API.getName()),"isSchemaVisible()");
SCHEMA_LIST.add(schemaJson); SCHEMA_LIST.add(schemaJson);
} }
@ -180,11 +191,16 @@ public class SchemasTests extends BaseTest {
.clickSubmitBtn(); .clickSubmitBtn();
schemaDetails schemaDetails
.waitUntilScreenReady(); .waitUntilScreenReady();
SoftAssertions softly = new SoftAssertions();
softly.assertThat(schemaDetails.isSchemaHeaderVisible(schemaProtobuf.getName())).as("isSchemaHeaderVisible()").isTrue();
softly.assertThat(schemaDetails.getSchemaType()).as("getSchemaType()").isEqualTo(schemaProtobuf.getType().getValue());
softly.assertThat(schemaDetails.getCompatibility()).as("getCompatibility()").isEqualTo(CompatibilityLevel.CompatibilityEnum.BACKWARD.getValue());
softly.assertAll();
naviSideBar naviSideBar
.openSideMenu(SCHEMA_REGISTRY); .openSideMenu(SCHEMA_REGISTRY);
schemaRegistryList schemaRegistryList
.waitUntilScreenReady(); .waitUntilScreenReady();
Assertions.assertTrue(schemaRegistryList.isSchemaVisible(schemaProtobuf.getName()),"isSchemaVisible()"); Assertions.assertTrue(schemaRegistryList.isSchemaVisible(PROTOBUF_API.getName()),"isSchemaVisible()");
SCHEMA_LIST.add(schemaProtobuf); SCHEMA_LIST.add(schemaProtobuf);
} }

View file

@ -15,29 +15,36 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import static com.provectus.kafka.ui.pages.NaviSideBar.SideMenuOption.TOPICS; import static com.provectus.kafka.ui.pages.NaviSideBar.SideMenuOption.TOPICS;
import static com.provectus.kafka.ui.pages.topic.TopicCreateEditForm.CleanupPolicyValue.COMPACT;
import static com.provectus.kafka.ui.pages.topic.TopicCreateEditForm.CleanupPolicyValue.DELETE;
import static com.provectus.kafka.ui.pages.topic.TopicCreateEditForm.MaxSizeOnDisk.SIZE_20_GB;
import static com.provectus.kafka.ui.settings.Source.CLUSTER_NAME; import static com.provectus.kafka.ui.settings.Source.CLUSTER_NAME;
import static com.provectus.kafka.ui.utilities.FileUtils.fileToString; import static com.provectus.kafka.ui.utilities.FileUtils.fileToString;
import static org.apache.commons.lang.RandomStringUtils.randomAlphabetic;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
@TestInstance(TestInstance.Lifecycle.PER_CLASS) @TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class TopicTests extends BaseTest { public class TopicTests extends BaseTest {
private static final long SUITE_ID = 2; private static final long SUITE_ID = 2;
private static final String SUITE_TITLE = "Topics"; private static final String SUITE_TITLE = "Topics";
private static final Topic TOPIC_TO_CREATE = new Topic()
.setName("new-topic-"+ randomAlphabetic(5))
.setPartitions("1")
.setCleanupPolicyValue(DELETE);
private static final Topic TOPIC_FOR_UPDATE = new Topic() private static final Topic TOPIC_FOR_UPDATE = new Topic()
.setName("topic-to-update") .setName("topic-to-update-" + randomAlphabetic(5))
.setCleanupPolicyValue("Compact") .setCleanupPolicyValue(COMPACT)
.setTimeToRetainData("604800001") .setTimeToRetainData("604800001")
.setMaxSizeOnDisk("20 GB") .setMaxSizeOnDisk(SIZE_20_GB)
.setMaxMessageBytes("1000020") .setMaxMessageBytes("1000020")
.setMessageKey(fileToString(System.getProperty("user.dir") + "/src/test/resources/producedkey.txt")) .setMessageKey(fileToString(System.getProperty("user.dir") + "/src/test/resources/producedkey.txt"))
.setMessageContent(fileToString(System.getProperty("user.dir") + "/src/test/resources/testData.txt")); .setMessageContent(fileToString(System.getProperty("user.dir") + "/src/test/resources/testData.txt"));
private static final Topic TOPIC_FOR_MESSAGES = new Topic() private static final Topic TOPIC_FOR_MESSAGES = new Topic()
.setName("topic-with-clean-message-attribute") .setName("topic-with-clean-message-attribute-" + randomAlphabetic(5))
.setMessageKey(fileToString(System.getProperty("user.dir") + "/src/test/resources/producedkey.txt")) .setMessageKey(fileToString(System.getProperty("user.dir") + "/src/test/resources/producedkey.txt"))
.setMessageContent(fileToString(System.getProperty("user.dir") + "/src/test/resources/testData.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 Topic TOPIC_FOR_DELETE = new Topic().setName("topic-to-delete-" + randomAlphabetic(5));
private static final List<Topic> TOPIC_LIST = new ArrayList<>(); private static final List<Topic> TOPIC_LIST = new ArrayList<>();
@BeforeAll @BeforeAll
@ -52,7 +59,6 @@ public class TopicTests extends BaseTest {
@CaseId(199) @CaseId(199)
@Test @Test
public void createTopic() { public void createTopic() {
Topic topicToCreate = new Topic().setName("new-topic");
naviSideBar naviSideBar
.openSideMenu(TOPICS); .openSideMenu(TOPICS);
topicsList topicsList
@ -60,16 +66,28 @@ public class TopicTests extends BaseTest {
.clickAddTopicBtn(); .clickAddTopicBtn();
topicCreateEditForm topicCreateEditForm
.waitUntilScreenReady() .waitUntilScreenReady()
.setTopicName(topicToCreate.getName()) .setTopicName(TOPIC_TO_CREATE.getName())
.setPartitions(TOPIC_TO_CREATE.getPartitions())
.selectCleanupPolicy(TOPIC_TO_CREATE.getCleanupPolicyValue())
.clickCreateTopicBtn(); .clickCreateTopicBtn();
topicDetails topicDetails
.waitUntilScreenReady(); .waitUntilScreenReady();
naviSideBar
.openSideMenu(TOPICS);
topicsList
.waitUntilScreenReady()
.openTopic(TOPIC_TO_CREATE.getName());
SoftAssertions softly = new SoftAssertions();
softly.assertThat(topicDetails.isTopicHeaderVisible(TOPIC_TO_CREATE.getName())).as("isTopicHeaderVisible()").isTrue();
softly.assertThat(topicDetails.getCleanUpPolicy()).as("getCleanUpPolicy()").isEqualTo(TOPIC_TO_CREATE.getCleanupPolicyValue().toString());
softly.assertThat(topicDetails.getPartitions()).as("getPartitions()").isEqualTo(TOPIC_TO_CREATE.getPartitions());
softly.assertAll();
naviSideBar naviSideBar
.openSideMenu(TOPICS); .openSideMenu(TOPICS);
topicsList topicsList
.waitUntilScreenReady(); .waitUntilScreenReady();
Assertions.assertTrue(topicsList.isTopicVisible(topicToCreate.getName()), "isTopicVisible"); Assertions.assertTrue(topicsList.isTopicVisible(TOPIC_TO_CREATE.getName()), "isTopicVisible");
TOPIC_LIST.add(topicToCreate); TOPIC_LIST.add(TOPIC_TO_CREATE);
} }
@Disabled("https://github.com/provectus/kafka-ui/issues/2625") @Disabled("https://github.com/provectus/kafka-ui/issues/2625")
@ -89,7 +107,7 @@ public class TopicTests extends BaseTest {
.openEditSettings(); .openEditSettings();
topicCreateEditForm topicCreateEditForm
.waitUntilScreenReady() .waitUntilScreenReady()
.selectCleanupPolicy(TOPIC_FOR_UPDATE.getCleanupPolicyValue()) .selectCleanupPolicy((TOPIC_FOR_UPDATE.getCleanupPolicyValue()))
.setMinInsyncReplicas(10) .setMinInsyncReplicas(10)
.setTimeToRetainDataInMs(TOPIC_FOR_UPDATE.getTimeToRetainData()) .setTimeToRetainDataInMs(TOPIC_FOR_UPDATE.getTimeToRetainData())
.setMaxSizeOnDiskInGB(TOPIC_FOR_UPDATE.getMaxSizeOnDisk()) .setMaxSizeOnDiskInGB(TOPIC_FOR_UPDATE.getMaxSizeOnDisk())
@ -106,10 +124,10 @@ public class TopicTests extends BaseTest {
.waitUntilScreenReady() .waitUntilScreenReady()
.openEditSettings(); .openEditSettings();
SoftAssertions softly = new SoftAssertions(); SoftAssertions softly = new SoftAssertions();
softly.assertThat(topicCreateEditForm.getCleanupPolicy()).as("Cleanup Policy").isEqualTo(TOPIC_FOR_UPDATE.getCleanupPolicyValue()); softly.assertThat(topicCreateEditForm.getCleanupPolicy()).as("getCleanupPolicy()").isEqualTo(TOPIC_FOR_UPDATE.getCleanupPolicyValue().getVisibleText());
softly.assertThat(topicCreateEditForm.getTimeToRetain()).as("Time to retain").isEqualTo(TOPIC_FOR_UPDATE.getTimeToRetainData()); softly.assertThat(topicCreateEditForm.getTimeToRetain()).as("getTimeToRetain()").isEqualTo(TOPIC_FOR_UPDATE.getTimeToRetainData());
softly.assertThat(topicCreateEditForm.getMaxSizeOnDisk()).as("Max size on disk").isEqualTo(TOPIC_FOR_UPDATE.getMaxSizeOnDisk()); softly.assertThat(topicCreateEditForm.getMaxSizeOnDisk()).as("getMaxSizeOnDisk()").isEqualTo(TOPIC_FOR_UPDATE.getMaxSizeOnDisk().getVisibleText());
softly.assertThat(topicCreateEditForm.getMaxMessageBytes()).as("Max message bytes").isEqualTo(TOPIC_FOR_UPDATE.getMaxMessageBytes()); softly.assertThat(topicCreateEditForm.getMaxMessageBytes()).as("getMaxMessageBytes()").isEqualTo(TOPIC_FOR_UPDATE.getMaxMessageBytes());
softly.assertAll(); softly.assertAll();
} }