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.

MultiBrowserTest.java 2.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. package com.vaadin.tests.tb3;
  2. import java.util.ArrayList;
  3. import java.util.List;
  4. import org.openqa.selenium.remote.DesiredCapabilities;
  5. import com.vaadin.testbench.parallel.Browser;
  6. /**
  7. * Base class for tests which should be run on all supported browsers. The test
  8. * is automatically launched for multiple browsers in parallel by the test
  9. * runner.
  10. *
  11. * Sub classes can, but typically should not, restrict the browsers used by
  12. * implementing a
  13. *
  14. * <pre>
  15. * &#064;Parameters
  16. * public static Collection&lt;DesiredCapabilities&gt; getBrowsersForTest() {
  17. * }
  18. * </pre>
  19. *
  20. * @author Vaadin Ltd
  21. */
  22. public abstract class MultiBrowserTest extends PrivateTB3Configuration {
  23. protected List<DesiredCapabilities> getBrowsersExcludingChrome() {
  24. return getBrowserCapabilities(Browser.FIREFOX, Browser.IE11);
  25. }
  26. protected List<DesiredCapabilities> getBrowsersExcludingIE() {
  27. return getBrowserCapabilities(Browser.FIREFOX, Browser.CHROME);
  28. }
  29. protected List<DesiredCapabilities> getBrowsersExcludingFirefox() {
  30. return getBrowserCapabilities(Browser.IE11, Browser.CHROME);
  31. }
  32. protected List<DesiredCapabilities> getBrowsersSupportingShiftClick() {
  33. return getBrowserCapabilities(Browser.IE11, Browser.CHROME);
  34. }
  35. protected List<DesiredCapabilities> getIEBrowsersOnly() {
  36. return getBrowserCapabilities(Browser.IE11);
  37. }
  38. protected List<DesiredCapabilities> getBrowsersSupportingTooltip() {
  39. // With IEDriver, the cursor seems to jump to default position after the
  40. // mouse move, so we are not able to test the tooltip behavior properly
  41. // unless using requireWindowFocusForIE() { return true; } .
  42. // See #13854.
  43. // On Firefox, the driver causes additional mouseOut events causing the
  44. // tooltip to disappear immediately. Tooltips may work in some
  45. // particular cases, but not in general.
  46. return getBrowserCapabilities(Browser.CHROME);
  47. }
  48. @Override
  49. public List<DesiredCapabilities> getBrowsersToTest() {
  50. return getBrowserCapabilities(Browser.IE11, Browser.FIREFOX,
  51. Browser.CHROME);
  52. }
  53. protected List<DesiredCapabilities> getBrowserCapabilities(
  54. Browser... browsers) {
  55. List<DesiredCapabilities> capabilities = new ArrayList<>();
  56. for (Browser browser : browsers) {
  57. capabilities.add(browser.getDesiredCapabilities());
  58. }
  59. return capabilities;
  60. }
  61. }