Skip to content

Commit

Permalink
chore: roll driver to 1.36.1 (#1335)
Browse files Browse the repository at this point in the history
  • Loading branch information
yury-s authored Jul 14, 2023
1 parent 35e3c36 commit f6bc9a8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class SerializedValue{
String v;
String d;
String u;
String bi;
public static class R {
String p;
String f;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
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;
Expand Down Expand Up @@ -162,6 +163,8 @@ private SerializedValue serializeValue(Object value) {
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();
Expand Down Expand Up @@ -236,6 +239,9 @@ private static <T> T deserialize(SerializedValue value, Map<Integer, Object> idT
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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
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;
Expand Down Expand Up @@ -115,6 +116,12 @@ void shouldTransferArraysAsArraysNotObjects() {
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.
Expand Down
2 changes: 1 addition & 1 deletion scripts/CLI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.36.0-beta-1689010164000
1.36.1

0 comments on commit f6bc9a8

Please sign in to comment.