diff --git a/backend/LexBoxApi/Controllers/TestingController.cs b/backend/LexBoxApi/Controllers/TestingController.cs index 07ab00311..98c7cc8f0 100644 --- a/backend/LexBoxApi/Controllers/TestingController.cs +++ b/backend/LexBoxApi/Controllers/TestingController.cs @@ -11,7 +11,6 @@ namespace LexBoxApi.Controllers; -#if DEBUG [ApiController] [Route("/api/[controller]")] public class TestingController : ControllerBase @@ -32,8 +31,7 @@ public TestingController(LexAuthService lexAuthService, _redmineDbContext = redmineDbContext; } - - +#if DEBUG [AllowAnonymous] [HttpGet("makeJwt")] [ProducesResponseType(StatusCodes.Status200OK)] @@ -98,11 +96,16 @@ public record TestingControllerProject(Guid Id, string Name, string Code, List StatusCode(500); } -#endif diff --git a/backend/LexBoxApi/Program.cs b/backend/LexBoxApi/Program.cs index 3730b4309..939e40bb7 100644 --- a/backend/LexBoxApi/Program.cs +++ b/backend/LexBoxApi/Program.cs @@ -105,6 +105,7 @@ context.Response.Headers.Add("lexbox-version", AppVersionService.Version); await next(); }); +app.UseStatusCodePages(); if (!app.Environment.IsDevelopment()) app.UseExceptionHandler(); app.UseHealthChecks("/api/healthz"); diff --git a/backend/Testing/Browser/Page/SandboxPage.cs b/backend/Testing/Browser/Page/SandboxPage.cs new file mode 100644 index 000000000..049ffd859 --- /dev/null +++ b/backend/Testing/Browser/Page/SandboxPage.cs @@ -0,0 +1,10 @@ +using Microsoft.Playwright; + +namespace Testing.Browser.Page; + +public class SandboxPage : BasePage +{ + public SandboxPage(IPage page) : base(page, "/sandbox", page.Locator(":text('Sandbox')")) + { + } +} diff --git a/backend/Testing/Browser/SandboxPageTests.cs b/backend/Testing/Browser/SandboxPageTests.cs new file mode 100644 index 000000000..ddea034dd --- /dev/null +++ b/backend/Testing/Browser/SandboxPageTests.cs @@ -0,0 +1,22 @@ +using Shouldly; +using Testing.Browser.Base; +using Testing.Browser.Page; + +namespace Testing.Browser; + +public class SandboxPageTests : PageTest +{ + [Fact] + public async Task Goto500Works() + { + await new SandboxPage(Page).Goto(); + var request = await Page.RunAndWaitForRequestFinishedAsync(async () => + { + await Page.GetByText("goto 500 page").ClickAsync(); + }); + var response = await request.ResponseAsync(); + response.ShouldNotBeNull(); + response.Ok.ShouldBeFalse(); + response.Status.ShouldBe(500); + } +} diff --git a/frontend/src/routes/(authenticated)/sandbox/+page.svelte b/frontend/src/routes/(authenticated)/sandbox/+page.svelte deleted file mode 100644 index 8b5d64e40..000000000 --- a/frontend/src/routes/(authenticated)/sandbox/+page.svelte +++ /dev/null @@ -1,19 +0,0 @@ - - - -
-
- -
-
diff --git a/frontend/src/routes/(unauthenticated)/sandbox/+page.svelte b/frontend/src/routes/(unauthenticated)/sandbox/+page.svelte new file mode 100644 index 000000000..0b84a412a --- /dev/null +++ b/frontend/src/routes/(unauthenticated)/sandbox/+page.svelte @@ -0,0 +1,20 @@ + +
+

Sandbox

+ +
+
+ +
+
+
+