use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class IdTestIT method testIds.
@Test
public void testIds() {
open();
checkLogsForErrors(msg -> msg.contains("sockjs-node") || msg.contains("[WDS]"));
waitUntilWithMessage(ExpectedConditions.presenceOfElementLocated(By.tagName("my-component")), "Failed to load my-component", 25);
TestBenchElement myComponent = $("my-component").first();
// wait for polymer initalisation
waitUntillWithMessage(driver -> getCommandExecutor().executeScript("return !!window.Polymer || !!arguments[0].constructor.polymerElementVersion", myComponent), "Failed to load constructor.polymerElementVersion for 'my-component'");
waitUntillWithMessage(driver -> getCommandExecutor().executeScript("return arguments[0].$ !== undefined", myComponent), "Failed to load $ for 'my-component'");
WebElement content = myComponent.$(TestBenchElement.class).id("content");
Assert.assertEquals("", content.getText());
WebElement button = myComponent.$(TestBenchElement.class).id("button");
button.click();
Assert.assertEquals("1", content.getText());
button.click();
Assert.assertEquals("2", content.getText());
}
use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class ThemedVariantComponentIT method servletPageGetsWebComponent_attributeIsReflectedToServer.
@Test
public void servletPageGetsWebComponent_attributeIsReflectedToServer() {
open();
TestBenchElement webComponent = $("themed-variant-web-component").first();
Assert.assertEquals("dark", webComponent.getAttribute("theme"));
}
use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class InnerTemplateVisibilityIT method innerTemplateIsHiddenWithDisplayNone.
@Test
public void innerTemplateIsHiddenWithDisplayNone() {
open();
// when inner is hidden
NativeButtonElement toggleButton = $(NativeButtonElement.class).id(InnerTemplateVisibilityView.TOGGLE_INNER_VISIBILITY_BUTTON_ID);
toggleButton.click();
// then: element is not visible, attribute 'hidden' and 'display: none'
// set
TestBenchElement outer = $("*").id(InnerTemplateVisibilityView.OUTER_ID);
TestBenchElement inner = outer.$("*").id(InnerTemplateVisibilityView.INNER_ID);
Assert.assertFalse("expected inner to be hidden", inner.isDisplayed());
Assert.assertNotNull("expected attribute hidden on inner", inner.getAttribute("hidden"));
Assert.assertEquals("expected 'display: none' on inner", "none", inner.getCssValue("display"));
}
use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class InjectedElementInsideMixinBehaviorIT method injectedByIdWorksWitinMixins.
@Test
public void injectedByIdWorksWitinMixins() {
open();
TestBenchElement template = $("mixin-injects").first();
WebElement injected = template.$(TestBenchElement.class).id("injected");
Assert.assertEquals("foo", injected.getText());
}
use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class MutationSeveralSyncedPropsIT method twoSynchronizedPropertiesSimultensousUpdate_bothAreUpdated.
@Test
public void twoSynchronizedPropertiesSimultensousUpdate_bothAreUpdated() {
open();
TestBenchElement template = $(TestBenchElement.class).id("template");
WebElement name = template.$(TestBenchElement.class).id("name");
WebElement msg = template.$(TestBenchElement.class).id("msg");
Assert.assertEquals("foo", name.getText());
Assert.assertEquals("msg", msg.getText());
findElement(By.id("update")).click();
Assert.assertEquals("bar", name.getText());
Assert.assertEquals("baz", msg.getText());
}
Aggregations