Skip to content

Commit f387770

Browse files
committed
Added BigIntLocalValue
1 parent a697edb commit f387770

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

dotnet/src/webdriver/BiDi/Modules/Script/LocalValue.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ namespace OpenQA.Selenium.BiDi.Modules.Script;
2828
[JsonDerivedType(typeof(NullLocalValue), "null")]
2929
[JsonDerivedType(typeof(UndefinedLocalValue), "undefined")]
3030
[JsonDerivedType(typeof(BooleanLocalValue), "boolean")]
31+
[JsonDerivedType(typeof(BigIntLocalValue), "bigint")]
3132
[JsonDerivedType(typeof(ChannelLocalValue), "channel")]
3233
[JsonDerivedType(typeof(ArrayLocalValue), "array")]
3334
[JsonDerivedType(typeof(DateLocalValue), "date")]
@@ -87,6 +88,8 @@ public record UndefinedLocalValue : PrimitiveProtocolLocalValue;
8788

8889
public record BooleanLocalValue(bool Value) : PrimitiveProtocolLocalValue;
8990

91+
public record BigIntLocalValue(string Value) : PrimitiveProtocolLocalValue;
92+
9093
public record ChannelLocalValue(ChannelLocalValue.ChannelProperties Value) : LocalValue
9194
{
9295
// TODO: Revise why we need it

dotnet/test/common/BiDi/Script/CallFunctionLocalValueTest.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,22 @@ await context.Script.CallFunctionAsync($$"""
7272
}, Throws.Nothing);
7373
}
7474

75+
[Test]
76+
public void CanCallFunctionWithArgumentBigInt()
77+
{
78+
var arg = new BigIntLocalValue("12345");
79+
Assert.That(async () =>
80+
{
81+
await context.Script.CallFunctionAsync($$"""
82+
(arg) => {
83+
if (arg !== 12345n) {
84+
throw new Error("Assert failed: " + arg);
85+
}
86+
}
87+
""", false, new() { Arguments = [arg] });
88+
}, Throws.Nothing);
89+
}
90+
7591
[Test]
7692
public void CanCallFunctionWithArgumentEmptyString()
7793
{

0 commit comments

Comments
 (0)