Pictures open in the app
A tap on a picture opened its file in a new tab, leaving the app (and, on a phone, its place in the feed). It now opens MediaViewer: the whole screen on a phone, a large dialog from md, the picture whole with its alt text under it, the post's other pictures by the previous and next buttons or the arrow keys, and "Open original" for whoever wants the file. Phone flow: a picture of a town post opens the viewer over the whole screen, which closes from its button. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LsXgEaXee4GCU1hwYgPJXw
This commit is contained in:
1 parent
7b1bfa71c0
commit
5522fe4fbb
5 files changed
+145
-2
No files matched your search
@@ -277,6 +277,39 @@ namespace decePubClient.E2E.Mobile
|
||||
});
|
||||
}
|
||||
|
||||
// a picture opens in the app, the whole screen, and closes
|
||||
[Fact]
|
||||
public async Task A_picture_opens_in_the_app()
|
||||
{
|
||||
var expected = (await Pasture.Town("expect")).AsArray();
|
||||
var personas = Pasture.Personas();
|
||||
var item = expected.FirstOrDefault(i => i!["alts"]!.AsArray().Count > 0
|
||||
&& i["readers"]!.AsArray().Any(r => personas.Any(p => p.UserName == (string)r)));
|
||||
Assert.SkipWhen(item is null, "the town holds no post with pictures");
|
||||
var reader = personas.First(p => item!["readers"]!.AsArray().Any(r => (string)r == p.UserName));
|
||||
await using var session = await SignIn.As(browser, reader, Phone);
|
||||
await Flow(session, "picture", async page =>
|
||||
{
|
||||
await page.GotoAsync($"{Pasture.Site}/expand/{item!["id"]}");
|
||||
var card = page.Locator($"article[data-uri='{item["uri"]}']").First;
|
||||
await card.WaitForAsync(new() { Timeout = 30000 });
|
||||
var hidden = card.GetByRole(AriaRole.Button).Filter(new() { HasText = "Sensitive media" });
|
||||
for (var i = 0; i < 8 && await hidden.CountAsync() > 0; i++)
|
||||
await hidden.First.TapAsync();
|
||||
await card.Locator("button[data-picture]").First.TapAsync();
|
||||
var viewer = page.Locator("[data-media-viewer].modal-open .modal-box");
|
||||
await Assertions.Expect(viewer).ToBeVisibleAsync();
|
||||
var box = (await viewer.BoundingBoxAsync())!;
|
||||
var size = page.ViewportSize!;
|
||||
Assert.True(box.Width >= size.Width - 2 && box.Height >= size.Height - 2, $"the picture viewer is {box.Width}x{box.Height}");
|
||||
await AssertWhole(page, "[data-media-viewer] .modal-box");
|
||||
if (await page.Locator("[data-picture-next]:enabled").CountAsync() > 0)
|
||||
await page.Locator("[data-picture-next]").TapAsync();
|
||||
await page.Locator("[data-media-viewer] [data-modal-close]").TapAsync();
|
||||
await Assertions.Expect(page.Locator("[data-media-viewer].modal-open")).ToHaveCountAsync(0);
|
||||
});
|
||||
}
|
||||
|
||||
static async Task<JsonNode> Latest(Pasture.Persona persona) =>
|
||||
(await PersonaApi.Call(persona, $"/api/v1/accounts/{persona.LocalId}/statuses?limit=1"))!.AsArray().FirstOrDefault();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user