use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class UploadIT method multiFileUpload.
@Test
@Ignore
public void multiFileUpload() throws Exception {
open();
waitUntil(driver -> {
By selector = By.id(UPLOAD_ID);
return isElementPresent(selector) && findElement(selector).isDisplayed();
});
File tempFile = createTempFile("foo");
TestBenchElement input = $(TestBenchElement.class).id(UPLOAD_ID).$(TestBenchElement.class).id("fileInput");
setLocalFileDetector(input);
input.sendKeys(tempFile.getPath());
waitUntil(driver -> isElementPresent(By.className("uploaded-text")));
WebElement uploadedText = findElement(By.className("uploaded-text"));
Assert.assertEquals("foo", uploadedText.getText());
}
use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class ComponentAddedViaInitListenerIT method componentAddedViaInitListenerIsLoaded.
@Test
public void componentAddedViaInitListenerIsLoaded() {
open();
TestBenchElement component = $("init-listener-component").first();
TestBenchElement div = component.$("div").first();
Assert.assertEquals("Init Listener Component", div.getText());
}
use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class ParentTemplateIT method customElementIsRegistered.
@Test
public void customElementIsRegistered() throws Exception {
open();
TestBenchElement template = $("parent-template").first();
TestBenchElement div = template.$("*").id("div");
Assert.assertEquals("baz", div.getText());
TestBenchElement child = template.$("*").id("child");
Assert.assertEquals("bar", child.$("*").id("info").getText());
}
use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class TemplatePushIT method execJsPushed.
@Test
public void execJsPushed() throws Exception {
open();
TestBenchElement tpl = $("template-push-view").first();
tpl.$("button").id("execJsTest").click();
TestBenchElement label = tpl.$("label").id("label");
waitUntil(foo -> {
return "from execJS".equals(label.getText());
}, 5);
}
use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class AppViewIT method upload_file_in_private_view.
@Test
public void upload_file_in_private_view() throws IOException {
open("private");
loginUser();
UploadElement upload = $(UploadElement.class).first();
File tmpFile = File.createTempFile("security-flow-image", ".png");
InputStream imageStream = getClass().getClassLoader().getResourceAsStream("image.png");
IOUtils.copyLarge(imageStream, new FileOutputStream(tmpFile));
tmpFile.deleteOnExit();
upload.upload(tmpFile);
TestBenchElement text = $("p").id("uploadText");
TestBenchElement img = $("img").id("uploadImage");
Assert.assertEquals("Loan application uploaded by John the User", text.getText());
Assert.assertTrue(img.getPropertyString("src").contains("/VAADIN/dynamic/resource/"));
}
Aggregations