-
Notifications
You must be signed in to change notification settings - Fork 4.5k
e2e test: verify that user can type right after inserting the quote block #40466
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
Conversation
Size Change: 0 B Total Size: 1.23 MB ℹ️ View Unchanged
|
It depends on the test. If the test is about inserting blocks and ensuring users could type right after inserting them, then yes, absolutely. However, if the test is about switching to the plain style of the quote block, which is what this test is about, then I think we're allowed to use some shortcuts. The same applies to the purpose of those REST helpers to clear/set states between tests. Ideally, we would want to do what end users do in our tests, but often that's too slow and sometimes flaky. To prevent testing the same thing over and over again, we create some shortcuts/mocks to do them in a much faster way. It's covered in the best practices of the documentation. Unless I misunderstood what this test is about, I think we should test the abovementioned behavior in another test, specifically for this kind of interaction. WDYT? (Additionally, the new |
Thanks for the explanation. Though I'm now a bit more confused 😅 Sorry if I'm missing context, I don't have tons of experience with the way e2e tests are set up. I guess my core question is: doesn't using different code paths than a user would defeats the purpose of the e2e tests? How e2e tests built this way are different than unit tests? |
I'm happy to add more specific tests, but for the kind of flow I wanted to test (focus, typing, etc, what we had before) I'd need to make sure that we're actually using the user code paths (the inserter, etc). Have looked around but don't find a way to do that, is there any? I guess I'd need to write a new utility that actually uses the inserter? |
I agree with @kevin940726 on principle but I don't think a migration should not change how tests work unless we also cover the part that was changed.
This for me is very problematic. I'd have preferred personally to avoid changing any behavior for the migration itself, and having dedicated PRs to change the behavior because that way we can think clearly about the impact and don't miss anything while migrating. For this PR, it's probably better to just add a new test covering the typing but I'm really concerned about the "change everything approach" we seem to be taking with the migration. |
test/e2e/specs/editor/various/quote-type-after-inserting.spec.js
Outdated
Show resolved
Hide resolved
It depends on what you want to test. I'm not good with words, so probably the documentation of Cypress and the referenced video there could explain it better 😅 .
Ideally, I totally agree with this. But in practice, this will probably slow down the migration process by a lot, and we'll not be using some of the benefits that Playwright brings until very late in the process.
IMO, code path coverage isn't what's important in e2e tests; rather, the coverage of what the test is about is more important. The migration process is never going to cover all existing coverage, there are always going to be some differences, and that's okay.
This is an option, but the fact that so many tests depend on IMO, we should focus on what we want to test, or else it's difficult for contributors to change any of the existing tests, and thus making the purpose of the tests blur and not readable to others. (Everything is important will make nothing important.) As you suggested before, deleting tests is a best practice, we shouldn't be afraid of removing exiting coverage if that's not even the part of the test itself. |
Good one :) |
What?
Introduces a new test for making sure an user can type after inserting a quote.
Why?
The original test was migrated to Playwright at #40216 In doing so, we changed some of the original behavior. This PR brings it back by adding a new test.
How?
Before the migration to Playwright, in adding a quote, we did so in two steps:
We did so because it reflects what an user would do, and also because these steps cover the following case: we wanted to make sure that users can type right after the block is inserted.
This was lost during the migration to Playwright, where we added the block with the contents directly.
Testing Instructions
Make sure e2e tests pass.