626: add class for topic view page
This commit is contained in:
parent
408983bb56
commit
cf28c83e32
4 changed files with 58 additions and 42 deletions
|
@ -9,6 +9,7 @@ public class Pages {
|
|||
|
||||
public MainPage mainPage = new MainPage();
|
||||
public TopicsListPage topicsListPage = new TopicsListPage();
|
||||
public TopicViewPage topicViewPage = new TopicViewPage();
|
||||
|
||||
private Pages goTo(String path) {
|
||||
Selenide.open(TestConfiguration.BASE_URL+path);
|
||||
|
@ -27,6 +28,10 @@ public class Pages {
|
|||
return goTo(TopicsListPage.path).topicsListPage;
|
||||
}
|
||||
|
||||
public TopicViewPage openTopicViewPage() {
|
||||
return goTo(TopicViewPage.path).topicViewPage;
|
||||
}
|
||||
|
||||
public Pages reloadPage() {
|
||||
Selenide.refresh();
|
||||
return this;
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
package com.provectus.kafka.ui.pages;
|
||||
|
||||
import lombok.SneakyThrows;
|
||||
import org.openqa.selenium.By;
|
||||
|
||||
import static com.codeborne.selenide.Selenide.$;
|
||||
|
||||
public class TopicViewPage {
|
||||
public static final String path = "ui/clusters/secondLocal/topics/new-topic";
|
||||
|
||||
@SneakyThrows
|
||||
public TopicViewPage openEditSettings() {
|
||||
$(By.xpath("//a[@class=\"button\" and text()='Edit settings']")).click();
|
||||
return this;
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public TopicViewPage changeCleanupPolicy(String cleanupPolicyValue) {
|
||||
$(By.name("cleanupPolicy")).click();
|
||||
$(By.xpath("//select/option[@value = '%s']".formatted(cleanupPolicyValue))).click();
|
||||
return this;
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public TopicViewPage changeTimeToRetainValue(String timeToRetainValue) {
|
||||
$(By.id("timeToRetain")).clear();
|
||||
$(By.id("timeToRetain")).sendKeys(String.valueOf(timeToRetainValue));
|
||||
return this;
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public TopicViewPage changeMaxSizeOnDisk(String maxSizeOnDisk) {
|
||||
$(By.name("retentionBytes")).click();
|
||||
$(By.xpath("//select/option[text() = '%s']".formatted(maxSizeOnDisk))).click();
|
||||
return this;
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public TopicViewPage changeMaxMessageBytes(String maxMessageBytes) {
|
||||
$(By.name("maxMessageBytes")).clear();
|
||||
$(By.name("maxMessageBytes")).sendKeys(String.valueOf(maxMessageBytes));
|
||||
return this;
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public TopicViewPage submitSettingChanges() {
|
||||
$(By.xpath("//input[@type='submit']")).click();
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -25,44 +25,5 @@ public class TopicsListPage {
|
|||
.click();
|
||||
return this;
|
||||
}
|
||||
@SneakyThrows
|
||||
public TopicsListPage openEditSettings() {
|
||||
$(By.xpath("//a[@class=\"button\" and text()='Edit settings']")).click();
|
||||
return this;
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public TopicsListPage changeCleanupPolicy(String cleanupPolicyValue) {
|
||||
$(By.name("cleanupPolicy")).click();
|
||||
$(By.xpath("//select/option[@value = '%s']".formatted(cleanupPolicyValue))).click();
|
||||
return this;
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public TopicsListPage changeTimeToRetainValue(String timeToRetainValue) {
|
||||
$(By.id("timeToRetain")).clear();
|
||||
$(By.id("timeToRetain")).sendKeys(String.valueOf(timeToRetainValue));
|
||||
return this;
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public TopicsListPage changeMaxSizeOnDisk(String maxSizeOnDisk) {
|
||||
$(By.name("retentionBytes")).click();
|
||||
$(By.xpath("//select/option[text() = '%s']".formatted(maxSizeOnDisk))).click();
|
||||
return this;
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public TopicsListPage changeMaxMessageBytes(String maxMessageBytes) {
|
||||
$(By.name("maxMessageBytes")).clear();
|
||||
$(By.name("maxMessageBytes")).sendKeys(String.valueOf(maxMessageBytes));
|
||||
return this;
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public TopicsListPage submitSettingChanges() {
|
||||
$(By.xpath("//input[@type='submit']")).click();
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -45,7 +45,8 @@ public class TopicTests extends BaseTest {
|
|||
void updateTopic(){
|
||||
pages.openTopicsListPage()
|
||||
.shouldBeOnPage()
|
||||
.openTopic(NEW_TOPIC)
|
||||
.openTopic(NEW_TOPIC);
|
||||
pages.openTopicViewPage()
|
||||
.openEditSettings()
|
||||
.changeCleanupPolicy("compact")
|
||||
.changeTimeToRetainValue("604800001")
|
||||
|
@ -53,8 +54,7 @@ public class TopicTests extends BaseTest {
|
|||
.changeMaxMessageBytes("1000020")
|
||||
.submitSettingChanges();
|
||||
pages.reloadPage();
|
||||
pages.openTopicsListPage()
|
||||
.openTopic(NEW_TOPIC)
|
||||
pages.openTopicViewPage()
|
||||
.openEditSettings();
|
||||
|
||||
String cleanupPolicy = $(By.name("cleanupPolicy")).getSelectedValue();
|
||||
|
|
Loading…
Add table
Reference in a new issue