You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ah...@apache.org on 2018/07/03 20:45:20 UTC

[royale-asjs] 01/05: fix valueExpression in JS

This is an automated email from the ASF dual-hosted git repository.

aharui pushed a commit to branch feature/MXRoyale
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git

commit 0d04a0220604a3549f6c0e8a4296f854fc7dc39e
Author: Alex Harui <ah...@apache.org>
AuthorDate: Tue Jul 3 13:41:30 2018 -0700

    fix valueExpression in JS
---
 mustella/src/main/java/marmotinni/AssertPropertyValue.java | 10 +++++++++-
 mustella/src/main/java/marmotinni/SetProperty.java         |  4 +++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/mustella/src/main/java/marmotinni/AssertPropertyValue.java b/mustella/src/main/java/marmotinni/AssertPropertyValue.java
index 156be82..663bbd5 100644
--- a/mustella/src/main/java/marmotinni/AssertPropertyValue.java
+++ b/mustella/src/main/java/marmotinni/AssertPropertyValue.java
@@ -71,7 +71,15 @@ public class AssertPropertyValue extends AssertStep {
 		String actualValue = ((JavascriptExecutor)webDriver).executeScript(getScript.toString()).toString();
 		String valueString = null;
 		if (valueExpression != null)
-			valueString = ((JavascriptExecutor)webDriver).executeScript(valueExpression).toString();
+        {
+            StringBuilder valueScript = new StringBuilder();
+            insertTargetScript(valueScript, target);
+            valueScript.append("var " + valueExpression + ";");
+            valueScript.append("return value;");
+            if (TestStep.showScripts)
+                System.out.println(valueScript.toString());
+			valueString = ((JavascriptExecutor)webDriver).executeScript(valueScript.toString()).toString();
+        }
 		else if (value != null)
 			valueString = value;
 		else
diff --git a/mustella/src/main/java/marmotinni/SetProperty.java b/mustella/src/main/java/marmotinni/SetProperty.java
index b05c419..c0742d4 100644
--- a/mustella/src/main/java/marmotinni/SetProperty.java
+++ b/mustella/src/main/java/marmotinni/SetProperty.java
@@ -44,7 +44,9 @@ public class SetProperty extends TestStep {
     {
 		String valueString = null;
 		if (valueExpression != null)
-			valueString = ((JavascriptExecutor)webDriver).executeScript(valueExpression).toString();
+        {
+            valueString = valueExpression.replace("value =", "");
+        }
 		else if (value != null)
 		{
 			if (value.equalsIgnoreCase("false") || value.equalsIgnoreCase("true"))