Skip to content

Commit

Permalink
Updated Jackson dependency version to 2.13.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
wakaleo committed Mar 30, 2022
1 parent 982b7f0 commit 068a21b
Show file tree
Hide file tree
Showing 18 changed files with 40 additions and 39 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
<wiremock.version>1.58</wiremock.version>
<thymeleaf.version>3.1.0.M1</thymeleaf.version>
<javassist.version>3.28.0-GA</javassist.version>
<jackson.version>2.13.2</jackson.version>
<jackson.version>2.13.2.1</jackson.version>
<xchart.version>3.5.2</xchart.version>
<!-- Kotlin config -->
<!-- <kotlin.version>1.4.10</kotlin.version>-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ public PageObject waitForTitleToAppear(final String expectedTitle) {
}

public WebDriverWait waitOnPage() {
return new WebDriverWait(driver, getWaitForTimeout().getSeconds());
return new WebDriverWait(driver, getWaitForTimeout());
}

public PageObject waitForTitleToDisappear(final String expectedTitle) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ private boolean allElementsVisibleIn(List<WebElementFacade> webElements) {
* This method will wait until an element is present on the screen, though not necessarily visible.
*/
public WebElement waitForPresenceOf(final By byElementCriteria) {
WebDriverWait wait = new WebDriverWait(driver, waitForTimeout.getSeconds());
WebDriverWait wait = new WebDriverWait(driver, waitForTimeout);
return wait.until(presenceOfElementLocated(byElementCriteria));
}

Expand Down Expand Up @@ -250,7 +250,7 @@ public void waitForText(final String expectedText) {
}

public WebDriverWait thenWait() {
return new WebDriverWait(driver, getWaitForTimeout().getSeconds());
return new WebDriverWait(driver, getWaitForTimeout());
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ public boolean isVisible() {
return element.isDisplayed();
}

} catch (ElementNotVisibleException | NoSuchElementException | StaleElementReferenceException | TimeoutException e) {
} catch (ElementNotInteractableException | NoSuchElementException | StaleElementReferenceException | TimeoutException e) {
return false;
}
}
Expand Down Expand Up @@ -910,7 +910,7 @@ private boolean elementIsPresent() {
}
element.isDisplayed();
return true;
} catch (ElementNotVisibleException e) {
} catch (ElementNotInteractableException e) {
return true;
} catch (NotFoundException | ElementNotFoundAfterTimeoutError e) {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.WebDriverWait;

import java.time.Duration;

public class WebElementFacadeWait {
PageObject page;
private final long timeoutInSeconds;
Expand Down Expand Up @@ -37,6 +39,6 @@ public WebElementFacadeWait pollingEvery(long sleepInMillis) {
}

public WebElementFacade until(ExpectedCondition<? extends WebElement> isTrue) {
return page.element(new WebDriverWait(page.getDriver(), timeoutInSeconds).until(isTrue));
return page.element(new WebDriverWait(page.getDriver(), Duration.ofSeconds(timeoutInSeconds)).until(isTrue));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import net.thucydides.core.annotations.locators.WithConfigurableTimeout;
import net.thucydides.core.steps.StepEventBus;
import net.thucydides.core.webdriver.ConfigurableTimeouts;
import org.openqa.selenium.ElementNotVisibleException;
import org.openqa.selenium.ElementNotInteractableException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.pagefactory.ElementLocator;
Expand Down Expand Up @@ -40,7 +40,7 @@ public List<WebElement> resolveAllForDriver(WebDriver driver) {

private void ensureVisibilityOf(WebElement resolvedELement) {
if (resolvedELement == null) {
throw new ElementNotVisibleException(locator.toString());
throw new ElementNotInteractableException(locator.toString());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public WebElement ajaxFindElement() {
try {
return loadingElement.get().getElement();
} catch (ElementNotVisibleAfterTimeoutError notVisible) {
throw new ElementNotVisibleException(
throw new ElementNotInteractableException(
String.format("Timed out after %d seconds. %s", annotatedTimeoutInSeconds.orElse(getTimeOutInSeconds()), notVisible.getMessage()),
notVisible.getCause());
} catch (Error e) {
Expand Down Expand Up @@ -314,4 +314,4 @@ public String toString() {
public String toString() {
return (field != null) ? field.getDeclaringClass().getSimpleName() + "." + field.getName() : "";
}
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package net.thucydides.core.webdriver.exceptions;

import net.serenitybdd.core.exceptions.CausesAssertionFailure;
import org.openqa.selenium.ElementNotVisibleException;
import org.openqa.selenium.ElementNotInteractableException;

public class ElementShouldBeVisibleException extends ElementNotVisibleException implements CausesAssertionFailure {
public class ElementShouldBeVisibleException extends ElementNotInteractableException implements CausesAssertionFailure {
public ElementShouldBeVisibleException(String message, Throwable cause) {
super(message, cause);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

public class TargetLocatorStub implements WebDriver.TargetLocator {

private WebDriver webDriver;
private final WebDriver webDriver;

public TargetLocatorStub(WebDriver webDriver) {
this.webDriver = webDriver;
Expand Down Expand Up @@ -47,7 +47,7 @@ public WebDriver defaultContent() {

@Override
public WebElement activeElement() {
throw new ElementNotVisibleException("No active element found (a previous step has failed)");
throw new ElementNotInteractableException("No active element found (a previous step has failed)");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class WhenManagingWebdriverTimeouts extends Specification {
when: "We access the field"
page.slowLoadingField.isDisplayed()
then: "An error should be thrown"
thrown(org.openqa.selenium.ElementNotVisibleException)
thrown(org.openqa.selenium.ElementNotInteractableException)
}

def "Slow loading fields should not wait once a step has failed"() {
Expand All @@ -99,7 +99,7 @@ class WhenManagingWebdriverTimeouts extends Specification {
stopwatch.start()
page.verySlowLoadingField.isDisplayed()
then: "No error should be thrown"
notThrown(org.openqa.selenium.ElementNotVisibleException)
notThrown(org.openqa.selenium.ElementNotInteractableException)
and: "the response should be returned instantly"
stopwatch.stop() < 100
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public void should_pass_immediately_if_waiting_for_field_that_is_present() {
page.element(page.firstName).waitUntilVisible();
}

@Test(expected = ElementNotVisibleException.class)
@Test(expected = ElementNotInteractableException.class)
public void should_throw_expection_if_waiting_for_field_that_does_not_appear() {
page.setWaitForTimeout(500);
assertThat(page.element(page.hiddenField).isCurrentlyVisible(), is(false));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.openqa.selenium.By;
import org.openqa.selenium.ElementNotVisibleException;
import org.openqa.selenium.ElementNotInteractableException;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;

Expand Down Expand Up @@ -74,7 +74,7 @@ public void should_find_element_immediately_if_a_previous_step_has_failed() thro
@Test
public void should_wait_for_find_element_immediately_if_no_previous_step_has_failed() {

expectedException.expect(ElementNotVisibleException.class);
expectedException.expect(ElementNotInteractableException.class);
SmartAjaxElementLocator locator = new SmartAjaxElementLocator(driver, field, MobilePlatform.NONE);
locator.findElement();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.openqa.selenium.By;
import org.openqa.selenium.ElementNotVisibleException;
import org.openqa.selenium.ElementNotInteractableException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;

import java.time.Duration;

import static java.util.concurrent.TimeUnit.SECONDS;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
Expand Down Expand Up @@ -94,7 +96,7 @@ public void alerts_should_be_ignored() {
webDriverFacade.switchTo().alert().sendKeys("abc");
}

@Test(expected = ElementNotVisibleException.class)
@Test(expected = ElementNotInteractableException.class)
public void switchTo_web_element_should_throw_element_not_visible() {
webDriverFacade.switchTo().activeElement();
}
Expand All @@ -116,7 +118,7 @@ public void cookies_should_be_ignored() {

@Test
public void manage_timeouts_should_be_ignored() {
webDriverFacade.manage().timeouts().implicitlyWait(100, SECONDS).setScriptTimeout(100, SECONDS);
webDriverFacade.manage().timeouts().implicitlyWait(Duration.ofSeconds(100)).scriptTimeout(Duration.ofSeconds(100));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import net.thucydides.core.annotations.Steps;
import net.thucydides.core.pages.Pages;
import net.thucydides.core.webdriver.WebDriverFacade;
import org.openqa.selenium.ElementNotVisibleException;
import org.openqa.selenium.ElementNotInteractableException;
import org.openqa.selenium.WebDriver;

import static org.hamcrest.MatcherAssert.assertThat;
Expand Down Expand Up @@ -81,7 +81,7 @@ public void andIShouldBeUsing(String driverName) {

@Given("the scenario throws an exception")
public void throwAnException() {
throw new ElementNotVisibleException("Oops");
throw new ElementNotInteractableException("Oops");
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import net.thucydides.junit.runners.ThucydidesRunner;
import org.junit.Assume;
import org.junit.Ignore;
import org.openqa.selenium.ElementNotVisibleException;
import org.openqa.selenium.ElementNotInteractableException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -218,7 +218,7 @@ public void data_driven_test_step_that_fails() {
@Step
public void data_driven_test_step_that_breaks() {
if (Integer.parseInt(age) > 35) {
throw new ElementNotVisibleException("A webdriver issue");
throw new ElementNotInteractableException("A webdriver issue");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,16 @@
import net.thucydides.core.annotations.Pending;
import net.thucydides.core.annotations.Step;
import net.thucydides.core.annotations.Steps;
import net.thucydides.core.pages.Pages;
import net.thucydides.core.steps.ScenarioSteps;
import org.junit.Assume;
import org.junit.Ignore;
import org.junit.jupiter.api.Assumptions;
import org.openqa.selenium.ElementNotVisibleException;
import org.openqa.selenium.ElementNotInteractableException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.concurrent.ThreadLocalRandom;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.isEmptyString;
import static org.hamcrest.Matchers.lessThan;
import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.*;

@SuppressWarnings("serial")
public class SampleScenarioSteps extends UIInteractionSteps {
Expand Down Expand Up @@ -235,7 +229,7 @@ public void data_driven_test_step_that_fails(String age) {
@Step
public void data_driven_test_step_that_breaks(String age) {
if (Integer.parseInt(age) > 35) {
throw new ElementNotVisibleException("A webdriver issue");
throw new ElementNotInteractableException("A webdriver issue");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -658,8 +658,8 @@ private boolean thisIsANew(ScreenshotAndHtmlSource screenshotAndHtmlSource) {
if (screenshots.isEmpty()) {
return true;
} else {
ScreenshotAndHtmlSource latestScreenshotAndHtmlSource = screenshots.get(screenshots.size() - 1);
return !latestScreenshotAndHtmlSource.equals(screenshotAndHtmlSource);
ScreenshotAndHtmlSource previousScreenshot = screenshots.get(screenshots.size() - 1);
return !screenshotAndHtmlSource.getScreenshotName().equals(previousScreenshot.getScreenshotName());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,24 @@ public class ScreenshotAndHtmlSource implements Comparable<ScreenshotAndHtmlSour
private final File screenshot;
private final File htmlSource;
private Long timeStamp;
private final String screenshotName;

public ScreenshotAndHtmlSource(String screenshotName, String sourcecodeName) {
this.screenshot = new File(screenshotName);
this.htmlSource = (sourcecodeName != null) ? new File(sourcecodeName) : null;
this.timeStamp = System.currentTimeMillis();
this.screenshotName = screenshot.getName();
}

public ScreenshotAndHtmlSource(File screenshot, File sourcecode) {
this.screenshot = screenshot;
this.htmlSource = sourcecode;
this.timeStamp = System.currentTimeMillis();
this.screenshotName = (screenshot != null) ? screenshot.getName() : "";
}

public String getScreenshotName() {
return screenshot.getName();
return screenshotName;
}

public String getHtmlSourceName() {
Expand Down

0 comments on commit 068a21b

Please sign in to comment.