Browse Source

Tweak a test to open Grid details row by clicking cell instead of row. (#11764)

tags/8.10.0.alpha1
Anna Koskinen 4 years ago
parent
commit
1e764045e3

+ 10
- 7
uitest/src/test/java/com/vaadin/tests/components/grid/GridHeightTest.java View File

package com.vaadin.tests.components.grid; package com.vaadin.tests.components.grid;


import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.number.IsCloseTo.closeTo;
import static org.junit.Assert.fail;

import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import org.junit.Ignore; import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.openqa.selenium.By; import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;


import com.vaadin.testbench.elements.GridElement; import com.vaadin.testbench.elements.GridElement;
import com.vaadin.testbench.elements.GridElement.GridRowElement; import com.vaadin.testbench.elements.GridElement.GridRowElement;
import com.vaadin.testbench.parallel.TestCategory; import com.vaadin.testbench.parallel.TestCategory;
import com.vaadin.tests.tb3.MultiBrowserTest; import com.vaadin.tests.tb3.MultiBrowserTest;


import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.number.IsCloseTo.closeTo;
import static org.junit.Assert.fail;

/** /**
* Tests that Grid gets correct height based on height mode, and resizes * Tests that Grid gets correct height based on height mode, and resizes
* properly with details row if height is undefined. * properly with details row if height is undefined.
} }


GridRowElement row = grid.getRow(2); GridRowElement row = grid.getRow(2);
row.click(getXOffset(row, 5), getYOffset(row, 5));
WebElement cell = row.findElements(By.className("v-grid-cell"))
.get(0);
cell.click();
waitForElementPresent(By.id("lbl1")); waitForElementPresent(By.id("lbl1"));


int openHeight = grid.getSize().getHeight(); int openHeight = grid.getSize().getHeight();
detailsRowHeight, "opened" }); detailsRowHeight, "opened" });
} }


row.click(5, 5);
cell.click();
waitForElementNotPresent(By.id("lbl1")); waitForElementNotPresent(By.id("lbl1"));


int afterHeight = grid.getSize().getHeight(); int afterHeight = grid.getSize().getHeight();

Loading…
Cancel
Save