Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
<dependency>
<groupId>com.flowingcode.vaadin.test</groupId>
<artifactId>testbench-rpc</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* #%L
* Grid Helpers Add-on
* %%
* Copyright (C) 2022 - 2024 Flowing Code
* Copyright (C) 2022 - 2026 Flowing Code
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -41,7 +41,8 @@ public ColumnToggleIT() {
@Override
public void setup() throws Exception {
super.setup();
grid = new GridHelperElement($(GridElement.class).waitForFirst());
grid = new GridHelperElement($(GridElement.class).waitForFirst())
.withVersion($server.getVersion());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* #%L
* Grid Helpers Add-on
* %%
* Copyright (C) 2022 - 2025 Flowing Code
* Copyright (C) 2022 - 2026 Flowing Code
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,24 +19,39 @@
*/
package com.flowingcode.vaadin.addons.gridhelpers.it;

import com.flowingcode.vaadin.testbench.rpc.Version;
import com.vaadin.flow.component.checkbox.testbench.CheckboxElement;
import com.vaadin.flow.component.grid.testbench.GridElement;
import com.vaadin.flow.component.menubar.testbench.MenuBarElement;
import com.vaadin.testbench.ElementQuery;
import com.vaadin.testbench.ElementQuery.AttributeMatch.Comparison;
import com.vaadin.testbench.TestBenchElement;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.Optional;
import lombok.NonNull;
import org.openqa.selenium.By;
import org.openqa.selenium.TimeoutException;
import org.openqa.selenium.WebElement;

public class GridHelperElement extends MyGridElement {

private Version version;

private GridHelperElement(GridHelperElement e, Version version) {
init(e.getWrappedElement(), e.getCommandExecutor());
this.version = version;
}

public GridHelperElement(GridElement e) {
init(e.getWrappedElement(), e.getCommandExecutor());
version = null;
}

public GridHelperElement withVersion(@NonNull Version version) {
return new GridHelperElement(this, version);
}

@Override
Expand All @@ -63,8 +78,15 @@ public TestBenchElement getColumnToggleButton() {

public List<CheckboxElement> getColumnToggleElements() {
try {
return new ElementQuery<>(TestBenchElement.class,
"vaadin-context-menu-overlay, vaadin-menu-bar-overlay")
ElementQuery<TestBenchElement> query;
if (version == null || version.getMajorVersion() < 25) {
query = new ElementQuery<>(TestBenchElement.class,
"vaadin-context-menu-overlay, vaadin-menu-bar-overlay");
} else {
query = new ElementQuery<>(TestBenchElement.class, "vaadin-menu-bar")
.withAttribute("theme", "gridHelperToggle", Comparison.CONTAINS_WORD);
}
return query
.context(getDriver())
.waitForFirst(100)
.$(CheckboxElement.class).all();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.flowingcode.vaadin.jsonmigration.InstrumentedRoute;
import com.flowingcode.vaadin.jsonmigration.LegacyClientCallable;
import com.flowingcode.vaadin.testbench.rpc.JsonArrayList;
import com.flowingcode.vaadin.testbench.rpc.Version;
import com.vaadin.flow.component.grid.Grid;
import com.vaadin.flow.component.grid.Grid.Column;
import com.vaadin.flow.component.grid.Grid.SelectionMode;
Expand Down Expand Up @@ -82,6 +83,11 @@ public IntegrationView() {
return IntegrationViewCallables.super.$call(invocation);
}

@Override
public Version getVersion() {
return new Version();
}

private List<Person> getItems() {
return grid.getListDataView().getItems().collect(Collectors.toList());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* #%L
* Grid Helpers Add-on
* %%
* Copyright (C) 2022 - 2024 Flowing Code
* Copyright (C) 2022 - 2026 Flowing Code
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -21,10 +21,13 @@

import com.flowingcode.vaadin.testbench.rpc.JsonArrayList;
import com.flowingcode.vaadin.testbench.rpc.RmiCallable;
import com.flowingcode.vaadin.testbench.rpc.Version;
import com.vaadin.flow.component.grid.Grid.SelectionMode;

public interface IntegrationViewCallables extends RmiCallable {

Version getVersion();

void setColumnToggleVisible(boolean value);

void setSelectOnClick(boolean value);
Expand Down