626: extract refreshUntil method to Utils
This commit is contained in:
parent
bf6dd6c91b
commit
4dfefb7dd8
2 changed files with 23 additions and 14 deletions
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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"),
|
||||
|
|
Loading…
Add table
Reference in a new issue