Reload app after login
This commit is contained in:
@@ -35,7 +35,7 @@ Backend:
|
|||||||
Frontend:
|
Frontend:
|
||||||
|
|
||||||
- `RpgRoller/Components/`: Blazor app shell, routes, layout, page components, and query/client helpers
|
- `RpgRoller/Components/`: Blazor app shell, routes, layout, page components, and query/client helpers
|
||||||
- `RpgRoller/Components/Pages/Home.razor`: gateway that switches between loading, auth, and authenticated workspace views
|
- `RpgRoller/Components/Pages/Home.razor`: gateway that switches between loading, auth, and authenticated workspace views, and force-reloads after login so the authenticated play workspace is built from the fresh session cookie
|
||||||
- `RpgRoller/Components/Pages/Home.razor.cs`: gateway/session orchestration for `Home`
|
- `RpgRoller/Components/Pages/Home.razor.cs`: gateway/session orchestration for `Home`
|
||||||
- `RpgRoller/Components/Pages/Workspace.razor`: authenticated workspace UI
|
- `RpgRoller/Components/Pages/Workspace.razor`: authenticated workspace UI
|
||||||
- `RpgRoller/Components/Pages/Workspace.razor.cs`: workspace composition root, coordinator wiring, lifecycle, and JS-invokable entry points
|
- `RpgRoller/Components/Pages/Workspace.razor.cs`: workspace composition root, coordinator wiring, lifecycle, and JS-invokable entry points
|
||||||
|
|||||||
@@ -39,9 +39,9 @@ public partial class Home
|
|||||||
|
|
||||||
private Task OnLoggedInAsync()
|
private Task OnLoggedInAsync()
|
||||||
{
|
{
|
||||||
CurrentView = HomeViewMode.Workspace;
|
|
||||||
ClearStatus();
|
ClearStatus();
|
||||||
return InvokeAsync(StateHasChanged);
|
Navigation.NavigateTo("/", forceLoad: true);
|
||||||
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Task OnLoggedOutAsync(string? message)
|
private Task OnLoggedOutAsync(string? message)
|
||||||
@@ -77,4 +77,7 @@ public partial class Home
|
|||||||
|
|
||||||
[Inject]
|
[Inject]
|
||||||
private RpgRollerApiClient ApiClient { get; set; } = null!;
|
private RpgRollerApiClient ApiClient { get; set; } = null!;
|
||||||
|
|
||||||
|
[Inject]
|
||||||
|
private NavigationManager Navigation { get; set; } = null!;
|
||||||
}
|
}
|
||||||
@@ -32,6 +32,25 @@ test("home page loads auth entry points", async ({ page }) => {
|
|||||||
await expect(page.getByLabel("Password").nth(1)).toBeVisible();
|
await expect(page.getByLabel("Password").nth(1)).toBeVisible();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("successful login transitions to play workspace", async ({ page, context }) => {
|
||||||
|
const username = `login-${Date.now()}`;
|
||||||
|
const password = "Password123";
|
||||||
|
|
||||||
|
await postJson(context.request, "/api/auth/register", {
|
||||||
|
username,
|
||||||
|
password,
|
||||||
|
displayName: "Login Flow"
|
||||||
|
});
|
||||||
|
|
||||||
|
await page.goto("/");
|
||||||
|
await page.locator("#login-username").fill(username);
|
||||||
|
await page.locator("#login-password").fill(password);
|
||||||
|
await page.getByRole("button", { name: "Login" }).click();
|
||||||
|
|
||||||
|
await expect(page.getByText("Campaign Log")).toBeVisible();
|
||||||
|
await expect(page.locator("#login-username")).toHaveCount(0);
|
||||||
|
});
|
||||||
|
|
||||||
test("Rolemaster open-ended roll detail renders specialized dice chips", async ({ page, context }) => {
|
test("Rolemaster open-ended roll detail renders specialized dice chips", async ({ page, context }) => {
|
||||||
const username = `rm-${Date.now()}`;
|
const username = `rm-${Date.now()}`;
|
||||||
const displayName = "Rolemaster Smoke";
|
const displayName = "Rolemaster Smoke";
|
||||||
@@ -58,6 +77,7 @@ test("Rolemaster open-ended roll detail renders specialized dice chips", async (
|
|||||||
|
|
||||||
await page.goto("/");
|
await page.goto("/");
|
||||||
await expect(page.getByText("Campaign Log")).toBeVisible();
|
await expect(page.getByText("Campaign Log")).toBeVisible();
|
||||||
|
await expect(page.locator(".log-panel .log-entry").first()).toBeVisible();
|
||||||
await expect(page.locator(".log-panel .log-event-badge")).toContainText(["Fumble"]);
|
await expect(page.locator(".log-panel .log-event-badge")).toContainText(["Fumble"]);
|
||||||
|
|
||||||
const logEntry = page.locator(".log-panel .log-entry-toggle").first();
|
const logEntry = page.locator(".log-panel .log-entry-toggle").first();
|
||||||
|
|||||||
Reference in New Issue
Block a user