use of com.vaadin.flow.component.upload.testbench.UploadElement 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