You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CriticalNotificationsTest.java 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * Copyright 2000-2014 Vaadin Ltd.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy of
  6. * the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. * License for the specific language governing permissions and limitations under
  14. * the License.
  15. */
  16. package com.vaadin.tests.application;
  17. import org.junit.Test;
  18. import com.vaadin.testbench.elements.ButtonElement;
  19. import com.vaadin.testbench.elements.CheckBoxElement;
  20. import com.vaadin.testbench.elements.NotificationElement;
  21. import com.vaadin.tests.tb3.MultiBrowserThemeTest;
  22. public class CriticalNotificationsTest extends MultiBrowserThemeTest {
  23. @Test
  24. public void internalError() throws Exception {
  25. testCriticalNotification("Internal error");
  26. }
  27. @Test
  28. public void internalErrorDetails() throws Exception {
  29. testCriticalNotification("Internal error", true);
  30. }
  31. @Test
  32. public void custom() throws Exception {
  33. testCriticalNotification("Custom");
  34. }
  35. @Test
  36. public void sessionExpired() throws Exception {
  37. testCriticalNotification("Session expired");
  38. }
  39. @Test
  40. public void sessionExpiredDetails() throws Exception {
  41. testCriticalNotification("Session expired", true);
  42. }
  43. private void testCriticalNotification(String buttonCaption)
  44. throws Exception {
  45. testCriticalNotification(buttonCaption, false);
  46. }
  47. private void testCriticalNotification(String buttonCaption,
  48. boolean withDetails) throws Exception {
  49. openTestURL(); // "theme=" + getTheme());
  50. if (withDetails) {
  51. click($(CheckBoxElement.class).caption("Include details").first());
  52. }
  53. $(ButtonElement.class).caption(buttonCaption).first().click();
  54. // Give the notification some time to animate
  55. sleep(1000);
  56. compareScreen($(NotificationElement.class).first(),
  57. "systemnotification");
  58. }
  59. @Override
  60. protected Class<?> getUIClass() {
  61. return CriticalNotifications.class;
  62. }
  63. }