Deflake the chat export test (#12854)

Just set a fixed time instead, as per comment (Im not actually
sure my changes broke this, I think it might just be because it's
August now).
dbkr/sss
David Baker 2024-08-01 11:37:49 +01:00 提交者 GitHub
父节点 a0c029c3c1
当前提交 e6a3238621
找不到此签名对应的密钥
GPG 密钥 ID: B5690EEEBB952194
共有 2 个文件被更改,包括 4 次插入1 次删除

查看文件

@ -98,6 +98,10 @@ test.describe("HTML Export", () => {
}); });
test("should export html successfully and match screenshot", async ({ page, app, room }) => { test("should export html successfully and match screenshot", async ({ page, app, room }) => {
// Set a fixed time rather than masking off the line with the time in it: we don't need to worry
// about the width changing and we can actually test this line looks correct.
page.clock.setSystemTime(new Date("2024-01-01T00:00:00Z"));
// Send a bunch of messages to populate the room // Send a bunch of messages to populate the room
for (let i = 1; i < 10; i++) { for (let i = 1; i < 10; i++) {
await app.client.sendMessage(room.roomId, { body: `Testing ${i}`, msgtype: "m.text" }); await app.client.sendMessage(room.roomId, { body: `Testing ${i}`, msgtype: "m.text" });
@ -123,7 +127,6 @@ test.describe("HTML Export", () => {
await page.goto(`file://${dirPath}/${Object.keys(zip.files)[0]}/messages.html`); await page.goto(`file://${dirPath}/${Object.keys(zip.files)[0]}/messages.html`);
await expect(page).toMatchScreenshot("html-export.png", { await expect(page).toMatchScreenshot("html-export.png", {
mask: [ mask: [
page.getByText("This is the start of export", { exact: false }),
// We need to mask the whole thing because the width of the time part changes // We need to mask the whole thing because the width of the time part changes
page.locator(".mx_TimelineSeparator"), page.locator(".mx_TimelineSeparator"),
page.locator(".mx_MessageTimestamp"), page.locator(".mx_MessageTimestamp"),

二进制文件未显示。

之前

宽度:  |  高度:  |  大小: 40 KiB

之后

宽度:  |  高度:  |  大小: 49 KiB