From 1902ae71fca8b644efa90aec8d445290f4e8ce2d Mon Sep 17 00:00:00 2001 From: Vaadin Bot Date: Mon, 16 May 2022 13:50:14 +0200 Subject: [PATCH] fix: clean default system error messages (#12951) (#13759) (#13782) Fixes #12939 Co-authored-by: caalador --- .../vaadin/flow/server/SystemMessages.java | 20 +++++++++---------- .../com/vaadin/flow/uitest/ui/LogoutIT.java | 5 ++++- .../uitest/ui/LogoutWithNotificationIT.java | 4 ++-- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/flow-server/src/main/java/com/vaadin/flow/server/SystemMessages.java b/flow-server/src/main/java/com/vaadin/flow/server/SystemMessages.java index 4a44a526f62..e5526f715c5 100644 --- a/flow-server/src/main/java/com/vaadin/flow/server/SystemMessages.java +++ b/flow-server/src/main/java/com/vaadin/flow/server/SystemMessages.java @@ -31,21 +31,19 @@ *
  • sessionExpiredURL = null
  • *
  • sessionExpiredNotificationEnabled = false
  • *
  • sessionExpiredCaption = "Session Expired"
  • - *
  • sessionExpiredMessage = "Take note of any unsaved data, and - * click here or press ESC key to continue."
  • + *
  • sessionExpiredMessage = "Take note of any unsaved data, and click + * here or press ESC key to continue."
  • *
  • internalErrorURL = null
  • *
  • internalErrorNotificationEnabled = true
  • *
  • internalErrorCaption = "Internal error"
  • - *
  • internalErrorMessage = "Please notify the administrator.
    - * Take note of any unsaved data, and click here or press ESC to - * continue."
  • + *
  • internalErrorMessage = "Please notify the administrator. Take note + * of any unsaved data, and click here or press ESC to continue."
  • *
  • cookiesDisabledURL = null
  • *
  • cookiesDisabledNotificationEnabled = true
  • *
  • cookiesDisabledCaption = "Cookies disabled"
  • *
  • cookiesDisabledMessage = "This application requires cookies to - * function.
    - * Please enable cookies in your browser and click here or press ESC to - * try again.
  • + * function. Please enable cookies in your browser and click here or press ESC + * to try again. * * * @since 1.0 @@ -54,17 +52,17 @@ public class SystemMessages implements Serializable { protected String sessionExpiredURL = null; protected boolean sessionExpiredNotificationEnabled = false; protected String sessionExpiredCaption = "Session Expired"; - protected String sessionExpiredMessage = "Take note of any unsaved data, and click here or press ESC key to continue."; + protected String sessionExpiredMessage = "Take note of any unsaved data, and click here or press ESC key to continue."; protected String internalErrorURL = null; protected boolean internalErrorNotificationEnabled = true; protected String internalErrorCaption = "Internal error"; - protected String internalErrorMessage = "Please notify the administrator.
    Take note of any unsaved data, and click here or press ESC to continue."; + protected String internalErrorMessage = "Please notify the administrator. Take note of any unsaved data, and click here or press ESC to continue."; protected String cookiesDisabledURL = null; protected boolean cookiesDisabledNotificationEnabled = true; protected String cookiesDisabledCaption = "Cookies disabled"; - protected String cookiesDisabledMessage = "This application requires cookies to function.
    Please enable cookies in your browser and click here or press ESC to try again."; + protected String cookiesDisabledMessage = "This application requires cookies to function. Please enable cookies in your browser and click here or press ESC to try again."; /** * Private constructor diff --git a/flow-tests/test-root-context/src/test/java/com/vaadin/flow/uitest/ui/LogoutIT.java b/flow-tests/test-root-context/src/test/java/com/vaadin/flow/uitest/ui/LogoutIT.java index 252d75d5be5..3e3f70db3c9 100644 --- a/flow-tests/test-root-context/src/test/java/com/vaadin/flow/uitest/ui/LogoutIT.java +++ b/flow-tests/test-root-context/src/test/java/com/vaadin/flow/uitest/ui/LogoutIT.java @@ -32,7 +32,10 @@ public void setLocationWithNotificationDisabled_noErrorMessages() { $(NativeButtonElement.class).first().click(); // There can be "Session Expired" message because of heartbeat - checkLogsForErrors(msg -> msg.equals("Session Expired")); + // Strings defined in com.vaadin.flow.server.SystemMessages + checkLogsForErrors( + msg -> msg.contains("Session Expired") || msg.contains( + "Take note of any unsaved data, and click here or press ESC key to continue.")); // There can't be any error dialog Assert.assertFalse(isElementPresent(By.className("v-system-error"))); diff --git a/flow-tests/test-root-context/src/test/java/com/vaadin/flow/uitest/ui/LogoutWithNotificationIT.java b/flow-tests/test-root-context/src/test/java/com/vaadin/flow/uitest/ui/LogoutWithNotificationIT.java index ff3b8feff6f..21939d08b6b 100644 --- a/flow-tests/test-root-context/src/test/java/com/vaadin/flow/uitest/ui/LogoutWithNotificationIT.java +++ b/flow-tests/test-root-context/src/test/java/com/vaadin/flow/uitest/ui/LogoutWithNotificationIT.java @@ -39,8 +39,8 @@ public void setLocationWithNotificationEnabled_noErrorMessages() { // There can be "Session Expired" message because of heartbeat // Strings defined in com.vaadin.flow.server.SystemMessages checkLogsForErrors(msg -> msg.contains("Session Expired") - || msg.contains("Take note of any unsaved data, and click " + - "here or press ESC key to continue.")); + || msg.contains("Take note of any unsaved data, and click " + + "here or press ESC key to continue.")); // There can't be any error dialog Assert.assertFalse(isElementPresent(By.className("v-system-error")));