diff --git a/lib/PuppeteerSharp.Tests/ExecutionContextTests/QueryObjectsTests.cs b/lib/PuppeteerSharp.Tests/ExecutionContextTests/QueryObjectsTests.cs index 49ae7cb3f..f172d743b 100644 --- a/lib/PuppeteerSharp.Tests/ExecutionContextTests/QueryObjectsTests.cs +++ b/lib/PuppeteerSharp.Tests/ExecutionContextTests/QueryObjectsTests.cs @@ -24,6 +24,7 @@ public async Task ShouldWork() Assert.Equal(new[] { "hello", "world" }, values); } + [Fact] public async Task ShouldWorkForNonBlankPage() { // Instantiate an object diff --git a/lib/PuppeteerSharp.Tests/PageTests/Cookies/CookiesTests.cs b/lib/PuppeteerSharp.Tests/PageTests/Cookies/CookiesTests.cs index 3cec55373..f4ba7961a 100644 --- a/lib/PuppeteerSharp.Tests/PageTests/Cookies/CookiesTests.cs +++ b/lib/PuppeteerSharp.Tests/PageTests/Cookies/CookiesTests.cs @@ -39,6 +39,48 @@ public async Task ShouldGetACookie() Assert.True(cookie.Session); } + [Fact] + public async Task ShouldProperlyReportHttpOnlyCookie() + { + Server.SetRoute("/empty.html", context => + { + context.Response.Headers["Set-Cookie"] = ";HttpOnly; Path=/"; + return Task.CompletedTask; + }); + await Page.GoToAsync(TestConstants.EmptyPage); + var cookies = await Page.GetCookiesAsync(); + Assert.Single(cookies); + Assert.True(cookies[0].HttpOnly); + } + + [Fact] + public async Task ShouldProperlyReportSStrictSameSiteCookie() + { + Server.SetRoute("/empty.html", context => + { + context.Response.Headers["Set-Cookie"] = ";SameSite=Strict"; + return Task.CompletedTask; + }); + await Page.GoToAsync(TestConstants.EmptyPage); + var cookies = await Page.GetCookiesAsync(); + Assert.Single(cookies); + Assert.Equal(SameSite.Strict, cookies[0].SameSite); + } + + [Fact] + public async Task ShouldProperlyReportLaxSameSiteCookie() + { + Server.SetRoute("/empty.html", context => + { + context.Response.Headers["Set-Cookie"] = ";SameSite=Lax"; + return Task.CompletedTask; + }); + await Page.GoToAsync(TestConstants.EmptyPage); + var cookies = await Page.GetCookiesAsync(); + Assert.Single(cookies); + Assert.Equal(SameSite.Lax, cookies[0].SameSite); + } + [Fact] public async Task ShouldGetMultipleCookies() {