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

Reduce height of toggle on expanded view source event #9067

Closed
wants to merge 5 commits into from
Closed

Reduce height of toggle on expanded view source event #9067

wants to merge 5 commits into from

Conversation

luixxiul
Copy link
Contributor

@luixxiul luixxiul commented Jul 17, 2022

Closes element-hq/element-web#22873

This PR reduces height of clickable toggle area on expanded view source event.

Before After
before after

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

type: defect

Checklist

  • Tests written for new code (and old code if feasible)
  • Linter and other CI checks pass
  • Sign-off given on the changes (see CONTRIBUTING.md)

Here's what your changelog entry will look like:

🐛 Bug Fixes

Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
@github-actions github-actions bot added Z-Community-PR Issue is solved by a community member's PR T-Defect Bugs, crashes, hangs, vulnerabilities, or other reported problems labels Jul 17, 2022
Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
@luixxiul luixxiul marked this pull request as ready for review July 17, 2022 16:19
@luixxiul luixxiul requested a review from a team as a code owner July 17, 2022 16:19
"created and configured the room.");

// Edit message
cy.get(".mx_RoomView_body .mx_EventTile").contains(".mx_EventTile_line", "Message").within(() => {
Copy link
Contributor

Choose a reason for hiding this comment

The 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 contains instead of get.
Otherwise Cypress runs the contains test on the first result of cy.get(".mx_RoomView_body .mx_EventTile").

Suggested change
cy.get(".mx_RoomView_body .mx_EventTile").contains(".mx_EventTile_line", "Message").within(() => {
cy.contains(".mx_RoomView_body .mx_EventTile .mx_EventTile_line", "Message").within(() => {

Copy link
Contributor Author

@luixxiul luixxiul Jul 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was following other existing examples on threads.spec.ts without knowing what I was doing.

Thanks for the info!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was following other existing examples on threads.spec.ts.

Thanks for the info!

Most of the time you are lucky that only a single element matches.
But imho the tests are more reliable when using cy.contains.

@@ -143,6 +143,37 @@ describe("Timeline", () => {
});
});

it("should set size and position to event toggle on expanded view source event", () => {
Copy link
Contributor

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.

Copy link
Contributor Author

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

  1. Test a well-isolated unit of functionality. The more specific, the easier it will be to tell what's wrong when they fail.
  2. Don't depend on state from other tests: any given test should be able to run in isolation.

Is it fine to merge several tests into one, if the same function is tested?

Copy link
Contributor

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

Good point. Sorry for confusing you. Going to discuss that part of the docs.

Is it fine to merge several tests into one, if the same function is tested?

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

That totally makes sense. It would be perfect if the policy would be available as documentation.

luixxiul added 3 commits July 21, 2022 13:58
Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
@luixxiul luixxiul closed this Mar 1, 2023
@luixxiul luixxiul deleted the ViewSourceEvent2 branch March 1, 2023 09:18
@luixxiul luixxiul restored the ViewSourceEvent2 branch March 3, 2023 22:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
T-Defect Bugs, crashes, hangs, vulnerabilities, or other reported problems Z-Community-PR Issue is solved by a community member's PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clickable area of toggle on expanded view source event
2 participants