picimako / terra-support

Adds support for Cerner's Terra UI component and test automation libraries.
https://plugins.jetbrains.com/plugin/15430-terra-support
Apache License 2.0
0 stars 0 forks source link

Double-clicking on a screenshot node throws exception when no latest screenshot is available #28

Closed picimako closed 3 years ago

picimako commented 3 years ago

Steps to reproduce

  1. Open the Terra Wdio tool window
  2. Double-click on a screenshot node that has no latest version available.
  3. Check the IDE Event Log.

Expected results

No editor is opened, no exception is thrown.

Actual results

The following exception is thrown:

java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
    at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
    at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
    at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248)
    at java.base/java.util.Objects.checkIndex(Objects.java:372)
    at java.base/java.util.ArrayList.get(ArrayList.java:458)
    at com.picimako.terra.wdio.toolwindow.action.CompareLatestWithReferenceScreenshotsAction.performAction(CompareLatestWithReferenceScreenshotsAction.java:63)
    at com.picimako.terra.wdio.toolwindow.action.AbstractTerraWdioToolWindowAction.performAction(AbstractTerraWdioToolWindowAction.java:55)
    at com.picimako.terra.wdio.toolwindow.event.MouseListeningScreenshotNodeActionInvoker.mouseClicked(MouseListeningScreenshotNodeActionInvoker.java:47)

Technical notes

A simple list size check might be enough to fix the problem.

Versions affected

<= 0.3.0

Out of scope

picimako commented 3 years ago

Completed.