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.

ExtraWindowShownTest.java 933B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package com.vaadin.tests.components.window;
  2. import static org.junit.Assert.assertFalse;
  3. import org.junit.Test;
  4. import com.vaadin.testbench.elements.ButtonElement;
  5. import com.vaadin.testbench.elements.WindowElement;
  6. import com.vaadin.tests.tb3.MultiBrowserTest;
  7. public class ExtraWindowShownTest extends MultiBrowserTest {
  8. @Test
  9. public void testNoExtraWindowAfterClosing() throws Exception {
  10. openTestURL();
  11. openWindow();
  12. closeWindow();
  13. assertNoWindow();
  14. openWindow();
  15. closeWindow();
  16. assertNoWindow();
  17. }
  18. private void openWindow() {
  19. $(ButtonElement.class).first().click();
  20. }
  21. private void closeWindow() {
  22. $(WindowElement.class).$(ButtonElement.class).first().click();
  23. }
  24. private void assertNoWindow() {
  25. assertFalse("Window found when there should be none.",
  26. $(WindowElement.class).exists());
  27. }
  28. }