Skip to content

Commit

Permalink
fix: update openRowForEditing to get vaadin-crud-edit based on row.in…
Browse files Browse the repository at this point in the history
…dex (#541) (#542)
  • Loading branch information
yuriy-fix authored Dec 21, 2020
1 parent 39f1b59 commit b4731de
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,16 @@

import com.vaadin.flow.component.button.testbench.ButtonElement;
import com.vaadin.flow.component.grid.testbench.GridElement;
import com.vaadin.flow.component.grid.testbench.GridTHTDElement;
import com.vaadin.flow.component.grid.testbench.GridTRElement;
import com.vaadin.flow.component.textfield.testbench.TextFieldElement;
import com.vaadin.testbench.ElementQuery;
import com.vaadin.testbench.TestBenchElement;
import com.vaadin.testbench.elementsbase.Element;

import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;

/**
* TestBench element for the vaadin-crud element
Expand Down Expand Up @@ -82,7 +85,13 @@ public void openRowForEditing(int row) {
if (isEditOnClick()) {
this.getGrid().getCell(row, 0).click();
} else {
this.$("vaadin-crud-edit").all().get(row).click();
GridTRElement editedRow = getGrid().getRow(row);
GridTHTDElement editCell = getGrid().getAllColumns().stream()
.map(column -> editedRow.getCell(column))
.filter(cell -> cell.getInnerHTML()
.contains("vaadin-crud-edit"))
.collect(Collectors.toList()).get(0);
editCell.$("vaadin-crud-edit").get(0).click();
}
}

Expand Down

0 comments on commit b4731de

Please sign in to comment.