Stabilize screenshots
@ -40,7 +40,7 @@ test.describe("Collapsible Room list", () => {
|
||||
}
|
||||
|
||||
test("should be possible to expand/contract the room list", { tag: "@screenshot" }, async ({ page, app, user }) => {
|
||||
await expect(page).toMatchScreenshot("room-list-collapse-default.png");
|
||||
await expect(page).toMatchScreenshot("room-list-collapse-default.png", { unlockLeftPanelWidth: true });
|
||||
const leftPanelLocator = page.getByTestId("left-panel");
|
||||
|
||||
// Contract the panel
|
||||
@ -68,7 +68,9 @@ test.describe("Collapsible Room list", () => {
|
||||
// Expect te separator to be shown
|
||||
const separator = page.getByRole("separator", { name: "Click or drag to expand" });
|
||||
await expect(separator).toBeInViewport();
|
||||
await expect(page).toMatchScreenshot("room-list-collapse-fully-collapsed.png");
|
||||
await expect(page).toMatchScreenshot("room-list-collapse-fully-collapsed.png", {
|
||||
unlockLeftPanelWidth: true,
|
||||
});
|
||||
|
||||
// Should be possible to expand by clicking on the separator
|
||||
await separator.click();
|
||||
|
||||
@ -45,6 +45,6 @@ test.describe("Room list panel", () => {
|
||||
|
||||
test("should respond to small screen sizes", { tag: "@screenshot" }, async ({ page }) => {
|
||||
await page.setViewportSize({ width: 575, height: 600 });
|
||||
await expect(page).toMatchScreenshot("room-list-panel-smallscreen.png");
|
||||
await expect(page).toMatchScreenshot("room-list-panel-smallscreen.png", { unlockLeftPanelWidth: true });
|
||||
});
|
||||
});
|
||||
|
||||
@ -82,7 +82,7 @@ test.describe("Location sharing", { tag: "@no-firefox" }, () => {
|
||||
"region", // XXX: ContextMenu managed=false does not provide a role.
|
||||
]);
|
||||
await expect(axe).toHaveNoViolations();
|
||||
await expect(menu).toMatchScreenshot("location-live-share-dialog.png");
|
||||
await expect(menu).toMatchScreenshot("location-live-share-dialog.png", { unlockLeftPanelWidth: true });
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
@ -117,6 +117,7 @@ interface ExtendedToMatchScreenshotOptions extends ToMatchScreenshotOptions {
|
||||
showTooltips?: boolean;
|
||||
timeout?: number;
|
||||
hideJumpToBottomButton?: boolean;
|
||||
unlockLeftPanelWidth?: boolean;
|
||||
}
|
||||
|
||||
type Expectations = {
|
||||
@ -162,6 +163,14 @@ export const expect = baseExpect.extend<Expectations>({
|
||||
}
|
||||
`;
|
||||
|
||||
if (!options?.unlockLeftPanelWidth) {
|
||||
css += `
|
||||
#left-panel {
|
||||
flex: 0 0 369.6875px !important;
|
||||
}
|
||||
`;
|
||||
}
|
||||
|
||||
if (!options?.showTooltips) {
|
||||
css += `
|
||||
[data-floating-ui-portal],
|
||||
|
||||
|
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 57 KiB |
|
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 8.5 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 149 KiB After Width: | Height: | Size: 149 KiB |
|
Before Width: | Height: | Size: 150 KiB After Width: | Height: | Size: 150 KiB |
|
Before Width: | Height: | Size: 166 KiB After Width: | Height: | Size: 167 KiB |
@ -93,7 +93,7 @@ export class ResizerViewModel
|
||||
public onSeparatorClick = (): void => {
|
||||
if (this.panelHandle?.isCollapsed()) {
|
||||
const lastSize = SettingsStore.getValue("RoomList.panelSize");
|
||||
this.panelHandle.resize(`${lastSize}%`);
|
||||
this.panelHandle.resize(`${lastSize ?? 100}%`);
|
||||
this.autoCollapse.onLeftPanelResized();
|
||||
}
|
||||
};
|
||||
|
||||
@ -15,7 +15,8 @@ jest.useFakeTimers();
|
||||
describe("CollapseOnWindowResizeBehaviour", () => {
|
||||
it("Should collapse/expand the panel when the window is resized", () => {
|
||||
const collapseHandler = new MockCollapseHandler() as unknown as CollapseHandler;
|
||||
const behaviour = new CollapseOnWindowResizeBehaviour(collapseHandler);
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const _behaviour = new CollapseOnWindowResizeBehaviour(collapseHandler);
|
||||
// Making the window smaller should collapse the panel.
|
||||
UIStore.instance.emit(UI_EVENTS.WidthDecreased, 750);
|
||||
expect(collapseHandler.collapse).toHaveBeenCalledTimes(1);
|
||||
@ -52,7 +53,8 @@ describe("CollapseOnWindowResizeBehaviour", () => {
|
||||
|
||||
it("should return correct shouldStartCollapsed", () => {
|
||||
const collapseHandler = new MockCollapseHandler();
|
||||
const behaviour = new CollapseOnWindowResizeBehaviour(collapseHandler as unknown as CollapseHandler);
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const _behaviour = new CollapseOnWindowResizeBehaviour(collapseHandler as unknown as CollapseHandler);
|
||||
// When the window is smaller than 768px, start collapsed.
|
||||
UIStore.instance.windowWidth = 750;
|
||||
expect(CollapseOnWindowResizeBehaviour.shouldStartCollapsed()).toBe(true);
|
||||
|
||||