-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
feat(parallax): add e2e tests #1542
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 8285e3a:
|
I was researching which screenshot plugin to use and I came across cypress-io/cypress#9443. This could make for flaky tests because For now, we can just stick with the direction we have and keep an eye on that issue and implement screenshots when it's fixed. |
Hey, Sorry I missed the above comments in the main entry from your edits. Responses below:
I think that would be good, we could edit I think your test approach is a good idea, the translate value is the numerical source of truth here, but appreciate it might not always be accurate the dom being fickle. So adding snapshots sounds like a great idea. We should also make sure we add variation to the horizontal and vertical, to test things like Good catch on the issue in |
I've added snapshots and a script to the root Each Are there any other variations you can think of that would be nice to test for? |
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.
Tests look great! Just some thoughts around file structure that i've had, what do you think?
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.
Genuinely 👏🏼 amazing 👏🏼 work 👏🏼 thank you so much.
thanks! and no problem! |
Why
Draft of adding tests to eventually close #1474.
What
This adds several things:
vite
, similar to the sandboxescypress
and@testing-library/cypress
parallax.spec.js
And also
package.json
scripts fordev
andtest
. Everything new is insidepackages/parallax
.Checklist
Notes
CI
cypress
requires a dev server to run tests. This can be manually done with two terminals open -- one for dev and one forcypress
. But there's also start-server-and-test which would allow us to add it to therelease
pipeline (or at the very least, make things easier for contributors). I don't know how important that is, but it might be a nice-to-have? (Related -- should I add a script topackage.json
in the root folder to be able to run these tests from there as well?)Actual tests
Currently, there are two main tests -- one each for a vertical and horizontal parallax app. In trying to make them actually E2E they just scroll/click and then check that everything is where it should be (by comparing their
transform: translate3d
values to what I know they should be, etc). But, after discovering the bug that lead to #1530 it seems that might not suffice (i.e. I think these tests might have passed even without that bugfix). Because of that I think it might be a good idea to add snapshot tests as well (but I still think testing thetranslate
values is beneficial). I just wanted to get some general input before adding/removing more stuff.Let me know if I'm totally off-base with anything, this is my first time attempting E2E tests (or really anything besides unit tests 😅).