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

Commit bef6eca

Browse files
luixxiulrichvdh
andauthored
Update tests to ensure file size unit has been fixed (#10568)
* Update tests to ensure file size unit has been fixed Signed-off-by: Suguru Hirahara <[email protected]> * Update cypress/e2e/timeline/timeline.spec.ts Co-authored-by: Richard van der Hoff <[email protected]> * Edit comments mentioning kilobytes Signed-off-by: Suguru Hirahara <[email protected]> --------- Signed-off-by: Suguru Hirahara <[email protected]> Co-authored-by: Richard van der Hoff <[email protected]>
1 parent 3c4fa8b commit bef6eca

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

cypress/e2e/right-panel/file-panel.spec.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,23 @@ describe("FilePanel", () => {
211211
});
212212
});
213213

214+
it("should render file size in kibibytes on a file tile", () => {
215+
const size = "1.12 KB"; // actual file size in kibibytes (1024 bytes)
216+
217+
// Upload a file
218+
uploadFile("cypress/fixtures/matrix-org-client-versions.json");
219+
220+
cy.get(".mx_FilePanel .mx_EventTile").within(() => {
221+
// Assert that the file size is displayed in kibibytes, not kilobytes (1000 bytes)
222+
// See: https://github.com/vector-im/element-web/issues/24866
223+
cy.contains(".mx_MFileBody_info_filename", size).should("exist");
224+
cy.get(".mx_MFileBody_download").within(() => {
225+
cy.contains("a", size).should("exist");
226+
cy.contains(".mx_MImageBody_size", size).should("exist");
227+
});
228+
});
229+
});
230+
214231
it("should not add inline padding to a tile when it is selected with right click", () => {
215232
// Upload a file
216233
uploadFile("cypress/fixtures/1sec.ogg");

cypress/e2e/timeline/timeline.spec.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,34 @@ describe("Timeline", () => {
679679
cy.get(".mx_EventTile[data-layout=irc] .mx_ViewSourceEvent_expanded").should("be.visible");
680680
});
681681

682+
it("should render file size in kibibytes on a file tile", () => {
683+
cy.visit("/#/room/" + roomId);
684+
cy.get(".mx_GenericEventListSummary_summary").within(() => {
685+
cy.findByText(OLD_NAME + " created and configured the room.").should("exist");
686+
});
687+
688+
// Upload a file from the message composer
689+
cy.get(".mx_MessageComposer_actions input[type='file']").selectFile(
690+
"cypress/fixtures/matrix-org-client-versions.json",
691+
{ force: true },
692+
);
693+
694+
cy.get(".mx_Dialog").within(() => {
695+
// Click "Upload" button
696+
cy.findByRole("button", { name: "Upload" }).click();
697+
});
698+
699+
// Wait until the file is sent
700+
cy.get(".mx_RoomView_statusArea_expanded").should("not.exist");
701+
cy.get(".mx_EventTile.mx_EventTile_last .mx_EventTile_receiptSent").should("exist");
702+
703+
// Assert that the file size is displayed in kibibytes (1024 bytes), not kilobytes (1000 bytes)
704+
// See: https://github.com/vector-im/element-web/issues/24866
705+
cy.get(".mx_EventTile_last").within(() => {
706+
cy.contains(".mx_MFileBody_info_filename", "1.12 KB").should("exist"); // actual file size in kibibytes
707+
});
708+
});
709+
682710
it("should highlight search result words regardless of formatting", () => {
683711
sendEvent(roomId);
684712
sendEvent(roomId, true);

0 commit comments

Comments
 (0)