-
-
Notifications
You must be signed in to change notification settings - Fork 829
Reduce height of toggle on expanded view source event #9067
Changes from 2 commits
75aa753
2ca58c9
de2de88
fca04ac
e7cf034
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -143,6 +143,37 @@ describe("Timeline", () => { | |||||
}); | ||||||
}); | ||||||
|
||||||
it("should set size and position to event toggle on expanded view source event", () => { | ||||||
sendEvent(roomId); | ||||||
cy.visit("/#/room/" + roomId); | ||||||
cy.setSettingValue("showHiddenEventsInTimeline", null, SettingLevel.DEVICE, true); | ||||||
cy.contains(".mx_RoomView_body .mx_GenericEventListSummary .mx_GenericEventListSummary_summary", | ||||||
"created and configured the room."); | ||||||
|
||||||
// Edit message | ||||||
cy.get(".mx_RoomView_body .mx_EventTile").contains(".mx_EventTile_line", "Message").within(() => { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If there can be multiple items (like I would expect for tiles) I suggest to always use
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was following other existing examples on Thanks for the info! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Most of the time you are lucky that only a single element matches. |
||||||
cy.get('[aria-label="Edit"]').click({ force: true }); // Cypress has no ability to hover | ||||||
cy.get(".mx_BasicMessageComposer_input").type("Edit{enter}"); | ||||||
}); | ||||||
cy.get(".mx_RoomView_body .mx_EventTile").contains(".mx_EventTile[data-scroll-tokens]", "MessageEdit"); | ||||||
|
||||||
// Expand | ||||||
cy.get(".mx_EventTile.mx_EventTile_info:first-of-type .mx_EventTile_line").realHover() | ||||||
.get(".mx_ViewSourceEvent_toggle").click(); | ||||||
|
||||||
// Exclude timestamp and event content from snapshot | ||||||
const percyCSS = ".mx_RoomView_body .mx_EventTile_info .mx_MessageTimestamp, " + | ||||||
".mx_EventTile_content.mx_ViewSourceEvent pre { visibility: hidden !important; }"; | ||||||
|
||||||
// Check size and position of toggle on expanded view source event | ||||||
// cf. _ViewSourceEvent.pcss | ||||||
cy.get(".mx_ViewSourceEvent.mx_EventTile_content.mx_ViewSourceEvent_expanded").realHover() | ||||||
.percySnapshot("ViewSourceEvent_toggle", { percyCSS }) | ||||||
.get(".mx_ViewSourceEvent_toggle") | ||||||
.should('have.css', 'height', '12px') // --ViewSourceEvent_toggle-size | ||||||
.should('have.css', 'align-self', 'flex-end'); | ||||||
}); | ||||||
|
||||||
it("should create and configure a room on IRC layout", () => { | ||||||
cy.visit("/#/room/" + roomId); | ||||||
cy.setSettingValue("layout", null, SettingLevel.DEVICE, Layout.IRC); | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we can re-organise the tests to have one test that goes through all the event source bits. In this particular place I am thinking of merging it with https://github.com/matrix-org/matrix-react-sdk/blob/develop/cypress/e2e/14-timeline/timeline.spec.ts#L154
While it is nice to separate every case it may take too long in the future when we are adding more and more tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably I just don't know what I am doing (ie. ignorance), but I saw this part of the docs: https://github.com/matrix-org/matrix-react-sdk/blob/develop/docs/cypress.md#good-test-hygiene
Is it fine to merge several tests into one, if the same function is tested?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Sorry for confusing you. Going to discuss that part of the docs.
I would say yes as long as it tests the same bits and it shares the steps getting there. Here it is all about the event source view. On the other hand I would not mix up „sign up“ and „event source view“ tests for example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That totally makes sense. It would be perfect if the policy would be available as documentation.