-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use JS click() instead of a simulated mouse click to avoid 'element i…
…s not clickable at point' (#981)
- Loading branch information
Showing
3 changed files
with
58 additions
and
13 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
vaadin-testbench-integration-tests/src/main/java/com/vaadin/testUI/SVGView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.vaadin.testUI; | ||
|
||
import com.vaadin.router.Route; | ||
import com.vaadin.ui.event.AttachEvent; | ||
import com.vaadin.ui.html.Div; | ||
|
||
@Route("SVGView") | ||
public class SVGView extends Div { | ||
|
||
private Div placeholder; | ||
|
||
@Override | ||
protected void onAttach(AttachEvent attachEvent) { | ||
super.onAttach(attachEvent); | ||
add(placeholder = new Div()); | ||
|
||
placeholder.getElement().setProperty("innerHTML", | ||
"<svg height=\"100\" width=\"100\">\n" | ||
+ " <circle id='ball' cx=\"50\" cy=\"50\" r=\"40\" stroke=\"black\" stroke-width=\"3\" fill=\"red\" />\n" | ||
+ " Sorry, your browser does not support inline SVG." | ||
+ "</svg>"); | ||
attachEvent.getUI().getPage().executeJavaScript( | ||
"document.getElementById('ball').addEventListener('click', function() {document.body.innerText='clicked';})"); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
vaadin-testbench-integration-tests/src/test/java/com/vaadin/tests/SVGIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.vaadin.tests; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Test; | ||
import org.openqa.selenium.By; | ||
|
||
import com.vaadin.testUI.SVGView; | ||
import com.vaadin.ui.Component; | ||
|
||
public class SVGIT extends MultiBrowserTest { | ||
|
||
@Override | ||
protected Class<? extends Component> getTestView() { | ||
return SVGView.class; | ||
} | ||
|
||
@Test | ||
public void click() { | ||
openTestURL(); | ||
findElement(By.id("ball")).click(); | ||
Assert.assertEquals("clicked", | ||
findElement(By.tagName("body")).getText()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters