Skip to content

Commit 094bf75

Browse files
committed
Bidi: Implement Accept insecure certs
1 parent bc0b290 commit 094bf75

3 files changed

Lines changed: 20 additions & 25 deletions

File tree

lib/PuppeteerSharp.Nunit/TestExpectations/TestExpectations.local.json

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -705,21 +705,6 @@
705705
"FAIL"
706706
]
707707
},
708-
{
709-
"comment": "This is part of organizing the webdriver bidi implementation, We will remove it one by one",
710-
"testIdPattern": "[acceptInsecureCerts.spec] *",
711-
"platforms": [
712-
"darwin",
713-
"linux",
714-
"win32"
715-
],
716-
"parameters": [
717-
"webDriverBiDi"
718-
],
719-
"expectations": [
720-
"FAIL"
721-
]
722-
},
723708
{
724709
"comment": "This is part of organizing the webdriver bidi implementation, We will remove it one by one",
725710
"testIdPattern": "[injected.spec] *",

lib/PuppeteerSharp.Tests/IgnoreHttpsErrorsTests/ResponseSecurityDetailsTests.cs

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,29 @@ public ResponseSecurityDetailsTests() : base()
1616
DefaultOptions.AcceptInsecureCerts = true;
1717
}
1818

19-
[Test, PuppeteerTest("acceptInsecureCerts.spec", "Response.securityDetails", "Should Work")]
19+
[Test, PuppeteerTest("acceptInsecureCerts.spec", "acceptInsecureCerts Response.securityDetails", "Should Work")]
2020
public async Task ShouldWork()
2121
{
22-
// Checking for the TLS socket is it is in upstreams proves to be flaky in .net framework.
22+
// Checking for the TLS socket is it is in upstreams proves to be flaky in .NET Framework.
2323
// We don't need to test that here.
2424

2525
var response = await Page.GoToAsync(TestConstants.HttpsPrefix + "/empty.html");
26-
Assert.That(response.Status, Is.EqualTo(HttpStatusCode.OK));
27-
Assert.That(response.SecurityDetails, Is.Not.Null);
26+
Assert.Multiple(() =>
27+
{
28+
Assert.That(response.Status, Is.EqualTo(HttpStatusCode.OK));
29+
Assert.That(response.SecurityDetails, Is.Not.Null);
30+
});
2831
Assert.That(response.SecurityDetails.Protocol, Does.Contain("TLS"));
2932
}
3033

31-
[Test, PuppeteerTest("acceptInsecureCerts.spec", "Response.securityDetails", "should be |null| for non-secure requests")]
34+
[Test, PuppeteerTest("acceptInsecureCerts.spec", "acceptInsecureCerts Response.securityDetails", "should be |null| for non-secure requests")]
3235
public async Task ShouldBeNullForNonSecureRequests()
3336
{
3437
var response = await Page.GoToAsync(TestConstants.EmptyPage);
3538
Assert.That(response.SecurityDetails, Is.Null);
3639
}
3740

38-
[Test, PuppeteerTest("acceptInsecureCerts.spec", "Response.securityDetails", "Network redirects should report SecurityDetails")]
41+
[Test, PuppeteerTest("acceptInsecureCerts.spec", "acceptInsecureCerts Response.securityDetails", "Network redirects should report SecurityDetails")]
3942
[Ignore("This is super flaky")]
4043
public async Task NetworkRedirectsShouldReportSecurityDetails()
4144
{
@@ -55,10 +58,13 @@ await Task.WhenAll(
5558

5659
var response = responseTask.Result;
5760

58-
Assert.That(responses, Has.Count.EqualTo(2));
59-
Assert.That(responses[0].Status, Is.EqualTo(HttpStatusCode.Found));
60-
Assert.That(TestUtils.CurateProtocol(response.SecurityDetails.Protocol),
61-
Is.EqualTo(TestUtils.CurateProtocol(requestTask.Result.ToString())));
61+
Assert.Multiple(() =>
62+
{
63+
Assert.That(responses, Has.Count.EqualTo(2));
64+
Assert.That(responses[0].Status, Is.EqualTo(HttpStatusCode.Found));
65+
Assert.That(TestUtils.CurateProtocol(response.SecurityDetails.Protocol),
66+
Is.EqualTo(TestUtils.CurateProtocol(requestTask.Result.ToString())));
67+
});
6268
}
6369
}
6470
}

lib/PuppeteerSharp/Bidi/BidiHttpResponse.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ private BidiHttpResponse(WebDriverBiDi.Network.ResponseData data, BidiHttpReques
3939
Status = (HttpStatusCode)data.Status;
4040
Url = data.Url;
4141
_fromCache = data.FromCache;
42+
43+
// TODO: Implement SecurityDetails support when webdriverbidi-net library supports extensibility
44+
// The upstream puppeteer implementation accesses a non-standard 'goog:securityDetails' property
45+
// which is not yet exposed in the webdriverbidi-net library
4246
}
4347

4448
// Internal constructor for synthetic responses (e.g., cached history navigation)

0 commit comments

Comments
 (0)