Skip to content

Commit

Permalink
[BREAKING] Split CdpSession (#2571)
Browse files Browse the repository at this point in the history
* Split CdpSession

* Docs changes

* Ignore new tests in firefox

* doc update

* Docs changes

---------

Co-authored-by: GitHub Action <action@github.com>
  • Loading branch information
kblok and actions-user authored Mar 28, 2024
1 parent 43f13e3 commit dd4e9b9
Show file tree
Hide file tree
Showing 237 changed files with 437 additions and 428 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@
"parameters": ["firefox", "headful"],
"expectations": ["FAIL"]
},
{
"comment": "",
"testIdPattern": "[puppeteer-sharp] *",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["firefox"],
"expectations": ["FAIL"]
},
{
"comment": "This is part of organizing the webdriver bidi implementation, We will remove it one by one",
"testIdPattern": "[accessibility.spec] *",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
using NUnit.Framework;
using PuppeteerSharp.Messaging;
using PuppeteerSharp.Cdp.Messaging;
using PuppeteerSharp.Nunit;

namespace PuppeteerSharp.Tests.CDPSessionTests
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Threading.Tasks;
using NUnit.Framework;
using PuppeteerSharp.Messaging;
using PuppeteerSharp.Cdp.Messaging;
using PuppeteerSharp.Nunit;

namespace PuppeteerSharp.Tests.DeviceRequestPromptTests;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using NUnit.Framework;
using PuppeteerSharp.Messaging;
using PuppeteerSharp.Cdp.Messaging;
using PuppeteerSharp.Nunit;

namespace PuppeteerSharp.Tests.DeviceRequestPromptTests;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Threading.Tasks;
using NUnit.Framework;
using PuppeteerSharp.Messaging;
using PuppeteerSharp.Cdp.Messaging;
using PuppeteerSharp.Nunit;

namespace PuppeteerSharp.Tests.DeviceRequestPromptTests;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Threading.Tasks;
using NUnit.Framework;
using PuppeteerSharp.Messaging;
using PuppeteerSharp.Cdp.Messaging;
using PuppeteerSharp.Nunit;

namespace PuppeteerSharp.Tests.DeviceRequestPromptTests;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json.Linq;
using PuppeteerSharp.Messaging;
using PuppeteerSharp.Cdp.Messaging;

namespace PuppeteerSharp.Tests.DeviceRequestPromptTests;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
using NUnit.Framework;
using PuppeteerSharp.Messaging;
using PuppeteerSharp.Cdp.Messaging;
using PuppeteerSharp.Nunit;

namespace PuppeteerSharp.Tests.DeviceRequestPromptTests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.Threading.Tasks;
using NUnit.Framework;
using PuppeteerSharp.Helpers;
using PuppeteerSharp.Messaging;
using PuppeteerSharp.Nunit;

namespace PuppeteerSharp.Tests.ExtensionsTests
Expand Down
1 change: 0 additions & 1 deletion lib/PuppeteerSharp.Tests/HeadfulTests/HeadfulTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.Threading.Tasks;
using NUnit.Framework;
using PuppeteerSharp.Helpers;
using PuppeteerSharp.Messaging;
using PuppeteerSharp.Nunit;

namespace PuppeteerSharp.Tests.HeadfulTests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
using NSubstitute;
using NUnit.Framework;
using PuppeteerSharp.Cdp;
using PuppeteerSharp.Messaging;
using PuppeteerSharp.Cdp.Messaging;
using PuppeteerSharp.Nunit;

namespace PuppeteerSharp.Tests.NetworkManagerTests;
Expand Down
2 changes: 1 addition & 1 deletion lib/PuppeteerSharp.Tests/OOPIFTests/OOPIFTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
using System.Linq;
using System.Threading.Tasks;
using NUnit.Framework;
using PuppeteerSharp.Cdp.Messaging;
using PuppeteerSharp.Helpers;
using PuppeteerSharp.Messaging;
using PuppeteerSharp.Nunit;

namespace PuppeteerSharp.Tests.OOPIFTests
Expand Down
8 changes: 6 additions & 2 deletions lib/PuppeteerSharp.Tests/PageTests/ExposeFunctionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
using NUnit.Framework;
using PuppeteerSharp.Cdp;
using PuppeteerSharp.Nunit;

namespace PuppeteerSharp.Tests.PageTests
Expand Down Expand Up @@ -124,6 +125,7 @@ public async Task ShouldWorkWithComplexObjects()
Assert.AreEqual(7, result.SelectToken("x").ToObject<int>());
}

[Test, Retry(2), PuppeteerTest("puppeteer-sharp", "ExposeFunctionTests", "should await returned task")]
public async Task ShouldAwaitReturnedTask()
{
var called = false;
Expand All @@ -136,6 +138,7 @@ await Page.ExposeFunctionAsync("changeFlag", () =>
Assert.True(called);
}

[Test, Retry(2), PuppeteerTest("puppeteer-sharp", "ExposeFunctionTests", "should work with action")]
public async Task ShouldWorkWithAction()
{
var called = false;
Expand All @@ -147,6 +150,7 @@ await Page.ExposeFunctionAsync("changeFlag", () =>
Assert.True(called);
}

[Test, Retry(2), PuppeteerTest("puppeteer-sharp", "ExposeFunctionTests", "should keel the callback clean")]
public async Task ShouldKeepTheCallbackClean()
{
await Page.ExposeFunctionAsync("compute", (int a, int b) => a * b);
Expand All @@ -156,7 +160,7 @@ public async Task ShouldKeepTheCallbackClean()
await Task.Delay(300);

// For CI/CD debugging purposes
var session = (CDPSession)Page.Client;
var session = (CdpCDPSession)Page.Client;
var message = "Expected an empty callback list. Found: \n";

if (session.HasPendingCallbacks())
Expand All @@ -167,7 +171,7 @@ public async Task ShouldKeepTheCallbackClean()
}
}

Assert.False(((CDPSession)Page.Client).HasPendingCallbacks(), message);
Assert.False(((CdpCDPSession)Page.Client).HasPendingCallbacks(), message);
}
}
}
3 changes: 2 additions & 1 deletion lib/PuppeteerSharp/Binding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Reflection;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using PuppeteerSharp.Cdp.Messaging;

namespace PuppeteerSharp
{
Expand Down Expand Up @@ -52,7 +53,7 @@ internal async Task RunAsync(
{
switch (handle.RemoteObject.Subtype)
{
case Messaging.RemoteObjectSubtype.Node:
case RemoteObjectSubtype.Node:
args[index] = handle;
break;

Expand Down
2 changes: 1 addition & 1 deletion lib/PuppeteerSharp/BindingUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PuppeteerSharp.Cdp.Messaging;
using PuppeteerSharp.Helpers.Json;
using PuppeteerSharp.Messaging;

namespace PuppeteerSharp
{
Expand Down
2 changes: 1 addition & 1 deletion lib/PuppeteerSharp/Browser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using PuppeteerSharp.Cdp;
using PuppeteerSharp.Cdp.Messaging;
using PuppeteerSharp.Helpers;
using PuppeteerSharp.Messaging;

namespace PuppeteerSharp
{
Expand Down
2 changes: 1 addition & 1 deletion lib/PuppeteerSharp/BrowserContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using PuppeteerSharp.Messaging;
using PuppeteerSharp.Cdp.Messaging;

namespace PuppeteerSharp
{
Expand Down
1 change: 0 additions & 1 deletion lib/PuppeteerSharp/BrowserContextOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using Microsoft.Extensions.Logging;
using PuppeteerSharp.Helpers;
using PuppeteerSharp.Helpers.Json;
using PuppeteerSharp.Messaging;
using PuppeteerSharp.QueryHandlers;

namespace PuppeteerSharp
Expand Down
Loading

0 comments on commit dd4e9b9

Please sign in to comment.