Skip to content

Commit

Permalink
Ensure TestBenchElement uses the proxy of the driver (#955)
Browse files Browse the repository at this point in the history
  • Loading branch information
Artur- authored and alvarezguille committed Oct 27, 2017
1 parent b65f9eb commit 1458319
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,7 @@ public void waitForVaadin() {
@Override
public void showTooltip() {
waitForVaadin();
new Actions(getCommandExecutor().getWrappedDriver())
.moveToElement(actualElement).perform();
new Actions(getDriver()).moveToElement(actualElement).perform();
// Wait for a small moment for the tooltip to appear
try {
Thread.sleep(1000); // VTooltip.OPEN_DELAY = 750;
Expand Down Expand Up @@ -331,7 +330,7 @@ public String getCssValue(String propertyName) {
public void click(int x, int y, Keys... modifiers) {
autoScrollIntoView();
waitForVaadin();
Actions actions = new Actions(getCommandExecutor().getWrappedDriver());
Actions actions = new Actions(getDriver());
actions.moveToElement(actualElement, x, y);
// Press any modifier keys
for (Keys modifier : modifiers) {
Expand Down Expand Up @@ -374,7 +373,7 @@ public TestBenchCommandExecutor getCommandExecutor() {

@Override
public WebDriver getDriver() {
return getCommandExecutor().getWrappedDriver();
return getCommandExecutor().getDriver();
}

/**
Expand Down Expand Up @@ -537,7 +536,7 @@ private void autoScrollIntoView() {
* <p>
* Use e.g. as
* <code>waitUntil(ExpectedConditions.presenceOfElementLocated(by), 10);</code>
*
*
* @param condition
* Models a condition that might reasonably be expected to
* eventually evaluate to something that is neither null nor
Expand All @@ -546,10 +545,10 @@ private void autoScrollIntoView() {
* The timeout in seconds for the wait.
* @return The condition's return value if it returned something different
* from null or false before the timeout expired.
*
*
* @throws TimeoutException
* If the timeout expires.
*
*
* @see FluentWait#until
* @see ExpectedCondition
*/
Expand All @@ -565,17 +564,17 @@ protected <T> T waitUntil(ExpectedCondition<T> condition,
* <p>
* Use e.g. as
* <code>waitUntil(ExpectedConditions.presenceOfElementLocated(by));</code>
*
*
* @param condition
* Models a condition that might reasonably be expected to
* eventually evaluate to something that is neither null nor
* false.
* @return The condition's return value if it returned something different
* from null or false before the timeout expired.
*
*
* @throws TimeoutException
* If 10 seconds passed.
*
*
* @see FluentWait#until
* @see ExpectedCondition
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public void waitForVaadin() {

@Override
public boolean compareScreen(String referenceId) throws IOException {
WebDriver driver = getWrappedDriver();
WebDriver driver = getDriver();
return ScreenshotComparator.compareScreen(referenceId,
referenceNameGenerator, imageComparison,
(TakesScreenshot) driver, (HasCapabilities) driver);
Expand Down Expand Up @@ -265,6 +265,19 @@ public WebDriver getWrappedDriver() {
return actualDriver;
}

/**
* Return a reference to the {@link WebDriver} instance associated with this
* {@link TestBenchCommandExecutor}
*
* @return a WebDriver instance
*/
public WebDriver getDriver() {
// This is actually never called. The overridden version in
// TestBenchDriverProy is. This class hierarchy is wrong in several
// ways.
return actualDriver;
}

@Override
public void resizeViewPortTo(final int desiredWidth,
final int desiredHeight) throws UnsupportedOperationException {
Expand Down

0 comments on commit 1458319

Please sign in to comment.