2024-04-08 23:34:32 -05:00
|
|
|
using Microsoft.AspNetCore.Hosting.Server.Features;
|
|
|
|
|
using Microsoft.AspNetCore.Http.Features;
|
|
|
|
|
|
|
|
|
|
namespace Blog.Tests.EndToEnd;
|
|
|
|
|
|
|
|
|
|
[TestFixture]
|
|
|
|
|
public class BlogTest : PageTest
|
|
|
|
|
{
|
|
|
|
|
private readonly BlogHostFactory<Program> _factory = new();
|
|
|
|
|
|
|
|
|
|
public override BrowserNewContextOptions ContextOptions()
|
|
|
|
|
{
|
|
|
|
|
var options = base.ContextOptions();
|
|
|
|
|
options.BaseURL = _factory.ServerAddress;
|
|
|
|
|
return options;
|
|
|
|
|
}
|
2024-04-10 01:28:38 -05:00
|
|
|
|
|
|
|
|
[SetUp]
|
|
|
|
|
public async Task Setup()
|
|
|
|
|
{
|
|
|
|
|
await Context.Tracing.StartAsync(new()
|
|
|
|
|
{
|
|
|
|
|
Title = TestContext.CurrentContext.Test.ClassName + "." + TestContext.CurrentContext.Test.Name,
|
|
|
|
|
Screenshots = true,
|
|
|
|
|
Snapshots = true,
|
|
|
|
|
Sources = true
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TearDown]
|
|
|
|
|
public async Task TearDown()
|
|
|
|
|
{
|
|
|
|
|
await Context.Tracing.StopAsync(new()
|
|
|
|
|
{
|
|
|
|
|
Path = Path.Combine(
|
|
|
|
|
TestContext.CurrentContext.WorkDirectory,
|
|
|
|
|
"playwright-traces",
|
|
|
|
|
$"{TestContext.CurrentContext.Test.ClassName}.{TestContext.CurrentContext.Test.Name}.zip"
|
|
|
|
|
)
|
|
|
|
|
});
|
|
|
|
|
}
|
2024-04-08 23:34:32 -05:00
|
|
|
}
|