-
Improvement
-
Resolution: Unresolved
-
Neutral
-
None
-
None
-
None
-
-
Empty show more show less
Currently, closed dialogs stay in fakeVaadinSession hanging. Opening another dialog with the same name results in multiple dialogs with the same name in session. Tests were failing because getDialog returned always the first dialog no matter if it was closed and reopened.
A code change was temporarily introduced to allow tests that reopened dialogs. It is not a robust fix, just a makeshift.
To have tests failing against which to implement the fix, just replace the makeshift with the former line.
See the TODO comment in FakeMagnoliaUI under the getDialog method for more info.
public Window getDialog(String caption) { List<Window> windows = this.fakeVaadinSession.getWindowsAdded(); List<Window> collect = windows.stream().filter(w -> caption.equals(w.getCaption())).collect(Collectors.toList()); Optional<Window> window = Optional.of(collect.get(collect.size() - 1)); // TODO Currently I am getting the last opened dialog regardless if it was closed or not. // Ensure closed dialogs are removed from the session. // Do not allow dialogs with same name to be opened if one such exists. // To get failing tests replace the above with // Optional<Window> window = windows.stream().filter(w -> caption.equals(w.getCaption())).findFirst(); return window.orElseThrow(() -> new RuntimeException("Not found window with caption " + caption)); }
Acceptance criteria