Skip to content

Commit 378a99b

Browse files
committed
update test to consider multiple pages
1 parent a92489e commit 378a99b

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

e2e-tests/src/main/java/io/kafbat/ui/screens/panels/NaviSideBar.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import java.util.List;
1414
import java.util.stream.Collectors;
1515
import java.util.stream.Stream;
16+
import org.openqa.selenium.By;
1617

1718
public class NaviSideBar extends BasePage {
1819

@@ -45,7 +46,7 @@ public String getPagePath(MenuItem menuItem) {
4546
@Step
4647
public NaviSideBar openSideMenu(String clusterName, MenuItem menuItem) {
4748
WebUtil.clickByActions(expandCluster(clusterName).parent()
48-
.$x(String.format(sideMenuOptionElementLocator, menuItem.getNaviTitle())));
49+
.find(By.linkText(menuItem.getNaviTitle())));
4950
return this;
5051
}
5152

e2e-tests/src/main/java/io/kafbat/ui/screens/topics/TopicSettingsTab.java

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@
99
import io.qameta.allure.Step;
1010
import java.util.ArrayList;
1111
import java.util.List;
12+
import java.util.NoSuchElementException;
1213

1314
public class TopicSettingsTab extends BasePage {
1415

1516
protected SelenideElement defaultValueColumnHeaderLocator = $x("//div[text() = 'Default Value']");
17+
protected SelenideElement nextButton = $x("//button[contains(text(), 'Next')]");
18+
protected SelenideElement previousButton = $x("//button[contains(text(), 'Previous')]");
1619

1720
@Step
1821
public TopicSettingsTab waitUntilScreenReady() {
@@ -36,7 +39,25 @@ private TopicSettingsTab.SettingsGridItem getItemByKey(String key) {
3639

3740
@Step
3841
public String getValueByKey(String key) {
39-
return getItemByKey(key).getValue();
42+
while (true) {
43+
try {
44+
String value = getItemByKey(key).getValue();
45+
resetPageNavigation();
46+
return value;
47+
} catch (NoSuchElementException e) {
48+
if (nextButton.isEnabled()) {
49+
nextButton.click();
50+
} else {
51+
throw e;
52+
}
53+
}
54+
}
55+
}
56+
57+
private void resetPageNavigation() {
58+
while (previousButton.isEnabled()) {
59+
previousButton.click();
60+
}
4061
}
4162

4263
public static class SettingsGridItem extends BasePage {

0 commit comments

Comments
 (0)