Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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>
"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.

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 join this conversation on GitHub. Already have an account? Sign in to comment
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