Shows a connection-lost indicator when the SignalR connection closes.

This commit is contained in:
BinaryAlley committed 2026-11-07 17:03:55 +02:00
1 parent 0abf8d4aea
commit e2c705d822
44 files changed
+1254 -78

No files matched your search

@@ -5,6 +5,7 @@ using Lumina.Presentation.Web.Fixtures.Common.DTO.Authorization;
using Lumina.Presentation.Web.Fixtures.Common.Responses.Authorization;
using Lumina.Presentation.Web.Fixtures.Common.TestHelpers;
using Lumina.Presentation.Web.IntegrationTests.Common.Setup;
using Polly.CircuitBreaker;
using System;
using System.Diagnostics.CodeAnalysis;
using System.Net;
@@ -70,4 +71,28 @@ public class ManageRolesViewEndpointTests : IClassFixture<LuminaWebFactory>
Assert.Equal(HttpStatusCode.Redirect, response.StatusCode);
Assert.Contains("access-denied", response.Headers.Location!.ToString());
}
[Fact]
public async Task ManageRoles_WhenTheApiIsUnreachableDuringAuthorization_ShouldRenderThePage()
{
// Arrange
// The policy handler runs under real endpoint routing, where the authorization resource is the endpoint, not the HttpContext.
_apiFactory.ApiClientStub.Reset();
_apiFactory.ApiClientStub.AuthorizationException = new BrokenCircuitException();
RoleDto[] expectedRoles = [.. _roleDtoFixture.CreateMany()];
PermissionDto[] expectedPermissions = [.. _permissionDtoFixture.CreateMany()];
_apiFactory.ApiClientStub.RegisterGetResponse("auth/roles", expectedRoles);
_apiFactory.ApiClientStub.RegisterGetResponse("auth/permissions", expectedPermissions);
AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory);
// Act
HttpResponseMessage response = await webClient.Client.GetAsync("/en-us/admin/manage-roles");
// Assert
response.EnsureSuccessStatusCode();
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
Assert.Equal("text/html", response.Content.Headers.ContentType!.MediaType);
string content = await response.Content.ReadAsStringAsync();
Assert.Contains("data-server-unreachable-banner", content);
}
}
@@ -41,6 +41,7 @@ public class HomeErrorEndpointTests : IClassFixture<LuminaWebFactory>
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
Assert.Equal("text/html", response.Content.Headers.ContentType!.MediaType);
string content = await response.Content.ReadAsStringAsync();
Assert.Contains("text-danger", content);
Assert.Contains("Navigation failed!", content);
Assert.Contains("data-server-unreachable-banner", content);
}
}