-
-
Notifications
You must be signed in to change notification settings - Fork 443
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move some chromium specific tests (#1019)
- Loading branch information
Showing
3 changed files
with
41 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
lib/PuppeteerSharp.Tests/ChromiumSpecificTests/PageTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using System.Threading.Tasks; | ||
using Microsoft.AspNetCore.Http; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
|
||
namespace PuppeteerSharp.Tests.ChromiumSpecificTests | ||
{ | ||
[Collection("PuppeteerLoaderFixture collection")] | ||
public class PageTests : PuppeteerPageBaseTest | ||
{ | ||
public PageTests(ITestOutputHelper output) : base(output) | ||
{ | ||
} | ||
|
||
[Fact] | ||
public async Task ShouldWorkWithInterventionHeaders() | ||
{ | ||
Server.SetRoute("/intervention", context => context.Response.WriteAsync($@" | ||
<script> | ||
document.write('<script src=""{TestConstants.CrossProcessHttpPrefix}/intervention.js"">' + '</scr' + 'ipt>'); | ||
</script> | ||
")); | ||
Server.SetRedirect("/intervention.js", "/redirect.js"); | ||
|
||
string interventionHeader = null; | ||
Server.SetRoute("/redirect.js", context => | ||
{ | ||
interventionHeader = context.Request.Headers["intervention"]; | ||
return context.Response.WriteAsync("console.log(1);"); | ||
}); | ||
|
||
await Page.SetRequestInterceptionAsync(true); | ||
Page.Request += async (sender, e) => await e.Request.ContinueAsync(); | ||
|
||
await Page.GoToAsync(TestConstants.ServerUrl + "/intervention"); | ||
|
||
Assert.Contains("www.chromestatus.com", interventionHeader); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters