Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,14 @@ private void logOneValueDropDownData(final TypeForOneValue type, final OneValue

private void selectSearchableOptionForCustomDropDown(final List<WebElement> dropDownParentElements,
final String value) {
By searchableOptionLocator = By.xpath(format(CONTAINS_TEXT_PATTERN, value));
uiUtil.waitForElementPresence(dependencies, searchableOptionLocator);
Collections.reverse(dropDownParentElements);

for (int i = 0; i < dropDownParentElements.size(); i++) {
WebElement element = dropDownParentElements.get(i);
try {
WebElement searchableOption = element.findElement(By.xpath(format(CONTAINS_TEXT_PATTERN, value)));
WebElement searchableOption = element.findElement(searchableOptionLocator);
searchableOption.click();
break;
} catch (NoSuchElementException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public ScenarioRunner(final ScenarioArguments scenarioArguments,
this.interpreterScanner = ctx.getBean(InterpreterScanner.class);
this.webDownloadUtil = ctx.getBean(WebDownloadUtil.class);
this.stopScenarioOnFailure = ctx.getBean(GlobalTestConfiguration.class).isStopScenarioOnFailure();

this.scenarioDir = webDownloadUtil.resolveScenarioDir(scenarioArguments.getFile());
this.dependencies = createDependencies();
this.cmdToInterpreterMap = createClassToInterpreterMap(dependencies);
}
Expand All @@ -97,7 +97,6 @@ public ScenarioResult run() {

private void takeFileNamesSnapshot() {
this.executionStartTime = System.currentTimeMillis();
this.scenarioDir = webDownloadUtil.resolveScenarioDir(scenarioArguments.getFile());
if (nonNull(scenarioDir)) {
try {
java.nio.file.Files.createDirectories(scenarioDir);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils;
import org.openqa.selenium.By;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.Point;
Expand Down Expand Up @@ -276,6 +277,12 @@ public void waitForMatSelectToOpen(final ExecutorDependencies dependencies, fina
getWebDriverWait(dependencies).until(d -> "true".equalsIgnoreCase(matSelect.getAttribute("aria-expanded")));
}

public void waitForElementPresence(final ExecutorDependencies dependencies, final By locator) {
WebDriverWait wait = getWebDriverWait(dependencies);
wait.until(ExpectedConditions.presenceOfElementLocated(locator));
}


public String getBasePageURL(final String currentPageURL) {
try {
URL url = new URL(currentPageURL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ private String formatAndRegisterResult(final ZonedDateTime dateTime, final DateT
}

private DateTimeFormatter createDateTimeFormatter(final String dateFormatPattern) {
validateDateFormatPattern(dateFormatPattern);
try {
return new DateTimeFormatterBuilder().appendPattern(dateFormatPattern)
.parseDefaulting(ChronoField.YEAR_OF_ERA, ZonedDateTime.now().getYear())
Expand Down Expand Up @@ -341,6 +342,17 @@ private TemporalAccessor parseToTemporalAccessor(final String valueToParse, fina
}
}

private void validateDateFormatPattern(final String dateFormatPattern) {
if (dateFormatPattern.matches(".*\\p{IsCyrillic}.*")) {
throw new DefaultFrameworkException(ExceptionMessage.INVALID_DATE_FORMAT_PATTERN,
dateFormatPattern, "Pattern cannot contain Cyrillic characters");
}
if (!dateFormatPattern.matches(".*[a-zA-Z].*")) {
throw new DefaultFrameworkException(ExceptionMessage.INVALID_DATE_FORMAT_PATTERN,
dateFormatPattern, "Pattern must contain at least one valid letter token");
}
}

private ZonedDateTime convertToZonedDateTime(final TemporalAccessor temporalAccessor, final ZoneId zoneId,
final String originalValue, final String pattern) {
LocalDate localDate = temporalAccessor.query(TemporalQueries.localDate());
Expand Down