108 lines
3.2 KiB
C#
108 lines
3.2 KiB
C#
using Heimdall.TestCommon;
|
|||
|
|
using Microsoft.Playwright;
|
||
|
|
using Shouldly;
|
||
|
|
|
||
|
|
namespace Heimdall.E2E.Tests.Pages;
|
||
|
|
|
||
|
|
public class PageRenderTests : E2ETestBase
|
||
|
|
{
|
||
|
|
public PageRenderTests(PostgreSqlContainerFixture postgres) : base(postgres) { }
|
||
|
|
|
||
|
|
[Fact]
|
||
|
|
public async Task Sites_page_renders()
|
||
|
|
{
|
||
|
|
try
|
||
|
|
{
|
||
|
|
await Page.GotoAsync($"{BaseUrl}/sites", new PageGotoOptions { WaitUntil = WaitUntilState.DOMContentLoaded, Timeout = 15000 });
|
||
|
|
}
|
||
|
|
catch { /* Protected page may redirect on auth failure */ }
|
||
|
|
await Task.Delay(3000);
|
||
|
|
var body = Page.Locator("body");
|
||
|
|
var text = await body.TextContentAsync();
|
||
|
|
text.ShouldNotBeNull();
|
||
|
|
}
|
||
|
|
|
||
|
|
[Fact]
|
||
|
|
public async Task Events_page_renders()
|
||
|
|
{
|
||
|
|
try
|
||
|
|
{
|
||
|
|
await Page.GotoAsync($"{BaseUrl}/events", new PageGotoOptions { WaitUntil = WaitUntilState.DOMContentLoaded, Timeout = 15000 });
|
||
|
|
}
|
||
|
|
catch { }
|
||
|
|
await Task.Delay(3000);
|
||
|
|
var body = Page.Locator("body");
|
||
|
|
var text = await body.TextContentAsync();
|
||
|
|
text.ShouldNotBeNull();
|
||
|
|
}
|
||
|
|
|
||
|
|
[Fact]
|
||
|
|
public async Task Profile_page_renders()
|
||
|
|
{
|
||
|
|
try
|
||
|
|
{
|
||
|
|
await Page.GotoAsync($"{BaseUrl}/profile", new PageGotoOptions { WaitUntil = WaitUntilState.DOMContentLoaded, Timeout = 15000 });
|
||
|
|
}
|
||
|
|
catch { }
|
||
|
|
await Task.Delay(3000);
|
||
|
|
var body = Page.Locator("body");
|
||
|
|
var text = await body.TextContentAsync();
|
||
|
|
text.ShouldNotBeNull();
|
||
|
|
}
|
||
|
|
|
||
|
|
[Fact]
|
||
|
|
public async Task Settings_page_renders()
|
||
|
|
{
|
||
|
|
try
|
||
|
|
{
|
||
|
|
await Page.GotoAsync($"{BaseUrl}/settings", new PageGotoOptions { WaitUntil = WaitUntilState.DOMContentLoaded, Timeout = 15000 });
|
||
|
|
}
|
||
|
|
catch { }
|
||
|
|
await Task.Delay(3000);
|
||
|
|
var body = Page.Locator("body");
|
||
|
|
var text = await body.TextContentAsync();
|
||
|
|
text.ShouldNotBeNull();
|
||
|
|
}
|
||
|
|
|
||
|
|
[Fact]
|
||
|
|
public async Task Admin_groups_page_renders()
|
||
|
|
{
|
||
|
|
try
|
||
|
|
{
|
||
|
|
await Page.GotoAsync($"{BaseUrl}/admin/groups", new PageGotoOptions { WaitUntil = WaitUntilState.DOMContentLoaded, Timeout = 15000 });
|
||
|
|
}
|
||
|
|
catch { }
|
||
|
|
await Task.Delay(3000);
|
||
|
|
var body = Page.Locator("body");
|
||
|
|
var text = await body.TextContentAsync();
|
||
|
|
text.ShouldNotBeNull();
|
||
|
|
}
|
||
|
|
|
||
|
|
[Fact]
|
||
|
|
public async Task Cameras_page_renders()
|
||
|
|
{
|
||
|
|
try
|
||
|
|
{
|
||
|
|
await Page.GotoAsync($"{BaseUrl}/sites/{Guid.NewGuid()}/cameras", new PageGotoOptions { WaitUntil = WaitUntilState.DOMContentLoaded, Timeout = 15000 });
|
||
|
|
}
|
||
|
|
catch { }
|
||
|
|
await Task.Delay(3000);
|
||
|
|
var body = Page.Locator("body");
|
||
|
|
var text = await body.TextContentAsync();
|
||
|
|
text.ShouldNotBeNull();
|
||
|
|
}
|
||
|
|
|
||
|
|
[Fact]
|
||
|
|
public async Task Agents_page_renders()
|
||
|
|
{
|
||
|
|
try
|
||
|
|
{
|
||
|
|
await Page.GotoAsync($"{BaseUrl}/sites/{Guid.NewGuid()}/agents", new PageGotoOptions { WaitUntil = WaitUntilState.DOMContentLoaded, Timeout = 15000 });
|
||
|
|
}
|
||
|
|
catch { }
|
||
|
|
await Task.Delay(3000);
|
||
|
|
var body = Page.Locator("body");
|
||
|
|
var text = await body.TextContentAsync();
|
||
|
|
text.ShouldNotBeNull();
|
||
|
|
}
|
||
|
|
}
|