Skip to content

Commit 7dec9f1

Browse files
committed
Adding tests for executeScript that returns recursive structures
1 parent 9731d69 commit 7dec9f1

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

java/client/test/org/openqa/selenium/ExecutingJavascriptTest.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,4 +553,30 @@ public void shouldReturnDocumentElementIfDocumentIsReturned() {
553553
assertTrue(value instanceof WebElement);
554554
assertTrue(((WebElement) value).getText().contains("A single line of text"));
555555
}
556+
557+
@Test(timeout = 10000)
558+
@Ignore(value = IE, reason = "returns WebElement")
559+
@Ignore(PHANTOMJS)
560+
@Ignore(SAFARI)
561+
public void shouldHandleObjectThatThatHaveToJSONMethod() {
562+
driver.get(pages.simpleTestPage);
563+
564+
Object value = executeScript("return window.performance.timing");
565+
566+
assertTrue(value instanceof Map);
567+
}
568+
569+
@Test(timeout = 10000)
570+
@Ignore(CHROME)
571+
@Ignore(IE)
572+
@Ignore(PHANTOMJS)
573+
@Ignore(SAFARI)
574+
@Ignore(value = MARIONETTE, issue = "https://github.com/mozilla/geckodriver/issues/904")
575+
public void shouldHandleRecursiveStructures() {
576+
driver.get(pages.simpleTestPage);
577+
578+
Object value = executeScript("var obj1 = {}; var obj2 = {}; obj1['obj2'] = obj2; obj2['obj1'] = obj1; return obj1");
579+
580+
assertTrue(value instanceof Map);
581+
}
556582
}

0 commit comments

Comments
 (0)