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.

GridBasicClientFeaturesTest.java 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. * Copyright 2000-2014 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.components.grid.basicfeatures;
  17. import java.util.List;
  18. import org.openqa.selenium.WebElement;
  19. import com.vaadin.testbench.By;
  20. import com.vaadin.testbench.TestBenchElement;
  21. import com.vaadin.testbench.elements.GridElement;
  22. /**
  23. * GridBasicClientFeatures.
  24. *
  25. * @since
  26. * @author Vaadin Ltd
  27. */
  28. public abstract class GridBasicClientFeaturesTest extends GridBasicFeaturesTest {
  29. private boolean composite = false;
  30. @Override
  31. protected Class<?> getUIClass() {
  32. return GridBasicClientFeatures.class;
  33. }
  34. @Override
  35. protected String getDeploymentPath() {
  36. String path = super.getDeploymentPath();
  37. if (composite) {
  38. path += (path.contains("?") ? "&" : "?") + "composite";
  39. }
  40. return path;
  41. }
  42. protected void setUseComposite(boolean useComposite) {
  43. composite = useComposite;
  44. }
  45. @Override
  46. protected void selectMenu(String menuCaption) {
  47. // GWT menu does not need to be clicked.
  48. selectMenu(menuCaption, false);
  49. }
  50. @Override
  51. protected WebElement getMenuElement(String menuCaption) {
  52. return getDriver().findElement(
  53. By.xpath("//td[text() = '" + menuCaption + "']"));
  54. }
  55. @Override
  56. protected GridElement getGridElement() {
  57. if (composite) {
  58. // Composite requires the basic client features widget for subparts
  59. return ((TestBenchElement) findElement(By
  60. .vaadin("//TestWidgetComponent"))).wrap(GridElement.class);
  61. } else {
  62. return super.getGridElement();
  63. }
  64. }
  65. }