MainPage.java 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package com.provectus.kafka.ui.pages;
  2. import com.codeborne.selenide.Condition;
  3. import io.qameta.allure.Step;
  4. import lombok.SneakyThrows;
  5. import org.openqa.selenium.By;
  6. import static com.codeborne.selenide.Selenide.*;
  7. import static com.provectus.kafka.ui.helpers.Utils.refreshUntil;
  8. public class MainPage {
  9. private static final long TIMEOUT = 25000;
  10. public static final String path = "";
  11. @Step
  12. public MainPage shouldBeOnPage() {
  13. $(By.xpath("//*[contains(text(),'Loading')]")).shouldBe(Condition.disappear);
  14. $(By.xpath("//h5[text()='Clusters']")).shouldBe(Condition.visible);
  15. return this;
  16. }
  17. @SneakyThrows
  18. public void shouldBeTopic(String topicName) {
  19. refreshUntil(By.xpath("//div[contains(@class,'section')]//table//a[text()='%s']".formatted(topicName)));
  20. }
  21. public enum SideMenuOptions {
  22. BROKERS("Brokers"),
  23. TOPICS("Topics"),
  24. CONSUMERS("Consumers"),
  25. SCHEMA_REGISTRY("Schema registry");
  26. String value;
  27. SideMenuOptions(String value) {
  28. this.value = value;
  29. }
  30. }
  31. @Step
  32. public MainPage goToSideMenu(String clusterName, SideMenuOptions option) {
  33. $(By.xpath("//aside//*[a[text()='%s']]//a[text()='%s']".formatted(clusterName, option.value)))
  34. .click();
  35. return this;
  36. }
  37. }