|
@@ -1,19 +1,30 @@
|
|
package com.provectus.kafka.ui.pages;
|
|
package com.provectus.kafka.ui.pages;
|
|
|
|
|
|
|
|
+import com.codeborne.selenide.Selenide;
|
|
import com.codeborne.selenide.SelenideElement;
|
|
import com.codeborne.selenide.SelenideElement;
|
|
|
|
+import com.provectus.kafka.ui.base.TestConfiguration;
|
|
|
|
+import com.provectus.kafka.ui.extensions.WaitUtils;
|
|
|
|
+import io.qameta.allure.Step;
|
|
import lombok.SneakyThrows;
|
|
import lombok.SneakyThrows;
|
|
|
|
+import lombok.experimental.ExtensionMethod;
|
|
import org.junit.jupiter.api.Assertions;
|
|
import org.junit.jupiter.api.Assertions;
|
|
import org.openqa.selenium.By;
|
|
import org.openqa.selenium.By;
|
|
|
|
|
|
import static com.codeborne.selenide.Selenide.*;
|
|
import static com.codeborne.selenide.Selenide.*;
|
|
|
|
|
|
|
|
+@ExtensionMethod({WaitUtils.class})
|
|
public class TopicView {
|
|
public class TopicView {
|
|
- static final String path = "ui/clusters/%s/topics/%s";
|
|
|
|
- private SelenideElement cleanupPolicy = $(By.name("cleanupPolicy"));
|
|
|
|
- private SelenideElement timeToRetain = $(By.id("timeToRetain"));
|
|
|
|
- private SelenideElement maxSizeOnDisk = $(By.name("retentionBytes"));
|
|
|
|
- private SelenideElement maxMessageBytes = $(By.name("maxMessageBytes"));
|
|
|
|
|
|
+ private static final String path = "ui/clusters/%s/topics/%s";
|
|
|
|
+ private final SelenideElement cleanupPolicy = $(By.name("cleanupPolicy"));
|
|
|
|
+ private final SelenideElement timeToRetain = $(By.id("timeToRetain"));
|
|
|
|
+ private final SelenideElement maxSizeOnDisk = $(By.name("retentionBytes"));
|
|
|
|
+ private final SelenideElement maxMessageBytes = $(By.name("maxMessageBytes"));
|
|
|
|
|
|
|
|
+ @Step
|
|
|
|
+ public TopicView goTo(String cluster,String topic){
|
|
|
|
+ Selenide.open(TestConfiguration.BASE_URL+path.formatted(cluster,topic));
|
|
|
|
+ return this;
|
|
|
|
+ }
|
|
@SneakyThrows
|
|
@SneakyThrows
|
|
public TopicView openEditSettings() {
|
|
public TopicView openEditSettings() {
|
|
$(By.xpath("//a[@class=\"button\" and text()='Edit settings']")).click();
|
|
$(By.xpath("//a[@class=\"button\" and text()='Edit settings']")).click();
|
|
@@ -59,19 +70,23 @@ public class TopicView {
|
|
$(By.xpath("//input[@type='submit']")).click();
|
|
$(By.xpath("//input[@type='submit']")).click();
|
|
}
|
|
}
|
|
|
|
|
|
- public SelenideElement getCleanupPolicy() {
|
|
|
|
- return cleanupPolicy;
|
|
|
|
|
|
+ public TopicView cleanupPolicyIs(String value) {
|
|
|
|
+ cleanupPolicy.waitForSelectedValue(value);
|
|
|
|
+ return this;
|
|
}
|
|
}
|
|
|
|
|
|
- public SelenideElement getTimeToRetain() {
|
|
|
|
- return timeToRetain;
|
|
|
|
|
|
+ public TopicView timeToRetainIs(String time) {
|
|
|
|
+ Assertions.assertEquals(time, timeToRetain.getValue());
|
|
|
|
+ return this;
|
|
}
|
|
}
|
|
|
|
|
|
- public SelenideElement getMaxSizeOnDisk() {
|
|
|
|
- return maxSizeOnDisk;
|
|
|
|
|
|
+ public TopicView maxSizeOnDiskIs(String size) {
|
|
|
|
+ Assertions.assertEquals(size, maxSizeOnDisk.getSelectedText());
|
|
|
|
+ return this;
|
|
}
|
|
}
|
|
|
|
|
|
- public SelenideElement getMaxMessageBytes() {
|
|
|
|
- return maxMessageBytes;
|
|
|
|
|
|
+ public TopicView maxMessageBytesIs(String bytes) {
|
|
|
|
+ Assertions.assertEquals(bytes, maxMessageBytes.getValue());
|
|
|
|
+ return this;
|
|
}
|
|
}
|
|
}
|
|
}
|