-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
fix: aut centering and height calculation #21019
Conversation
Thanks for taking the time to open a PR!
|
Test summaryRun details
View run in Cypress Dashboard ➡️ Flakiness
This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
This reverts commit 85f1ab8.
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.
When I run the new test you added in open mode, the scales the AUT correctly in e2e
always fails, though it passes when run in isolation. Are you seeing this?
Other than that looks good, not sure if my machine is being weird and CI is green so I'm going to ✔️
return props.gql.localSettings.preferences.reporterWidth ?? runnerUiStore.reporterWidth | ||
}) | ||
|
||
// we must update pr before calling userRunnerStyle, to make sure that values from GQL |
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.
Comment seems incomplete
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.
Dang I did not see that test failure, gonna check it out and fix that comment!
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 was able to see it fail but only once. I think though, we might have run afoul of some gql updates when trying to close the specs list so soon after the doing the last resize earlier in the test - from what I saw the reporter ended up too wide, which could be explained if closing the specs list happened to resolve before updating the width.
I adjusted the test a bit get better separation between those things. Would be good to know if you can still reproduce? Though I think it represents something no user can every be fast enough to do.
@marktnoonan tested the changes, tests are passing locally for me now |
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.
Looks great! I have a ton of comments/questions, mainly around 1) how the heck some of this works and 2) maintainability (mainly around code duplication, I see this quickly becoming a point of regressions between run vs open mode).
PS I am so glad that 1px is gone, it was bothering me a lot, good to see we are in polish mode now.
The functionality works great. I'll wait for the suggested refactors to land before giving a final review. |
@marktnoonan can you re-ping me when this is ready to re-review? Thanks. |
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.
One last comment
Ok, updates have been made for @lmiller1990's feedback, ready for you @tbiethman :) |
|
||
return { | ||
autHeaderEl, | ||
} |
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.
We should consider building a full-on AutHeader component at some point (not this PR). There's enough shared logic now that is would clean up the header containers quite a bit, even if we have to disable most of the functionality in run mode.
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.
Agreed
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.
Try as I might, I can't break the new scaling logic 🎉 new test coverage looks good, lots of good reuse, no complaints from me
Let's ship it |
…e-config * 10.0-release: chore: Move component-index generation to scaffold-config package (#21090) fix: label text should be clickable to toggle snapshot highlight (#21122) feat: add next preset to webpack-dev-server-fresh (#21069) chore: add dev-servers as deps to server to be included in the binary (#21142) fix: do not highlight preExtension if selected option is renameFolder (#21121) fix(unify): Remove 'Reconfigure' dropdown from Testing Type chooser (#21063) feat(unify): launchpad header breadcrumbs and reusable tooltip component (#20648) test: add windows-test-kitchensink job (#20847) fix: aut centering and height calculation (#21019) chore: fix tests that fail on windows (#21055) fix: running a new test after already having run tests (#21087) fix: ct project setup framework keys for next and nuxt (#21116) fix: remove MountReturn from scaffolded ct support file (#21119) fix: do not scaffold fixtures if folder exist (#21078) fix: revert "fix: types for Cypress.Commands.add (#20376)" (#21104) chore: Update Chrome (stable) to 100.0.4896.127 and Chrome (beta) to 101.0.4951.34 (#21083) fix: types for Cypress.Commands.add (#20376) (#20377)
User facing changelog
cy.screenshot()
has been fixed.👆All of this brings us into parity with 9.x (though screenshots from CT in 9.x have a similar extra pixel on the left, I don't see any issues about this but still seems better to fix than to leave it wrong, especially since the extra border would now impact all screenshots including e2e).
Additional details
We were not initializing the Specs List and Reporter width values from saved preferences correctly when calculating the initial scale of the AUT. This meant we calculated the initial scale based on the default values for the reporter and specs lists sizes, even though the UI showed the correct actual size of the Reporter and Specs List. Setting those values from GQL in the store before initializing the style for the AUT fixes this.
Since I was I already in the scale math and was aware of UNIFY-1340, I added the fix for that as well, to get scaling 100% correct.
The "extra 1 px border on the left" screenshot issue doesn't have a ticket, but it caught my attention while dialing in the screenshot behavior. The screenshot behavior needed to be rechecked for this PR because changing the transform origin of the AUT and adding the left margin from 9.x would break many screenshot captures if we didn't make those changes go away during screenshotting.
Walking through the PR, these are the changes:
specsListWidthPreferences
andreporterWidthPreferences
before callinguseRunnerStyle()
to give us the initial scale. This was the source of both the "too large for window" and "not taking enough space" category of bugs.useRunnerStyle.ts
a little bit, it exports some values and accepts some params that we just not need any more.How has the user experience changed?
Old resizing behavior
Shows all three bugs - starting out scaled to small, header wrapping causing bottom of AUT to disappear, and starting out scaled too large, cutting off right side of AUT):
all.3.bugs.in.10.0-release.mov
New resizing behavior
Sows that all 3 bugs cannot be recreated in the same ways, full AUT iframe is always visible, and when scaled, the margins and centering are correct.
resizing.working.nicely.mov
Old vs new screenshots
No longer has that 1px border on the left.
9.x screenshots from its versions of the spec had the same extra pixel, caused by same issue of a border hanging around:
Testing
This PR adds percy snapshots for various sizes of the runner and confirms that we use the value from GQL for the initial scale calculation. These snapshots won't add value until #20604 is merged, since Cy-in-Cy tests do not render in Percy.
To manually test, follow the example in the videos. Resize the reporter to much larger or much smaller than the default. And refresh the page. Prior to this PR, scaling should start out wrong, after this PR scaling should start out correct.
PR Tasks
cypress-documentation
?type definitions
?cypress.schema.json
?