626: add class for topic page

This commit is contained in:
Anna Antipova 2021-07-16 14:30:57 +03:00
parent 4dfefb7dd8
commit 849fc4f4ca
2 changed files with 45 additions and 2 deletions

View file

@ -8,12 +8,22 @@ public class Pages {
public static Pages INSTANCE = new Pages();
public MainPage mainPage = new MainPage();
public TopicPage topicPage = new TopicPage();
private Pages goTo(String path) {
Selenide.open(TestConfiguration.BASE_URL+path);
return this;
}
public Pages open() {
return goTo("");
public MainPage open() {
return openMainPage();
}
public MainPage openMainPage() {
return goTo(MainPage.path).mainPage;
}
public TopicPage openTopicPage() {
return goTo(TopicPage.path).topicPage;
}
}

View file

@ -0,0 +1,33 @@
package com.provectus.kafka.ui.pages;
import com.codeborne.selenide.Condition;
import io.qameta.allure.Step;
import lombok.SneakyThrows;
import org.openqa.selenium.By;
import static com.codeborne.selenide.Selenide.$;
import static com.provectus.kafka.ui.helpers.Utils.refreshUntil;
public class TopicPage {
public static final String path = "ui/clusters/secondLocal/topics";
@Step
public TopicPage shouldBeOnPage() {
$(By.xpath("//*[contains(text(),'Loading')]")).shouldBe(Condition.disappear);
$(By.xpath("//span[text()='All Topics']")).shouldBe(Condition.visible);
return this;
}
@SneakyThrows
public TopicPage openTopic(String topicName) {
refreshUntil(By.xpath("//div[contains(@class,'section')]//table//a[text()='%s']".formatted(topicName)));
$(By.xpath("//div[contains(@class,'section')]//table//a[text()='%s']".formatted(topicName)))
.click();
return this;
}
@SneakyThrows
public TopicPage openEditSettings() {
$(By.xpath("//a[@class=\"button\" and text()='Edit settings']")).click();
return this;
}
}