Skip to content

Commit

Permalink
update versions
Browse files Browse the repository at this point in the history
  • Loading branch information
LuckShiba committed Sep 23, 2024
1 parent b1f755e commit 6ac5fa5
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public override Task OnPageCreated(IPage page)
.GetField("_contextResolveTaskWrapper", BindingFlags.NonPublic | BindingFlags.Instance);
if (contextField is not null)
{
var context = (TaskCompletionSource<ExecutionContext>) contextField.GetValue(mainWord);
var context = (TaskCompletionSource<PuppeteerSharp.ExecutionContext>) contextField.GetValue(mainWord);
var execution = await context.Task;
var suffixField = execution.GetType()
.GetField("_evaluationScriptSuffix", BindingFlags.NonPublic | BindingFlags.Instance);
Expand Down
4 changes: 2 additions & 2 deletions PuppeteerExtraSharp/PuppeteerExtraSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="PuppeteerSharp" Version="17.0.0" />
<PackageReference Include="RestSharp" Version="110.2.0" />
<PackageReference Include="PuppeteerSharp" Version="20.0.2" />
<PackageReference Include="RestSharp" Version="112.0.0" />
</ItemGroup>

</Project>
14 changes: 7 additions & 7 deletions Tests/Extra.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>
Expand All @@ -18,15 +18,15 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="MartinCostello.Logging.XUnit" Version="0.3.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PackageReference Include="MartinCostello.Logging.XUnit" Version="0.4.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="xunit" Version="2.9.1" />
<PackageReference Include="coverlet.collector" Version="6.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.2.0">
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
4 changes: 2 additions & 2 deletions Tests/ExtraLaunchTest.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
using System;
using System.Net;
using PuppeteerExtraSharp.Plugins.Recaptcha.Provider.AntiCaptcha;
using System.Threading.Tasks;
using Xunit;

namespace Extra.Tests
{
public class ExtraLaunchTest: BrowserDefault
{
[Fact]
public async void ShouldReturnOkPage()
public async Task ShouldReturnOkPage()
{
var browser = await this.LaunchAsync();
var page = await browser.NewPageAsync();
Expand Down
4 changes: 2 additions & 2 deletions Tests/Recaptcha/AntiCaptcha/AntiCaptchaTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public AntiCaptchaTests(ITestOutputHelper _logger)
}

[Fact]
public async void ShouldThrowCaptchaExceptionWhenCaptchaNotFound()
public async Task ShouldThrowCaptchaExceptionWhenCaptchaNotFound()
{
var plugin = new RecaptchaPlugin(new PuppeteerExtraSharp.Plugins.Recaptcha.Provider.AntiCaptcha.AntiCaptcha(Resources.AntiCaptchaKey));

Expand Down Expand Up @@ -52,7 +52,7 @@ public async Task ShouldSolveCaptchaWithSubmitButton()
}

[Fact]
public async void ShouldSolveCaptchaWithCallback()
public async Task ShouldSolveCaptchaWithCallback()
{
var plugin = new RecaptchaPlugin(new PuppeteerExtraSharp.Plugins.Recaptcha.Provider.AntiCaptcha.AntiCaptcha(Resources.AntiCaptchaKey));
var browser = await LaunchWithPluginAsync(plugin);
Expand Down
16 changes: 10 additions & 6 deletions Tests/StealthPluginTests/EvasionsTests/ChromeSciTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,17 @@ public async Task ShouldWork()
}
}
}");

Assert.NotNull(sci);

Assert.True(sci["csi"].Value<bool>("exists"));
Assert.Equal("function () { [native code] }", sci["csi"]["toString"]);
Assert.True(sci["dataOK"].Value<bool>("onloadT"));
Assert.True(sci["dataOK"].Value<bool>("pageT"));
Assert.True(sci["dataOK"].Value<bool>("startE"));
Assert.True(sci["dataOK"].Value<bool>("tran"));
var obj = sci.Value;
var dataOk = obj.GetProperty("dataOK");

Assert.True(obj.GetProperty("csi").GetProperty("exists").GetBoolean());
Assert.True(dataOk.GetProperty("onloadT").GetBoolean());
Assert.True(dataOk.GetProperty("pageT").GetBoolean());
Assert.True(dataOk.GetProperty("startE").GetBoolean());
Assert.True(dataOk.GetProperty("tran").GetBoolean());
}
}
}
34 changes: 21 additions & 13 deletions Tests/StealthPluginTests/EvasionsTests/ContentWindowTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ await page.EvaluateFunctionAsync(@"(testFuncReturnValue) => {
await page.EvaluateExpressionAsync(
"document.querySelector('iframe').contentWindow.mySuperFunction()");

Assert.Equal(testFuncReturnValue, result);
Assert.NotNull(result);
Assert.Equal(testFuncReturnValue, result.Value.GetString());
}

[Fact]
Expand Down Expand Up @@ -83,10 +84,15 @@ public async Task ShouldCoverAllFrames()
return typeof(el.contentWindow.chrome)
}");

Assert.Equal("object", basicFrame);
Assert.Equal("object", sandboxSOIFrame);
Assert.Equal("object", sandboxSOASIFrame);
Assert.Equal("object", srcdocIFrame);
Assert.NotNull(basicFrame);
Assert.NotNull(sandboxSOIFrame);
Assert.NotNull(sandboxSOASIFrame);
Assert.NotNull(srcdocIFrame);

Assert.Equal("object", basicFrame.Value.GetString());
Assert.Equal("object", sandboxSOIFrame.Value.GetString());
Assert.Equal("object", sandboxSOASIFrame.Value.GetString());
Assert.Equal("object", srcdocIFrame.Value.GetString());
}


Expand Down Expand Up @@ -169,15 +175,17 @@ public async Task ShouldEmulateFeatures()
}");


Assert.True(results.Value<bool>("descriptorsOK"));
Assert.True(results.Value<bool>("doesExist"));
Assert.True(results.Value<bool>("isNotAClone"));
Assert.True(results.Value<bool>("hasSameNumberOfPlugins"));
Assert.True(results.Value<bool>("SelfIsNotWindow"));
Assert.True(results.Value<bool>("SelfIsNotWindowTop"));
Assert.True(results.Value<bool>("TopIsNotSame"));
Assert.NotNull(results);

Assert.True(results.Value.GetProperty("descriptorsOK").GetBoolean());
Assert.True(results.Value.GetProperty("doesExist").GetBoolean());
Assert.True(results.Value.GetProperty("isNotAClone").GetBoolean());
Assert.True(results.Value.GetProperty("hasSameNumberOfPlugins").GetBoolean());
Assert.True(results.Value.GetProperty("SelfIsNotWindow").GetBoolean());
Assert.True(results.Value.GetProperty("SelfIsNotWindowTop").GetBoolean());
Assert.True(results.Value.GetProperty("TopIsNotSame").GetBoolean());

Assert.DoesNotContain("at Object.apply", results["StackTraces"]);
Assert.DoesNotContain("at Object.apply", results.Value.GetProperty("StackTraces").GetString());
}
}
}

0 comments on commit 6ac5fa5

Please sign in to comment.