Skip to content

Commit

Permalink
MIR-1226 fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sebhofmann committed Oct 27, 2023
1 parent c353ae9 commit 0e05bc0
Showing 1 changed file with 26 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,20 @@ public void setTopics(List<String> topics) {
IntStream.range(0, topics.size()).forEach((i) -> {
String appBaseXPath = ".//input[contains(@name, 'mods:subjectXML[" + (i + 1)
+ "]')]/following-sibling::div[contains(@class, 'editorToolsApp')]";
String addCustomButton = appBaseXPath + "//button[contains(@class, 'search-add-custom')]";
if (i > 0) {
clickRepeaterAndWait("mods:subjectXML", addCustomButton);
String searchInputXPath = appBaseXPath + "//input[contains(@class, 'search-topic')]";

if(i > 0) {
clickRepeaterAndWait("mods:subjectXML", searchInputXPath);
}

driver.waitAndFindElement(By.xpath(addCustomButton)).click();
WebElement searchInput = driver.waitAndFindElement(By.xpath(searchInputXPath));
searchInput.click();
searchInput.sendKeys(topics.get(i));
searchInput.sendKeys(Keys.ENTER);

String searchAddCustomXPath = appBaseXPath + "//button[contains(@class, 'search-add-custom')]";
WebElement searchAddCustom = driver.waitAndFindElement(By.xpath(searchAddCustomXPath));
searchAddCustom.click();;

WebElement selectElement = driver
.waitAndFindElement(By.xpath(appBaseXPath + "//select[contains(@class, 'custom-type-select')]"));
Expand All @@ -289,14 +297,21 @@ public void setTopics(List<String> topics) {

public void setGeoPair(String place, String coordinates) {
IntStream.range(0, 2).forEach((i) -> {
String appBaseXPath = ".//input[contains(@name, 'mods:subjectGEO[" + (i + 1)
+ "]')]/following-sibling::div[contains(@class, 'editorToolsApp')]";
String addCustomButton = appBaseXPath + "//button[contains(@class, 'search-add-custom')]";
if (i > 0) {
clickRepeaterAndWait("mods:subjectGEO", addCustomButton);
}
String appBaseXPath = ".//input[contains(@name, 'mods:subjectGEO[1]')]/following-sibling::div[contains(@class, 'editorToolsApp')]";

driver.waitAndFindElement(By.xpath(addCustomButton)).click();
if(i==1) {
String addCoordinateButton = appBaseXPath + "//a[contains(@class, 'add-coordinate')]";
driver.waitAndFindElement(By.xpath(addCoordinateButton)).click();
} else {
String searchInputXPath = appBaseXPath + "//input[contains(@class, 'search-topic')]";
WebElement searchInput = driver.waitAndFindElement(By.xpath(searchInputXPath));
searchInput.click();
searchInput.sendKeys("Jena");
searchInput.sendKeys(Keys.ENTER);
String searchAddCustomXPath = appBaseXPath + "//button[contains(@class, 'search-add-custom')]";
WebElement searchAddCustom = driver.waitAndFindElement(By.xpath(searchAddCustomXPath));
searchAddCustom.click();;
}
if (i == 0) {
WebElement selectElement = driver
.waitAndFindElement(By.xpath(appBaseXPath + "//select[contains(@class, 'custom-type-select')]"));
Expand Down

0 comments on commit 0e05bc0

Please sign in to comment.