Skip to content

Commit

Permalink
test: do not use getInShadowRoot (#976)
Browse files Browse the repository at this point in the history
  • Loading branch information
caalador authored Dec 16, 2021
1 parent 42405ad commit 811b0a0
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;

import com.vaadin.testbench.TestBenchElement;

public class ParentTemplateIT extends AbstractSpringTest {

@Override
Expand All @@ -32,26 +34,24 @@ protected String getTestPath() {
public void customElementIsRegistered() throws Exception {
open();

WebElement template = findElement(By.tagName("parent-template"));
WebElement div = getInShadowRoot(template, By.id("div"));
TestBenchElement template = $("parent-template").first();
TestBenchElement div = template.$("*").id("div");

Assert.assertEquals("baz", div.getText());

WebElement child = getInShadowRoot(template, By.id("child"));
TestBenchElement child = template.$("*").id("child");

Assert.assertEquals("bar",
getInShadowRoot(child, By.id("info")).getText());
Assert.assertEquals("bar", child.$("*").id("info").getText());
}

@Test
public void injectedComponentIsSpringManaged() throws Exception {
open();

WebElement template = findElement(By.tagName("parent-template"));
TestBenchElement template = $("parent-template").first();

WebElement child = getInShadowRoot(template, By.id("child"));
TestBenchElement child = template.$("*").id("child");

Assert.assertEquals("foo",
getInShadowRoot(child, By.id("message")).getText());
Assert.assertEquals("foo", child.$("*").id("message").getText());
}
}

0 comments on commit 811b0a0

Please sign in to comment.