Ver Fonte

626: extract refreshUntil method to Utils

Anna Antipova há 4 anos atrás
pai
commit
4dfefb7dd8

+ 20 - 0
kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/helpers/Utils.java

@@ -0,0 +1,20 @@
+package com.provectus.kafka.ui.helpers;
+
+import com.codeborne.selenide.Condition;
+import org.openqa.selenium.By;
+
+import static com.codeborne.selenide.Selenide.*;
+import static com.codeborne.selenide.Selenide.$;
+
+public class Utils {
+    public static void refreshUntil(By by){
+        int i =0;
+        do
+        {
+            refresh();
+            i++;
+            sleep(2000);
+        } while(getElements(by).size()<1 && i!=20);
+        $(by).shouldBe(Condition.visible);
+    }
+}

+ 3 - 14
kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/pages/MainPage.java

@@ -6,11 +6,14 @@ 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 MainPage {
 
   private static final long TIMEOUT = 25000;
 
+  public static final String path = "";
+
   @Step
   public MainPage shouldBeOnPage() {
     $(By.xpath("//*[contains(text(),'Loading')]")).shouldBe(Condition.disappear);
@@ -18,25 +21,11 @@ public class MainPage {
     return this;
   }
 
-
-  private void refreshUntil(By by){
-    int i =0;
-    do
-    {
-      refresh();
-      i++;
-      sleep(2000);
-    } while(getElements(by).size()<1 && i!=20);
-    $(by).shouldBe(Condition.visible);
-  }
-
   @SneakyThrows
   public void shouldBeTopic(String topicName) {
     refreshUntil(By.xpath("//div[contains(@class,'section')]//table//a[text()='%s']".formatted(topicName)));
   }
 
-
-
   public enum SideMenuOptions {
     BROKERS("Brokers"),
     TOPICS("Topics"),