|
|
|
|
|
|
|
|
import com.vaadin.testbench.By; |
|
|
import com.vaadin.testbench.By; |
|
|
import com.vaadin.testbench.elements.ButtonElement; |
|
|
import com.vaadin.testbench.elements.ButtonElement; |
|
|
import com.vaadin.testbench.elements.GridElement; |
|
|
import com.vaadin.testbench.elements.GridElement; |
|
|
|
|
|
import com.vaadin.testbench.elements.GridElement.GridCellElement; |
|
|
import com.vaadin.testbench.elements.GridElement.GridRowElement; |
|
|
import com.vaadin.testbench.elements.GridElement.GridRowElement; |
|
|
import com.vaadin.testbench.elements.NotificationElement; |
|
|
import com.vaadin.testbench.elements.NotificationElement; |
|
|
import com.vaadin.tests.tb3.MultiBrowserTest; |
|
|
import com.vaadin.tests.tb3.MultiBrowserTest; |
|
|
|
|
|
|
|
|
assertRowExists(5, "Row 1005"); |
|
|
assertRowExists(5, "Row 1005"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
public void testTextFieldSize() { |
|
|
|
|
|
openTestURL(); |
|
|
|
|
|
GridCellElement cell = $(GridElement.class).first().getCell(0, 1); |
|
|
|
|
|
int cellWidth = cell.getSize().getWidth(); |
|
|
|
|
|
int fieldWidth = cell.findElement(By.tagName("input")).getSize() |
|
|
|
|
|
.getWidth(); |
|
|
|
|
|
// padding left and right, +1 to fix sub pixel issues |
|
|
|
|
|
int padding = 18 * 2 + 1; |
|
|
|
|
|
|
|
|
|
|
|
int extraSpace = Math.abs(fieldWidth - cellWidth); |
|
|
|
|
|
Assert.assertTrue("Too much unused space in cell. Expected: " + padding |
|
|
|
|
|
+ " Actual: " + extraSpace, extraSpace <= padding); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private void editTextFieldInCell(GridElement grid, int row, int col) { |
|
|
private void editTextFieldInCell(GridElement grid, int row, int col) { |
|
|
WebElement textField = grid.getCell(row, col) |
|
|
WebElement textField = grid.getCell(row, col) |
|
|
.findElement(By.tagName("input")); |
|
|
.findElement(By.tagName("input")); |