Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Update tests to ensure file size unit has been fixed #10568

Merged
merged 4 commits into from
Apr 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions cypress/e2e/right-panel/file-panel.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,23 @@ describe("FilePanel", () => {
});
});

it("should render file size in kibibytes on a file tile", () => {
const size = "1.12 KB"; // actual file size in kibibytes (1024 bytes)

// Upload a file
uploadFile("cypress/fixtures/matrix-org-client-versions.json");

cy.get(".mx_FilePanel .mx_EventTile").within(() => {
// Assert that the file size is displayed in kibibytes, not kilobytes (1000 bytes)
// See: https://github.com/vector-im/element-web/issues/24866
cy.contains(".mx_MFileBody_info_filename", size).should("exist");
cy.get(".mx_MFileBody_download").within(() => {
cy.contains("a", size).should("exist");
cy.contains(".mx_MImageBody_size", size).should("exist");
});
});
});

it("should not add inline padding to a tile when it is selected with right click", () => {
// Upload a file
uploadFile("cypress/fixtures/1sec.ogg");
Expand Down
28 changes: 28 additions & 0 deletions cypress/e2e/timeline/timeline.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,34 @@ describe("Timeline", () => {
cy.get(".mx_EventTile[data-layout=irc] .mx_ViewSourceEvent_expanded").should("be.visible");
});

it("should render file size in kibibytes on a file tile", () => {
cy.visit("/#/room/" + roomId);
cy.get(".mx_GenericEventListSummary_summary").within(() => {
cy.findByText(OLD_NAME + " created and configured the room.").should("exist");
});

// Upload a file from the message composer
cy.get(".mx_MessageComposer_actions input[type='file']").selectFile(
"cypress/fixtures/matrix-org-client-versions.json",
{ force: true },
);

cy.get(".mx_Dialog").within(() => {
// Click "Upload" button
cy.findByRole("button", { name: "Upload" }).click();
});

// Wait until the file is sent
cy.get(".mx_RoomView_statusArea_expanded").should("not.exist");
cy.get(".mx_EventTile.mx_EventTile_last .mx_EventTile_receiptSent").should("exist");

// Assert that the file size is displayed in kibibytes (1024 bytes), not kilobytes (1000 bytes)
// See: https://github.com/vector-im/element-web/issues/24866
cy.get(".mx_EventTile_last").within(() => {
cy.contains(".mx_MFileBody_info_filename", "1.12 KB").should("exist"); // actual file size in kibibytes
});
});

it("should highlight search result words regardless of formatting", () => {
sendEvent(roomId);
sendEvent(roomId, true);
Expand Down