Skip to content

Clicking a disabled button silently does nothing #1943

Description

@mvysny

Calling TestBenchElement.click() on a disabled button silently does nothing and simply continue the execution of a test. I'd expect the function to fail, giving a proper explanation that the element is disabled and can not be clicked.

The current behavior causes the test to continue, perhaps failing later on in a strange state. This violates the "fail eagerly" principle.

Steps to reproduce:

@Route
public class MainView extends VerticalLayout {
    public MainView() {
        final Button button = new Button("Im disabled", e -> Notification.show("Hello World!"));
        button.setEnabled(false);
        add(button);
    }
}
public class MainViewIT extends AbstractViewTest {
    @Test
    public void bug() throws Exception {
        $(ButtonElement.class).first().click();
    }
}

TestBench 23.5.15, Vaadin 23.5.15

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions