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.

MultiBrowserThemeTest.java 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * Copyright 2000-2016 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.tb3;
  17. import java.util.Arrays;
  18. import java.util.Collection;
  19. import java.util.Collections;
  20. import java.util.HashSet;
  21. import java.util.List;
  22. import java.util.Set;
  23. import org.junit.runner.RunWith;
  24. import org.junit.runners.Parameterized.Parameters;
  25. import org.openqa.selenium.remote.DesiredCapabilities;
  26. /**
  27. * Test which uses theme returned by {@link #getTheme()} for running the test
  28. */
  29. @RunWith(ParameterizedTB3Runner.class)
  30. public abstract class MultiBrowserThemeTest extends MultiBrowserTest {
  31. public static final List<String> themesToTest = Collections
  32. .unmodifiableList(Arrays.asList(new String[] { "valo", "reindeer",
  33. "runo", "chameleon", "base" }));
  34. private String theme;
  35. public void setTheme(String theme) {
  36. this.theme = theme;
  37. }
  38. @Parameters
  39. public static Collection<String> getThemes() {
  40. return themesToTest;
  41. }
  42. @Override
  43. protected boolean requireWindowFocusForIE() {
  44. return true;
  45. }
  46. @Override
  47. protected void openTestURL(Class<?> uiClass, String... parameters) {
  48. Set<String> params = new HashSet<>(Arrays.asList(parameters));
  49. params.add("theme=" + theme);
  50. super.openTestURL(uiClass, params.toArray(new String[params.size()]));
  51. }
  52. @Override
  53. public List<DesiredCapabilities> getBrowsersToTest() {
  54. List<DesiredCapabilities> browsersToTest = getBrowsersExcludingPhantomJS();
  55. browsersToTest.add(PHANTOMJS2());
  56. return browsersToTest;
  57. }
  58. }