Skip to content

Commit 1c6f591

Browse files
author
Denis
authored
fix: use JS to get DOM element value instead Selenium getAttribute (#11283)
fixes #11210
1 parent 060f664 commit 1c6f591

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

‎flow-tests/test-live-reload/src/test/java/com/vaadin/flow/uitest/ui/FrontendLiveReloadIT.java‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import net.jcip.annotations.NotThreadSafe;
1919
import org.junit.After;
2020
import org.junit.Assert;
21-
import org.junit.Ignore;
2221
import org.junit.Test;
2322
import org.openqa.selenium.By;
2423
import org.openqa.selenium.WebElement;
@@ -31,15 +30,14 @@ public void resetFrontend() {
3130
executeScript("fetch('/context/view/reset_frontend')");
3231
}
3332

34-
@Ignore("https://github.com/vaadin/flow/issues/11210")
3533
@Test
3634
public void liveReloadOnTouchedFrontendFile() {
3735
open();
3836

3937
// when: the frontend code is updated
4038
WebElement codeField = findElement(
4139
By.id(FrontendLiveReloadView.FRONTEND_CODE_TEXT));
42-
String oldCode = codeField.getAttribute("value");
40+
String oldCode = getValue(codeField);
4341
String newCode = oldCode.replace("Custom component contents",
4442
"Updated component contents");
4543
codeField.clear();
@@ -70,7 +68,7 @@ public void webpackErrorIsShownAfterReloadAndHiddenAfterFix() {
7068
// when: a webpack error occurs during frontend file edit
7169
WebElement codeField = findElement(
7270
By.id(FrontendLiveReloadView.FRONTEND_CODE_TEXT));
73-
String oldCode = codeField.getAttribute("value");
71+
String oldCode = getValue(codeField);
7472
String erroneousCode = "{" + oldCode;
7573
codeField.clear();
7674
codeField.sendKeys(erroneousCode); // illegal TS
@@ -87,4 +85,10 @@ public void webpackErrorIsShownAfterReloadAndHiddenAfterFix() {
8785
// then: the error box is not shown and the view is reloaded
8886
waitForElementNotPresent(By.className("v-system-error"));
8987
}
88+
89+
private String getValue(WebElement element) {
90+
Object result = getCommandExecutor()
91+
.executeScript("return arguments[0].value;", element);
92+
return result == null ? "" : result.toString();
93+
}
9094
}

0 commit comments

Comments
 (0)