Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

LockingUITest.java 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package com.vaadin.tests.core;
  2. import static org.junit.Assert.assertEquals;
  3. import static org.junit.Assert.assertFalse;
  4. import static org.junit.Assert.assertTrue;
  5. import org.junit.Test;
  6. import com.vaadin.testbench.elements.ButtonElement;
  7. import com.vaadin.testbench.elements.NotificationElement;
  8. import com.vaadin.tests.tb3.SingleBrowserTest;
  9. public class LockingUITest extends SingleBrowserTest {
  10. @Test
  11. public void testLockingTheUIFor4HeartBeats() {
  12. openTestURL();
  13. clickButtonAndCheckNotification("check", LockingUI.ALL_OK);
  14. clickButtonAndCheckNotification("lock", LockingUI.LOCKING_ENDED);
  15. clickButtonAndCheckNotification("check", LockingUI.ALL_OK);
  16. }
  17. private void clickButtonAndCheckNotification(String buttonId, String text) {
  18. checkNoInitialNotification();
  19. $(ButtonElement.class).id(buttonId).click();
  20. testBench().waitForVaadin();
  21. checkNotification(text);
  22. }
  23. private void checkNotification(String text) {
  24. assertTrue("Notification should be displayed",
  25. $(NotificationElement.class).exists());
  26. NotificationElement notification = $(NotificationElement.class).first();
  27. assertEquals("Unexpected text content in Notification", text,
  28. notification.getText());
  29. notification.close();
  30. }
  31. private void checkNoInitialNotification() {
  32. assertFalse("Extra notification displayed",
  33. $(NotificationElement.class).exists());
  34. }
  35. }