|
@@ -11,48 +11,55 @@ import static com.codeborne.selenide.Selenide.*;
|
|
|
import static com.provectus.kafka.ui.utilities.WebUtils.clickByJavaScript;
|
|
|
import static org.assertj.core.api.Assertions.assertThat;
|
|
|
|
|
|
-public class TopicCreateEditSettingsView {
|
|
|
+public class TopicCreateEditForm {
|
|
|
|
|
|
private final SelenideElement timeToRetain = $(By.cssSelector("input#timeToRetain"));
|
|
|
private final SelenideElement maxMessageBytes = $(By.name("maxMessageBytes"));
|
|
|
+
|
|
|
@Step
|
|
|
- public TopicCreateEditSettingsView setTopicName(String topicName) {
|
|
|
+ public TopicCreateEditForm setTopicName(String topicName) {
|
|
|
$("input#topicFormName").setValue(topicName);
|
|
|
return this;
|
|
|
}
|
|
|
+
|
|
|
@Step
|
|
|
- public TopicCreateEditSettingsView setMinInsyncReplicas(Integer minInsyncReplicas) {
|
|
|
+ public TopicCreateEditForm setMinInsyncReplicas(Integer minInsyncReplicas) {
|
|
|
$("input[name=minInSyncReplicas]").setValue(minInsyncReplicas.toString());
|
|
|
return this;
|
|
|
}
|
|
|
+
|
|
|
@Step
|
|
|
- public TopicCreateEditSettingsView setTimeToRetainDataInMs(Long ms) {
|
|
|
+ public TopicCreateEditForm setTimeToRetainDataInMs(Long ms) {
|
|
|
timeToRetain.setValue(ms.toString());
|
|
|
return this;
|
|
|
}
|
|
|
+
|
|
|
@Step
|
|
|
- public TopicCreateEditSettingsView setTimeToRetainDataInMs(String ms) {
|
|
|
+ public TopicCreateEditForm setTimeToRetainDataInMs(String ms) {
|
|
|
timeToRetain.setValue(ms);
|
|
|
return this;
|
|
|
}
|
|
|
|
|
|
@Step
|
|
|
- public TopicCreateEditSettingsView setMaxSizeOnDiskInGB(String value) {
|
|
|
+ public TopicCreateEditForm setMaxSizeOnDiskInGB(String value) {
|
|
|
KafkaUISelectElement kafkaUISelectElement = new KafkaUISelectElement("retentionBytes");
|
|
|
kafkaUISelectElement.selectByVisibleText(value);
|
|
|
return this;
|
|
|
}
|
|
|
+
|
|
|
@Step
|
|
|
- public TopicCreateEditSettingsView setMaxMessageBytes(Long bytes) {
|
|
|
+ public TopicCreateEditForm setMaxMessageBytes(Long bytes) {
|
|
|
maxMessageBytes.setValue(bytes.toString());
|
|
|
return this;
|
|
|
}
|
|
|
+
|
|
|
@Step
|
|
|
- public TopicCreateEditSettingsView setMaxMessageBytes(String bytes) {
|
|
|
+ public TopicCreateEditForm setMaxMessageBytes(String bytes) {
|
|
|
return setMaxMessageBytes(Long.parseLong(bytes));
|
|
|
}
|
|
|
+
|
|
|
@Step
|
|
|
- public TopicCreateEditSettingsView setTimeToRetainDataInMsUsingButtons(String value) {
|
|
|
+ public TopicCreateEditForm setTimeToRetainDataInMsUsingButtons(String value) {
|
|
|
timeToRetain
|
|
|
.parent()
|
|
|
.parent()
|
|
@@ -63,32 +70,37 @@ public class TopicCreateEditSettingsView {
|
|
|
}
|
|
|
|
|
|
@Step
|
|
|
- public TopicCreateEditSettingsView selectCleanupPolicy(CleanupPolicyValue cleanupPolicyValue) {
|
|
|
+ public TopicCreateEditForm selectCleanupPolicy(CleanupPolicyValue cleanupPolicyValue) {
|
|
|
return selectFromDropDownByOptionValue("cleanupPolicy",
|
|
|
cleanupPolicyValue.getOptionValue());
|
|
|
}
|
|
|
+
|
|
|
@Step
|
|
|
- public TopicCreateEditSettingsView selectCleanupPolicy(String cleanupPolicyOptionValue) {
|
|
|
+ public TopicCreateEditForm selectCleanupPolicy(String cleanupPolicyOptionValue) {
|
|
|
$("ul#topicFormCleanupPolicy").click();
|
|
|
$x("//li[text()='" + cleanupPolicyOptionValue + "']").click();
|
|
|
return this;
|
|
|
}
|
|
|
+
|
|
|
@Step
|
|
|
- public TopicCreateEditSettingsView selectRetentionBytes(String visibleValue) {
|
|
|
+ public TopicCreateEditForm selectRetentionBytes(String visibleValue) {
|
|
|
return selectFromDropDownByVisibleText("retentionBytes", visibleValue);
|
|
|
}
|
|
|
+
|
|
|
@Step
|
|
|
- public TopicCreateEditSettingsView selectRetentionBytes(Long optionValue) {
|
|
|
+ public TopicCreateEditForm selectRetentionBytes(Long optionValue) {
|
|
|
return selectFromDropDownByOptionValue("retentionBytes", optionValue.toString());
|
|
|
}
|
|
|
+
|
|
|
@Step
|
|
|
- public TopicView sendData() {
|
|
|
+ public TopicDetails sendData() {
|
|
|
clickByJavaScript($x("//button[@type='submit']"));
|
|
|
- return new TopicView();
|
|
|
+ return new TopicDetails();
|
|
|
}
|
|
|
+
|
|
|
@Step
|
|
|
- public TopicCreateEditSettingsView addCustomParameter(String customParameterName,
|
|
|
- String customParameterValue) {
|
|
|
+ public TopicCreateEditForm addCustomParameter(String customParameterName,
|
|
|
+ String customParameterValue) {
|
|
|
ElementsCollection customParametersElements =
|
|
|
$$("ul[role=listbox][name^=customParams][name$=name]");
|
|
|
KafkaUISelectElement kafkaUISelectElement = null;
|
|
@@ -110,9 +122,10 @@ public class TopicCreateEditSettingsView {
|
|
|
.setValue(customParameterValue);
|
|
|
return this;
|
|
|
}
|
|
|
+
|
|
|
@Step
|
|
|
- public TopicCreateEditSettingsView updateCustomParameter(String customParameterName,
|
|
|
- String customParameterValue) {
|
|
|
+ public TopicCreateEditForm updateCustomParameter(String customParameterName,
|
|
|
+ String customParameterValue) {
|
|
|
SelenideElement selenideElement = $$("ul[role=listbox][name^=customParams][name$=name]")
|
|
|
.find(Condition.exactText(customParameterName));
|
|
|
String name = selenideElement.getAttribute("name");
|
|
@@ -122,8 +135,9 @@ public class TopicCreateEditSettingsView {
|
|
|
$(String.format("input[name^=%s]", name)).setValue(customParameterValue);
|
|
|
return this;
|
|
|
}
|
|
|
+
|
|
|
@Step
|
|
|
- public TopicCreateEditSettingsView cleanupPolicyIs(String value) {
|
|
|
+ public TopicCreateEditForm cleanupPolicyIs(String value) {
|
|
|
String cleanupPolicy = new KafkaUISelectElement("cleanupPolicy")
|
|
|
.getCurrentValue();
|
|
|
assertThat(cleanupPolicy)
|
|
@@ -131,14 +145,16 @@ public class TopicCreateEditSettingsView {
|
|
|
.isEqualToIgnoringCase(value);
|
|
|
return this;
|
|
|
}
|
|
|
+
|
|
|
@Step
|
|
|
- public TopicCreateEditSettingsView timeToRetainIs(String time) {
|
|
|
+ public TopicCreateEditForm timeToRetainIs(String time) {
|
|
|
String value = timeToRetain.getValue();
|
|
|
assertThat(value)
|
|
|
.as("Time to retain data (in ms) should be " + time)
|
|
|
.isEqualTo(time);
|
|
|
return this;
|
|
|
}
|
|
|
+
|
|
|
@Step
|
|
|
public String getCleanupPolicy() {
|
|
|
return new KafkaUISelectElement("cleanupPolicy").getCurrentValue();
|
|
@@ -215,15 +231,15 @@ public class TopicCreateEditSettingsView {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private TopicCreateEditSettingsView selectFromDropDownByOptionValue(String dropDownElementName,
|
|
|
- String optionValue) {
|
|
|
+ private TopicCreateEditForm selectFromDropDownByOptionValue(String dropDownElementName,
|
|
|
+ String optionValue) {
|
|
|
KafkaUISelectElement select = new KafkaUISelectElement(dropDownElementName);
|
|
|
select.selectByOptionValue(optionValue);
|
|
|
return this;
|
|
|
}
|
|
|
|
|
|
- private TopicCreateEditSettingsView selectFromDropDownByVisibleText(String dropDownElementName,
|
|
|
- String visibleText) {
|
|
|
+ private TopicCreateEditForm selectFromDropDownByVisibleText(String dropDownElementName,
|
|
|
+ String visibleText) {
|
|
|
KafkaUISelectElement select = new KafkaUISelectElement(dropDownElementName);
|
|
|
select.selectByVisibleText(visibleText);
|
|
|
return this;
|