Skip to content

Commit 5156e88

Browse files
authored
Reduce screenshot scope (#33522)
1 parent d1a9f95 commit 5156e88

28 files changed

Lines changed: 61 additions & 40 deletions

apps/web/playwright/e2e/crypto/history-sharing.spec.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,12 @@ test.describe("History sharing", function () {
6464
// Exclude message timestamps and RR avatars from the screenshot. Bob sometimes sees Alice's RR on the
6565
// previous event, which is surprising but not what we're testing here.
6666
const mask = [bobPage.locator(".mx_MessageTimestamp"), bobPage.locator(".mx_ReadReceiptGroup_container")];
67-
await expect(bobPage.locator(".mx_RoomView_body")).toMatchScreenshot("shared-history-invite-accepted.png", {
68-
mask,
69-
});
67+
await expect(bobPage.locator(".mx_RoomView_timeline")).toMatchScreenshot(
68+
"shared-history-invite-accepted.png",
69+
{
70+
mask,
71+
},
72+
);
7073
},
7174
);
7275

apps/web/playwright/e2e/timeline/event-list-summary.spec.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ test.describe("Event List Summary", () => {
3535
).toBeVisible();
3636

3737
await replaceBotIds(page, bot);
38-
await expect(page.locator(".mx_MainSplit")).toMatchScreenshot("bot_joined_the_room.png", ignoreTimestamps);
38+
await expect(page.locator(".mx_RoomView_timeline")).toMatchScreenshot(
39+
"bot_joined_the_room.png",
40+
ignoreTimestamps,
41+
);
3942
},
4043
);
4144

@@ -67,7 +70,10 @@ test.describe("Event List Summary", () => {
6770
).toBeVisible();
6871

6972
await replaceBotIds(page, bot);
70-
await expect(page.locator(".mx_MainSplit")).toMatchScreenshot("bot_was_banned.png", ignoreTimestamps);
73+
await expect(page.locator(".mx_RoomView_timeline")).toMatchScreenshot(
74+
"bot_was_banned.png",
75+
ignoreTimestamps,
76+
);
7177
},
7278
);
7379

@@ -98,7 +104,7 @@ test.describe("Event List Summary", () => {
98104
).toBeVisible();
99105

100106
await replaceBotIds(page, bot);
101-
await expect(page.locator(".mx_MainSplit")).toMatchScreenshot(
107+
await expect(page.locator(".mx_RoomView_timeline")).toMatchScreenshot(
102108
"multiple_join_leave_messages.png",
103109
ignoreTimestamps,
104110
);
@@ -133,7 +139,7 @@ test.describe("Event List Summary", () => {
133139
).toBeVisible();
134140

135141
await replaceBotIds(page, bot);
136-
await expect(page.locator(".mx_MainSplit")).toMatchScreenshot(
142+
await expect(page.locator(".mx_RoomView_timeline")).toMatchScreenshot(
137143
"multiple_join_ban_messages.png",
138144
ignoreTimestamps,
139145
);
@@ -180,7 +186,7 @@ test.describe("Event List Summary", () => {
180186
await expect(page.locator('div[aria-label="3 members"]')).toBeVisible();
181187

182188
await replaceBotIds(page, bot, bot2);
183-
await expect(page.locator(".mx_MainSplit")).toMatchScreenshot(
189+
await expect(page.locator(".mx_RoomView_timeline")).toMatchScreenshot(
184190
"multiple_people_join_leave_messages.png",
185191
ignoreTimestampsRightColumnAndHeader,
186192
);
@@ -202,7 +208,7 @@ test.describe("Event List Summary", () => {
202208
).toBeVisible();
203209

204210
await replaceBotIds(page, bot, bot2);
205-
await expect(page.locator(".mx_MainSplit")).toMatchScreenshot(
211+
await expect(page.locator(".mx_RoomView_timeline")).toMatchScreenshot(
206212
"multiple_people_join_leave_messages_expanded.png",
207213
ignoreTimestampsRightColumnAndHeader,
208214
);
@@ -250,7 +256,7 @@ test.describe("Event List Summary", () => {
250256
await expect(page.locator('div[aria-label="3 members"]')).toBeVisible();
251257

252258
await replaceBotIds(page, bot, bot2);
253-
await expect(page.locator(".mx_MainSplit")).toMatchScreenshot(
259+
await expect(page.locator(".mx_RoomView_timeline")).toMatchScreenshot(
254260
"multiple_people_ban_messages.png",
255261
ignoreTimestampsRightColumnAndHeader,
256262
);
@@ -272,7 +278,7 @@ test.describe("Event List Summary", () => {
272278
).toBeVisible();
273279

274280
await replaceBotIds(page, bot, bot2);
275-
await expect(page.locator(".mx_MainSplit")).toMatchScreenshot(
281+
await expect(page.locator(".mx_RoomView_timeline")).toMatchScreenshot(
276282
"multiple_people_ban_messages_expanded.png",
277283
ignoreTimestampsRightColumnAndHeader,
278284
);

apps/web/playwright/e2e/timeline/timeline.spec.ts

Lines changed: 41 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ test.describe("Timeline", () => {
152152
// wait for the date separator to appear to have a stable screenshot
153153
await expect(page.locator(".mx_TimelineSeparator")).toHaveText("today");
154154

155-
await expect(page.locator(".mx_MainSplit")).toMatchScreenshot("configured-room-irc-layout.png");
155+
await expect(page.locator(".mx_RoomView_timeline")).toMatchScreenshot("configured-room-irc-layout.png");
156156
},
157157
);
158158

@@ -177,7 +177,7 @@ test.describe("Timeline", () => {
177177
// Assert that the "expand" link button worked
178178
await expect(gels.getByRole("button", { name: "Collapse" })).toBeVisible();
179179

180-
await expect(page.locator(".mx_MainSplit")).toMatchScreenshot("expanded-gels-irc-layout.png", {
180+
await expect(page.locator(".mx_RoomView_timeline")).toMatchScreenshot("expanded-gels-irc-layout.png", {
181181
css: `
182182
.mx_MessageTimestamp,.mx_TopUnreadMessagesBar {
183183
visibility: hidden;
@@ -213,16 +213,19 @@ test.describe("Timeline", () => {
213213
// Assert that the "expand" link button worked
214214
await expect(gels.getByRole("button", { name: "Collapse" })).toBeVisible();
215215

216-
await expect(page.locator(".mx_MainSplit")).toMatchScreenshot("expanded-gels-modern-layout.png", {
217-
css: `
216+
await expect(page.locator(".mx_RoomView_timeline")).toMatchScreenshot(
217+
"expanded-gels-modern-layout.png",
218+
{
219+
css: `
218220
.mx_MessageTimestamp,.mx_TopUnreadMessagesBar {
219221
visibility: hidden;
220222
}
221223
.mx_MessagePanel_myReadMarker {
222224
display: none !important;
223225
}
224226
`,
225-
});
227+
},
228+
);
226229
},
227230
);
228231

@@ -254,14 +257,17 @@ test.describe("Timeline", () => {
254257
).not.toBeVisible(); // See: _GenericEventListSummary.pcss
255258

256259
// Save snapshot of expanded generic event list summary on bubble layout
257-
await expect(page.locator(".mx_MainSplit")).toMatchScreenshot("expanded-gels-bubble-layout.png", {
258-
// Exclude timestamp from snapshot
259-
css: `
260+
await expect(page.locator(".mx_RoomView_timeline")).toMatchScreenshot(
261+
"expanded-gels-bubble-layout.png",
262+
{
263+
// Exclude timestamp from snapshot
264+
css: `
260265
.mx_MessageTimestamp,.mx_TopUnreadMessagesBar {
261266
visibility: hidden;
262267
}
263268
`,
264-
});
269+
},
270+
);
265271

266272
// Click "collapse" link button on the first hovered info event line
267273
const firstTile = gels.locator(
@@ -275,13 +281,16 @@ test.describe("Timeline", () => {
275281
await expect(gels.getByRole("button", { name: "Expand" })).toBeVisible();
276282

277283
// Save snapshot of collapsed generic event list summary on bubble layout
278-
await expect(page.locator(".mx_MainSplit")).toMatchScreenshot("collapsed-gels-bubble-layout.png", {
279-
css: `
284+
await expect(page.locator(".mx_RoomView_timeline")).toMatchScreenshot(
285+
"collapsed-gels-bubble-layout.png",
286+
{
287+
css: `
280288
.mx_MessageTimestamp,.mx_TopUnreadMessagesBar {
281289
visibility: hidden;
282290
}
283291
`,
284-
});
292+
},
293+
);
285294
},
286295
);
287296

@@ -317,7 +326,7 @@ test.describe("Timeline", () => {
317326
await expect(firstEventLineIrc).toHaveCSS("margin-inline-start", "99px");
318327
await expect(firstEventLineIrc).toHaveCSS("inset-inline-start", "0px");
319328

320-
await expect(page.locator(".mx_MainSplit")).toMatchScreenshot(
329+
await expect(page.locator(".mx_RoomView_timeline")).toMatchScreenshot(
321330
"event-line-inline-start-margin-irc-layout.png",
322331
{
323332
// Exclude timestamp and read marker from snapshot
@@ -416,10 +425,10 @@ test.describe("Timeline", () => {
416425
await expect(locator).toHaveCSS("min-width", "46px");
417426
}
418427
// Record alignment of collapsed GELS and messages on messagePanel
419-
await expect(page.locator(".mx_MainSplit")).toMatchScreenshot(
428+
await expect(page.locator(".mx_RoomView_timeline")).toMatchScreenshot(
420429
"collapsed-gels-and-messages-irc-layout.png",
421430
{
422-
// Exclude timestamp from snapshot of mx_MainSplit
431+
// Exclude timestamp from snapshot of mx_RoomView_timeline
423432
css: `
424433
.mx_MessageTimestamp {
425434
visibility: hidden;
@@ -439,10 +448,10 @@ test.describe("Timeline", () => {
439448
page.locator(".mx_EventTile[data-layout=irc].mx_EventTile_info:first-of-type .mx_EventTile_line"),
440449
).toHaveCSS("margin-inline-start", "99px");
441450
// Record alignment of expanded GELS and messages on messagePanel
442-
await expect(page.locator(".mx_MainSplit")).toMatchScreenshot(
451+
await expect(page.locator(".mx_RoomView_timeline")).toMatchScreenshot(
443452
"expanded-gels-and-messages-irc-layout.png",
444453
{
445-
// Exclude timestamp from snapshot of mx_MainSplit
454+
// Exclude timestamp from snapshot of mx_RoomView_timeline
446455
css: `
447456
.mx_MessageTimestamp,.mx_TopUnreadMessagesBar {
448457
visibility: hidden;
@@ -468,10 +477,10 @@ test.describe("Timeline", () => {
468477
page.locator(".mx_GenericEventListSummary .mx_EventTile_last").getByRole("status"),
469478
).toHaveAccessibleName("Your message was sent");
470479
// Record alignment of expanded GELS and placeholder of deleted message on messagePanel
471-
await expect(page.locator(".mx_MainSplit")).toMatchScreenshot(
480+
await expect(page.locator(".mx_RoomView_timeline")).toMatchScreenshot(
472481
"expanded-gels-redaction-placeholder.png",
473482
{
474-
// Exclude timestamp from snapshot of mx_MainSplit
483+
// Exclude timestamp from snapshot of mx_RoomView_timeline
475484
css: `
476485
.mx_MessageTimestamp {
477486
visibility: hidden;
@@ -502,14 +511,17 @@ test.describe("Timeline", () => {
502511
page.locator(".mx_EventTile_last.mx_EventTile_emote").getByRole("status"),
503512
).toHaveAccessibleName("Your message was sent");
504513
// Record alignment of expanded GELS, placeholder of deleted message, and emote
505-
await expect(page.locator(".mx_MainSplit")).toMatchScreenshot("expanded-gels-emote-irc-layout.png", {
506-
// Exclude timestamp from snapshot of mx_MainSplit
507-
css: `
514+
await expect(page.locator(".mx_RoomView_timeline")).toMatchScreenshot(
515+
"expanded-gels-emote-irc-layout.png",
516+
{
517+
// Exclude timestamp from snapshot of mx_RoomView_timeline
518+
css: `
508519
.mx_MessageTimestamp {
509520
visibility: hidden;
510521
}
511522
`,
512-
});
523+
},
524+
);
513525
},
514526
);
515527

@@ -566,7 +578,7 @@ test.describe("Timeline", () => {
566578
await expect(
567579
page.locator(".mx_RoomView").getByText("This message has an inline emoji 👒"),
568580
).toBeInViewport();
569-
await expect(page.locator(".mx_MainSplit")).toMatchScreenshot(
581+
await expect(page.locator(".mx_RoomView_timeline")).toMatchScreenshot(
570582
"event-tiles-irc-layout.png",
571583
screenshotOptions,
572584
);
@@ -582,7 +594,7 @@ test.describe("Timeline", () => {
582594
await expect(
583595
page.locator(".mx_RoomView").getByText("This message has an inline emoji 👒"),
584596
).toBeInViewport();
585-
await expect(page.locator(".mx_MainSplit")).toMatchScreenshot(
597+
await expect(page.locator(".mx_RoomView_timeline")).toMatchScreenshot(
586598
"event-tiles-modern-layout.png",
587599
screenshotOptions,
588600
);
@@ -595,7 +607,7 @@ test.describe("Timeline", () => {
595607
await expect(
596608
page.locator(".mx_RoomView").getByText("This message has an inline emoji 👒"),
597609
).toBeInViewport();
598-
await expect(page.locator(".mx_MainSplit")).toMatchScreenshot(
610+
await expect(page.locator(".mx_RoomView_timeline")).toMatchScreenshot(
599611
"event-tiles-compact-modern-layout.png",
600612
screenshotOptions,
601613
);
@@ -610,7 +622,7 @@ test.describe("Timeline", () => {
610622
await expect(
611623
page.locator(".mx_RoomView").getByText("This message has an inline emoji 👒"),
612624
).toBeInViewport();
613-
await expect(page.locator(".mx_MainSplit")).toMatchScreenshot(
625+
await expect(page.locator(".mx_RoomView_timeline")).toMatchScreenshot(
614626
"event-tiles-bubble-layout.png",
615627
screenshotOptions,
616628
);
@@ -657,7 +669,7 @@ test.describe("Timeline", () => {
657669
`,
658670
};
659671

660-
await expect(page.locator(".mx_MainSplit")).toMatchScreenshot(
672+
await expect(page.locator(".mx_RoomView_timeline")).toMatchScreenshot(
661673
"hidden-event-line-zero-padding-irc-layout.png",
662674
screenshotOptions,
663675
);
@@ -669,7 +681,7 @@ test.describe("Timeline", () => {
669681
page.locator(".mx_EventTile[data-layout=group].mx_EventTile_info .mx_EventTile_line").first(),
670682
).toHaveCSS("padding-inline-start", "84px");
671683

672-
await expect(page.locator(".mx_MainSplit")).toMatchScreenshot(
684+
await expect(page.locator(".mx_RoomView_timeline")).toMatchScreenshot(
673685
"hidden-event-line-padding-modern-layout.png",
674686
screenshotOptions,
675687
);
-9.58 KB
Loading
-9.93 KB
Loading
-9.96 KB
Loading
-9.98 KB
Loading
-9.92 KB
Loading
-5.57 KB
Loading
-5.58 KB
Loading

0 commit comments

Comments
 (0)