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 <luixxiul@users.noreply.github.com>

* Update cypress/e2e/timeline/timeline.spec.ts

Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>

* Edit comments mentioning kilobytes

Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>

---------

Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
This commit is contained in:
Suguru Hirahara
2023-04-12 10:21:13 +00:00
committed by GitHub
co-authored by Richard van der Hoff
parent 3c4fa8b430
commit bef6eca484
2 changed files with 45 additions and 0 deletions
+28
View File
@@ -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);