From f6bc9a8b3dfe944c881ff45955b1e2a6f458a6e1 Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Fri, 14 Jul 2023 14:42:12 -0700 Subject: [PATCH] chore: roll driver to 1.36.1 (#1335) --- .../main/java/com/microsoft/playwright/impl/Protocol.java | 1 + .../java/com/microsoft/playwright/impl/Serialization.java | 6 ++++++ .../java/com/microsoft/playwright/TestPageEvaluate.java | 7 +++++++ scripts/CLI_VERSION | 2 +- 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/playwright/src/main/java/com/microsoft/playwright/impl/Protocol.java b/playwright/src/main/java/com/microsoft/playwright/impl/Protocol.java index be18b7f4..3c4170ec 100644 --- a/playwright/src/main/java/com/microsoft/playwright/impl/Protocol.java +++ b/playwright/src/main/java/com/microsoft/playwright/impl/Protocol.java @@ -32,6 +32,7 @@ class SerializedValue{ String v; String d; String u; + String bi; public static class R { String p; String f; diff --git a/playwright/src/main/java/com/microsoft/playwright/impl/Serialization.java b/playwright/src/main/java/com/microsoft/playwright/impl/Serialization.java index ee7becae..b5d9f256 100644 --- a/playwright/src/main/java/com/microsoft/playwright/impl/Serialization.java +++ b/playwright/src/main/java/com/microsoft/playwright/impl/Serialization.java @@ -28,6 +28,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.PrintStream; import java.lang.reflect.Type; +import java.math.BigInteger; import java.net.MalformedURLException; import java.net.URL; import java.nio.charset.StandardCharsets; @@ -162,6 +163,8 @@ class Serialization { result.d = ((LocalDateTime)value).atZone(ZoneId.systemDefault()).toInstant().toString(); } else if (value instanceof URL) { result.u = ((URL)value).toString(); + } else if (value instanceof BigInteger) { + result.bi = ((BigInteger)value).toString(); } else if (value instanceof Pattern) { result.r = new SerializedValue.R(); result.r.p = ((Pattern)value).pattern(); @@ -236,6 +239,9 @@ class Serialization { throw new PlaywrightException("Unexpected value: " + value.u, e); } } + if (value.bi != null) { + return (T) new BigInteger(value.bi); + } if (value.d != null) return (T)(Date.from(Instant.parse(value.d))); if (value.r != null) diff --git a/playwright/src/test/java/com/microsoft/playwright/TestPageEvaluate.java b/playwright/src/test/java/com/microsoft/playwright/TestPageEvaluate.java index 6d47423a..10da53c7 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestPageEvaluate.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestPageEvaluate.java @@ -19,6 +19,7 @@ package com.microsoft.playwright; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.condition.DisabledIf; +import java.math.BigInteger; import java.time.*; import java.util.Map; import java.util.regex.Pattern; @@ -115,6 +116,12 @@ public class TestPageEvaluate extends TestBase { assertEquals(true, result); } + @Test + void shouldTransferBigint() { + assertEquals(new BigInteger("42", 10), page.evaluate("() => 42n")); + assertEquals(new BigInteger("17", 10), page.evaluate("a => a", new BigInteger("17", 10))); + } + // @Test void shouldTransferMapsAsEmptyObjects() { // Not applicable. diff --git a/scripts/CLI_VERSION b/scripts/CLI_VERSION index 122e0931..f107550c 100644 --- a/scripts/CLI_VERSION +++ b/scripts/CLI_VERSION @@ -1 +1 @@ -1.36.0-beta-1689010164000 +1.36.1