Fix decryption failure bar covering the timeline (#10360)
* Use grid layout instead - BEM naming style - Increase block gap from 4px to 8px - Use flexbox inside 'header' grid-area to let the buttons wrapped - Use variables - Remove 4px gap when one of the buttons is not rendered - Change 'body' to 'message' - Set 'align-self: start' to the icon and spinner Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com> * Unset height of spinner Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com> * Break lines at newline characters with white-space: pre-line Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com> * Edit tests to check decryption failure bars on narrow timeline - checkTimelineNarrow() looks for buttons by default - Test indicator as well Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com> * Remove a line Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com> * Edit the test to have it check mx_EventTile_last only inside mx_RoomView_body Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com> * Fix double underscores Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com> * Fix double underscores - pcss Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com> * Iterate - buttons at the bottom - Set common spacing to buttons with variables - Remove line breaks, yarn run i18n - Set data-testid for headlines and buttons in case the tested strings would be displayed elsewhere simultaneously Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com> * Check waiting headline as well Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com> * Increase spacing between the message and the buttons Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com> * lint Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com> * Increase block gap between wrapped buttons for clickability Apply 8px between wrapped buttons Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com> * Revert bottom margin of buttons which are not expected to be wrapped Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com> * Check visibility instead of existence This commit removes data-testid from headlines and data-testid-button and checks whether the elements are really visible, not overflowing the viewport. Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com> * Remove redundant gap between 'mx_DecryptionFailureBar_start' and the bottom edge This commit adds '.mx_DecryptionFailureBar--withEnd' class name to have it applied to the bar only if it has button(s). This way the bar is rendered with a flexbox and the row-gap declaration is respected only if there is a 'mx_DecryptionFailureBar--withEnd' element. The element currently includes the button(s) only. Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com> * lint - prettier Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com> * Have Percy take a snapshot of the bar loading spinner before checkTimelineNarrow() The loading spinner is likely to disappear while checking the bar on the narrow timeline. Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com> --------- Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com> Co-authored-by: Kerry <kerrya@element.io>
This commit is contained in:
parent
bebfbacded
commit
232daaff68
5 changed files with 471 additions and 238 deletions
|
@ -57,6 +57,28 @@ const handleVerificationRequest = (request: VerificationRequest): Chainable<Emoj
|
|||
);
|
||||
};
|
||||
|
||||
const checkTimelineNarrow = (button = true) => {
|
||||
cy.viewport(800, 600); // SVGA
|
||||
cy.get(".mx_LeftPanel_minimized").should("exist"); // Wait until the left panel is minimized
|
||||
cy.get(".mx_RightPanel_roomSummaryButton").click(); // Open the right panel to make the timeline narrow
|
||||
cy.get(".mx_BaseCard").should("exist");
|
||||
|
||||
// Ensure the failure bar does not cover the timeline
|
||||
cy.get(".mx_RoomView_body .mx_EventTile.mx_EventTile_last").should("be.visible");
|
||||
|
||||
// Ensure the indicator does not overflow the timeline
|
||||
cy.get("[data-testid='decryption-failure-bar-indicator']").should("be.visible");
|
||||
|
||||
if (button) {
|
||||
// Ensure the button does not overflow the timeline
|
||||
cy.get("[data-testid='decryption-failure-bar-button']:last-of-type").should("be.visible");
|
||||
}
|
||||
|
||||
cy.get(".mx_RightPanel_roomSummaryButton").click(); // Close the right panel
|
||||
cy.get(".mx_BaseCard").should("not.exist");
|
||||
cy.viewport(1000, 660); // Reset to the default size
|
||||
};
|
||||
|
||||
describe("Decryption Failure Bar", () => {
|
||||
let homeserver: HomeserverInstance | undefined;
|
||||
let testUser: UserCredentials | undefined;
|
||||
|
@ -113,10 +135,13 @@ describe("Decryption Failure Bar", () => {
|
|||
})
|
||||
.then(() => {
|
||||
cy.botSendMessage(bot, roomId, "test");
|
||||
cy.contains(".mx_DecryptionFailureBar_start_headline", "Decrypting messages…").should("be.visible");
|
||||
cy.contains(
|
||||
".mx_DecryptionFailureBar .mx_DecryptionFailureBar_message_headline",
|
||||
".mx_DecryptionFailureBar_start_headline",
|
||||
"Verify this device to access all messages",
|
||||
);
|
||||
).should("be.visible");
|
||||
|
||||
checkTimelineNarrow();
|
||||
|
||||
cy.get(".mx_DecryptionFailureBar").percySnapshotElement(
|
||||
"DecryptionFailureBar prompts user to verify",
|
||||
|
@ -125,12 +150,14 @@ describe("Decryption Failure Bar", () => {
|
|||
},
|
||||
);
|
||||
|
||||
cy.contains(".mx_DecryptionFailureBar_button", "Resend key requests").should("not.exist");
|
||||
cy.contains(".mx_DecryptionFailureBar_button", "Verify").click();
|
||||
cy.contains(".mx_DecryptionFailureBar_end", "Resend key requests").should("not.exist");
|
||||
cy.contains(".mx_DecryptionFailureBar_end", "Verify").should("be.visible").click();
|
||||
|
||||
const verificationRequestPromise = waitForVerificationRequest(otherDevice);
|
||||
cy.get(".mx_CompleteSecurity_actionRow .mx_AccessibleButton").click();
|
||||
cy.contains("To proceed, please accept the verification request on your other device.");
|
||||
cy.contains("To proceed, please accept the verification request on your other device.").should(
|
||||
"be.visible",
|
||||
);
|
||||
cy.wrap(verificationRequestPromise).then((verificationRequest: VerificationRequest) => {
|
||||
cy.wrap(verificationRequest.accept());
|
||||
handleVerificationRequest(verificationRequest).then((emojis) => {
|
||||
|
@ -146,10 +173,12 @@ describe("Decryption Failure Bar", () => {
|
|||
cy.get(".mx_VerificationPanel_verified_section .mx_E2EIcon_verified").should("exist");
|
||||
cy.contains(".mx_AccessibleButton", "Got it").click();
|
||||
|
||||
cy.get(".mx_DecryptionFailureBar .mx_DecryptionFailureBar_message_headline").should(
|
||||
"have.text",
|
||||
cy.contains(
|
||||
".mx_DecryptionFailureBar_start_headline",
|
||||
"Open another device to load encrypted messages",
|
||||
);
|
||||
).should("be.visible");
|
||||
|
||||
checkTimelineNarrow();
|
||||
|
||||
cy.get(".mx_DecryptionFailureBar").percySnapshotElement(
|
||||
"DecryptionFailureBar prompts user to open another device, with Resend Key Requests button",
|
||||
|
@ -159,9 +188,12 @@ describe("Decryption Failure Bar", () => {
|
|||
);
|
||||
|
||||
cy.intercept("/_matrix/client/r0/sendToDevice/m.room_key_request/*").as("keyRequest");
|
||||
cy.contains(".mx_DecryptionFailureBar_button", "Resend key requests").click();
|
||||
cy.contains(".mx_DecryptionFailureBar_end_button", "Resend key requests").should("be.visible").click();
|
||||
cy.wait("@keyRequest");
|
||||
cy.contains(".mx_DecryptionFailureBar_button", "Resend key requests").should("not.exist");
|
||||
cy.contains(".mx_DecryptionFailureBar_end_button", "Resend key requests").should("not.exist");
|
||||
cy.contains(".mx_DecryptionFailureBar_end_button", "View your device list").should("be.visible");
|
||||
|
||||
checkTimelineNarrow();
|
||||
|
||||
cy.get(".mx_DecryptionFailureBar").percySnapshotElement(
|
||||
"DecryptionFailureBar prompts user to open another device, without Resend Key Requests button",
|
||||
|
@ -184,15 +216,17 @@ describe("Decryption Failure Bar", () => {
|
|||
|
||||
cy.botSendMessage(bot, roomId, "test");
|
||||
cy.contains(
|
||||
".mx_DecryptionFailureBar .mx_DecryptionFailureBar_message_headline",
|
||||
".mx_DecryptionFailureBar_start_headline",
|
||||
"Reset your keys to prevent future decryption errors",
|
||||
);
|
||||
).should("be.visible");
|
||||
|
||||
checkTimelineNarrow();
|
||||
|
||||
cy.get(".mx_DecryptionFailureBar").percySnapshotElement("DecryptionFailureBar prompts user to reset keys", {
|
||||
widths: [320, 640],
|
||||
});
|
||||
|
||||
cy.contains(".mx_DecryptionFailureBar_button", "Reset").click();
|
||||
cy.contains(".mx_DecryptionFailureBar_end_button", "Reset").should("be.visible").click();
|
||||
|
||||
// Set up key backup
|
||||
cy.get(".mx_Dialog").within(() => {
|
||||
|
@ -204,11 +238,12 @@ describe("Decryption Failure Bar", () => {
|
|||
cy.contains("Done").click();
|
||||
});
|
||||
|
||||
cy.get(".mx_DecryptionFailureBar .mx_DecryptionFailureBar_message_headline").should(
|
||||
"have.text",
|
||||
"Some messages could not be decrypted",
|
||||
cy.contains(".mx_DecryptionFailureBar_start_headline", "Some messages could not be decrypted").should(
|
||||
"be.visible",
|
||||
);
|
||||
|
||||
checkTimelineNarrow(false); // button should not be rendered here
|
||||
|
||||
cy.get(".mx_DecryptionFailureBar").percySnapshotElement(
|
||||
"DecryptionFailureBar displays general message with no call to action",
|
||||
{
|
||||
|
@ -233,9 +268,11 @@ describe("Decryption Failure Bar", () => {
|
|||
widths: [320, 640],
|
||||
});
|
||||
|
||||
checkTimelineNarrow();
|
||||
|
||||
cy.wait(5000);
|
||||
cy.get(".mx_DecryptionFailureBar .mx_Spinner").should("not.exist");
|
||||
cy.get(".mx_DecryptionFailureBar .mx_DecryptionFailureBar_icon").should("exist");
|
||||
cy.get("[data-testid='decryption-failure-bar-icon']").should("be.visible");
|
||||
|
||||
cy.get(".mx_RoomView_messagePanel").scrollTo("top");
|
||||
cy.get(".mx_DecryptionFailureBar").should("not.exist");
|
||||
|
@ -245,5 +282,7 @@ describe("Decryption Failure Bar", () => {
|
|||
|
||||
cy.get(".mx_RoomView_messagePanel").scrollTo("bottom");
|
||||
cy.get(".mx_DecryptionFailureBar").should("exist");
|
||||
|
||||
checkTimelineNarrow();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue