Settings, which held only the theme, now belong to the persona too: - its profile (update_credentials, a new PATCH in IHttpService): pictures, name, biography and fields as written, locked, bot, discoverable, indexable, and how its posts start (visibility, language, sensitive media, who may quote them); the composer starts at that visibility; - the root's personas, each used in turn, and a new one made; - the accounts it muted or blocked and the servers it blocked, each undone there, a server blocked from a pasted address or handle; - its follows, lists, blocks, mutes, blocked servers and bookmarks exported and imported as the CSV files Mastodon writes (PortabilityService): an import resolves each row through PrivaPub, one at a time, and can stop. Administration opens to moderators: reports, resolved there; and for administrators the servers blocked for everyone and the federation statistics (traffic by server, delivery success and latency, the crawler). The Direct tab pages conversations, badges the unread ones, and a card marks one read or takes it off the list; opening one reads it. A remote thread is read again 4 and 15 seconds after it opens, since PrivaPub then fetches the replies its servers hold. A thread its community locked shows a lock instead of a reply button, reactions stay visible below a content warning, and a searched handle opens its account's profile whatever else matched. The e2e tests cover each: the profile saved and read back, a persona made, servers blocked and imported, follows exported, an instance block and the statistics as the pasture's admin, a conversation read and removed, and a reply only Mastodon held appearing in its thread. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LsXgEaXee4GCU1hwYgPJXw
59 lines
2.6 KiB
C#
59 lines
2.6 KiB
C#
using System.Text.Json.Nodes;
|
|
|
|
using decePubClient.E2E.Support;
|
|
|
|
using Microsoft.Playwright;
|
|
|
|
namespace decePubClient.E2E.Actions
|
|
{
|
|
// Direct conversations: a message from another persona badges the Direct tab and its card says unread; marking it
|
|
// read and taking it off the list are checked on PrivaPub
|
|
public sealed class ConversationTests(Browser browser)
|
|
{
|
|
[Fact]
|
|
public async Task A_new_message_is_unread_until_marked_and_leaves_the_list_when_removed()
|
|
{
|
|
var personas = Pasture.Personas();
|
|
Assert.SkipWhen(personas.Count < 2, "the town has fewer than two personas");
|
|
var (reader, writer) = (personas[0], personas[1]);
|
|
var message = (await PersonaApi.Call(writer, "/api/v1/statuses", HttpMethod.Post, new JsonObject
|
|
{
|
|
["status"] = $"@{reader.UserName} just between us {Guid.NewGuid():N}"[..40], ["visibility"] = "direct"
|
|
}))!;
|
|
var uri = message["uri"]!.GetValue<string>();
|
|
async Task<JsonNode> Conversation() => (await PersonaApi.Call(reader, "/api/v1/conversations?limit=40"))!.AsArray()
|
|
.FirstOrDefault(c => c!["last_status"]?["uri"]?.GetValue<string>() == uri);
|
|
await using var session = await SignIn.As(browser, reader);
|
|
var page = session.Page;
|
|
try
|
|
{
|
|
await Results.Cell("client.action.conversation", "privapub", reader.UserName, async () =>
|
|
{
|
|
Assert.True(await Pasture.Eventually(async () => (await Conversation())?["unread"]?.GetValue<bool>() == true, 15),
|
|
"the message never made an unread conversation");
|
|
await page.GotoAsync($"{Pasture.Site}/");
|
|
await page.EvaluateAsync("() => localStorage.removeItem('FeedFilter')");
|
|
await page.GotoAsync($"{Pasture.Site}/");
|
|
await page.Locator("[data-unread-conversations]").WaitForAsync(new() { Timeout = 30000 });
|
|
|
|
await page.GetByRole(AriaRole.Tab).Filter(new() { Has = page.Locator(".ion-md-mail") }).ClickAsync();
|
|
var card = page.Locator($"article[data-uri='{uri}']");
|
|
await card.Locator("[data-conversation-unread]").WaitForAsync(new() { Timeout = 30000 });
|
|
await card.Locator("[data-conversation-read]").ClickAsync();
|
|
await Assertions.Expect(card.Locator("[data-conversation-unread]")).ToHaveCountAsync(0, new() { Timeout = 10000 });
|
|
Assert.False((await Conversation())!["unread"]!.GetValue<bool>());
|
|
|
|
await card.Locator("[data-conversation-remove]").ClickAsync();
|
|
await Assertions.Expect(card).ToHaveCountAsync(0, new() { Timeout = 10000 });
|
|
Assert.Null(await Conversation());
|
|
await session.AssertGuards();
|
|
}, page);
|
|
}
|
|
finally
|
|
{
|
|
await PersonaApi.Call(writer, $"/api/v1/statuses/{message["id"]!.GetValue<string>()}", HttpMethod.Delete);
|
|
}
|
|
}
|
|
}
|
|
}
|