More tests and WIP vibe work
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using Microsoft.Playwright;
|
||||
using Microsoft.Playwright.NUnit;
|
||||
|
||||
namespace Tests;
|
||||
@@ -13,9 +14,31 @@ public abstract class AuthenticatedPageTest : PageTest
|
||||
[SetUp]
|
||||
public async Task SignIn()
|
||||
{
|
||||
var response = await Page.APIRequest.PostAsync($"{BaseUrl}/api/auth/dev-login");
|
||||
// Use a browser with a UI as requested
|
||||
await Context.Tracing.StartAsync(new()
|
||||
{
|
||||
Title = TestContext.CurrentContext.Test.ClassName + "." + TestContext.CurrentContext.Test.Name,
|
||||
Screenshots = true,
|
||||
Snapshots = true,
|
||||
Sources = true
|
||||
});
|
||||
|
||||
// Set a default timeout for all locators to help with Blazor latency
|
||||
Page.SetDefaultTimeout(15_000);
|
||||
|
||||
// Perform login via the context's APIRequest helper which shares cookies with the context
|
||||
var response = await Context.APIRequest.PostAsync($"{BaseUrl}/api/auth/dev-login");
|
||||
if (!response.Ok)
|
||||
throw new Exception(
|
||||
$"Dev login failed with status {response.Status}. Ensure the server is running in Development mode.");
|
||||
}
|
||||
|
||||
[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")
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user