Skip to content

Commit

Permalink
Fix a few tests for IE11 (#4317)
Browse files Browse the repository at this point in the history
* Fix PaperInputIT by moving to the end of the field before typing

* Fix AttachExistingDomElementByIdIT by using tab instead of enter to commit the value change of an input field

* WebComponentsIT: Skip browser log API which doesn't exist for IE11

* Move ExceptionStackTraceIT to test-dev-mode because stack trace is not shown in production mode

* Use TB query instead of getInShadowRoot
  • Loading branch information
pekam authored and gilberto-torrezan committed Jul 11, 2018
1 parent e68762e commit 4d63f65
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.openqa.selenium.WebElement;

import com.vaadin.flow.testutil.ChromeBrowserTest;
import com.vaadin.testbench.TestBenchElement;

public abstract class AbstractAttachExistingElementByIdIT
extends ChromeBrowserTest {
Expand All @@ -39,7 +40,8 @@ protected void assertTemplate(String id, String initialLabelText,
Assert.assertEquals("Text from input Harley!", getLabel(id).getText());

// Reset values to defaults
getInShadowRoot(findElement(By.id(id)), By.id("button")).click();
$(TestBenchElement.class).id(id).$(TestBenchElement.class).id("button")
.click();

Assert.assertEquals("default", getLabel(id).getText());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.openqa.selenium.logging.LogEntry;

import com.vaadin.flow.testutil.ChromeBrowserTest;
import com.vaadin.testbench.parallel.BrowserUtil;

public class WebComponentsIT extends ChromeBrowserTest {

Expand All @@ -37,6 +38,11 @@ public void testPolyfillLoaded() {
.anyMatch(element -> element.getAttribute("src")
.endsWith("webcomponents-loader.js")));

if (BrowserUtil.isIE(getDesiredCapabilities())) {
// Console logs are not available from IE11
return;
}

LogEntries logs = driver.manage().logs().get("browser");
if (logs != null) {
Optional<LogEntry> anyError = StreamSupport
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected void assertTemplate(String id, String initialLabelText,
Assert.assertEquals(placeholder, input.getAttribute("placeholder"));

input.sendKeys("Harley!");
input.sendKeys(Keys.ENTER);
input.sendKeys(Keys.TAB);

Assert.assertEquals("Text from input Harley!", getLabel(id).getText());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebElement;

import com.vaadin.flow.testutil.ChromeBrowserTest;
Expand All @@ -31,12 +32,13 @@ public void paperInputIsFunctional() {

WebElement input = findElement(By.tagName("paper-input"));
String originalValue = input.getAttribute("value");
input.sendKeys("bar");
input.sendKeys(Keys.END + "bar");

List<WebElement> updateValueElements = findElements(
By.className("update-value"));
WebElement lastUpdateValue = updateValueElements
.get(updateValueElements.size() - 1);
org.junit.Assert.assertEquals(originalValue + "bar", lastUpdateValue.getText());
org.junit.Assert.assertEquals(originalValue + "bar",
lastUpdateValue.getText());
}
}

0 comments on commit 4d63f65

Please sign in to comment.