/*
- * Copyright 2000-2013 Vaadin Ltd.
+ * Copyright 2000-2014 Vaadin Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
-import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
final By newRow = By.xpath("//td[text()='newcell: 0']");
- assertTrue("Unexpected initial state", !elementIsFound(newRow));
+ assertTrue("Unexpected initial state", !isElementPresent(newRow));
selectMenuPath("Component", "Body rows", "Add first row");
- assertTrue("Add row failed", elementIsFound(newRow));
+ assertTrue("Add row failed", isElementPresent(newRow));
selectMenuPath("Component", "Body rows", "Remove first row");
- assertTrue("Remove row failed", !elementIsFound(newRow));
+ assertTrue("Remove row failed", !isElementPresent(newRow));
}
/**
"modified: Column0", getBodyCellByRowAndColumn(1, 1).getText());
}
- private boolean elementIsFound(By locator) {
- try {
- return driver.findElement(locator) != null;
- } catch (NoSuchElementException e) {
- return false;
- }
- }
-
private void assertPrimaryStylename(String stylename) {
assertTrue(getGridElement().getAttribute("class").contains(stylename));
}
private WebElement getVerticalScroller() {
- return getDriver().findElement(
- By.xpath("//div[@id='testComponent']/div[1]"));
+ return getGridElement().findElement(By.xpath("./div[1]"));
}
private WebElement getHorizontalScroller() {
- return getDriver().findElement(
- By.xpath("//div[@id='testComponent']/div[2]"));
+ return getGridElement().findElement(By.xpath("./div[2]"));
}
private WebElement getTableWrapper() {
- return getDriver().findElement(
- By.xpath("//div[@id='testComponent']/div[3]"));
+ return getGridElement().findElement(By.xpath("./div[3]"));
}
- private WebElement getGridElement() {
- return getDriver().findElement(By.id("testComponent"));
+ private GridElement getGridElement() {
+ return $(GridElement.class).id("testComponent");
}
private List<WebElement> getGridHeaderRowCells() {
- return getDriver().findElements(
- By.xpath("//div[@id='testComponent']//thead//th"));
+ return getGridElement().findElements(By.xpath(".//thead//th"));
}
private List<WebElement> getGridFooterRowCells() {
- return getDriver().findElements(
- By.xpath("//div[@id='testComponent']//tfoot//td"));
+ return getGridElement().findElements(By.xpath(".//tfoot//td"));
}
private void scrollGridVerticallyTo(double px) {
--- /dev/null
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components.grid;
+
+import com.vaadin.testbench.elements.AbstractComponentElement;
+import com.vaadin.testbench.elements.ServerClass;
+
+/**
+ * TestBench Element API for Grid
+ *
+ * @since 7.4
+ * @author Vaadin Ltd
+ */
+@ServerClass("com.vaadin.ui.components.grid.Grid")
+public class GridElement extends AbstractComponentElement {
+
+}