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.

ClosingWindowWithBrowserFrameShouldntGenerate404Test.java 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. package com.vaadin.tests.components.window;
  2. import com.vaadin.testbench.elements.ButtonElement;
  3. import com.vaadin.testbench.elements.LabelElement;
  4. import com.vaadin.testbench.elements.WindowElement;
  5. import com.vaadin.tests.tb3.MultiBrowserTest;
  6. import org.junit.Assert;
  7. import org.junit.Test;
  8. import org.openqa.selenium.logging.LogEntry;
  9. import java.util.List;
  10. public class ClosingWindowWithBrowserFrameShouldntGenerate404Test
  11. extends MultiBrowserTest {
  12. private static boolean contains404(LogEntry logEntry) {
  13. return logEntry.getMessage().contains("404");
  14. }
  15. @Test
  16. public void openWindowWithFrame_closeWindow_no404() {
  17. openTestURL();
  18. $(ButtonElement.class).first().click();
  19. $(WindowElement.class).first().close();
  20. $(LabelElement.class).exists();
  21. List<LogEntry> logs = getDriver().manage().logs().get("browser")
  22. .getAll();
  23. Assert.assertTrue(theresNoLogWith404In(logs));
  24. }
  25. private boolean theresNoLogWith404In(List<LogEntry> logs) {
  26. return !logs.stream().anyMatch(
  27. ClosingWindowWithBrowserFrameShouldntGenerate404Test::contains404);
  28. }
  29. }