fix: Bug - Attachments gets syncronized corrupt

This commit is contained in:
2026-06-11 00:37:06 +02:00
parent d174536272
commit 5bf4f698df
7 changed files with 605 additions and 101 deletions

View File

@@ -132,6 +132,31 @@ export class ChatMessagesPage {
}).toBe(true);
}
/** SHA-256 of the bytes currently served by the rendered chat image. */
async getMessageImageSha256(altText: string): Promise<string> {
const image = this.getMessageImageByAlt(altText);
return image.evaluate(async (element) => {
const img = element as HTMLImageElement;
const response = await fetch(img.src);
const buffer = await response.arrayBuffer();
const digest = await crypto.subtle.digest('SHA-256', buffer);
return [...new Uint8Array(digest)]
.map((byte) => byte.toString(16).padStart(2, '0'))
.join('');
});
}
/** Asserts the rendered chat image is byte-identical to the sent file. */
async expectMessageImageContentSha256(altText: string, expectedSha256: string): Promise<void> {
await this.expectMessageImageLoaded(altText);
await expect.poll(() => this.getMessageImageSha256(altText), {
timeout: 30_000,
message: `Image ${altText} should be received byte-identical (no truncated/corrupt transfer)`
}).toBe(expectedSha256);
}
getEmbedCardByTitle(title: string): Locator {
return this.page.locator('app-chat-link-embed').filter({
has: this.page.getByText(title, { exact: true })