testbench icon indicating copy to clipboard operation
testbench copied to clipboard

NullPointerException is reference image is not an image

Open Artur- opened this issue 3 years ago • 0 comments

If you accidentally put e.g. a text file as a reference image, your test fails with

java.lang.NullPointerException: Cannot invoke "java.awt.image.BufferedImage.getWidth()" because "image1" is null
	at com.vaadin.testbench.screenshot.ImageUtil.imagesSameSize(ImageUtil.java:96)
	at com.vaadin.testbench.screenshot.ImageComparison.createParameters(ImageComparison.java:590)
	at com.vaadin.testbench.screenshot.ImageComparison.imageEqualToReference(ImageComparison.java:125)
	at com.vaadin.testbench.commands.ScreenshotComparator.compareScreen(ScreenshotComparator.java:44)
	at com.vaadin.testbench.commands.TestBenchCommandExecutor.compareScreen(TestBenchCommandExecutor.java:140)
	at com.vaadin.starterwizard.ui.CrossBrowserIT.initialViewLargeScreen(CrossBrowserIT.java:47)

It should instead tell that the image is invalid

Artur- avatar Jan 25 '21 14:01 Artur-