-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
E2e testing: Add test for empty blocks with enter
and backspace
handling
#5515
Conversation
…-reducer-deterministic Revert "Make preferences reducer deterministic"
* Position warnings near top * Restrict max height of blocks with warnings, fade * Ignore swap files * Rewrite translate as translateX * Don't ignore swap files
It looks like this PR includes changes introduced by @noisysocks. I also see a commit from @aduth in here. It might just need another rebase. |
Yeah I thought everything was up to date, but might not have done it quite right. I'll try rebasing again. |
You can also try to squash your commits while doing rebase :) |
cy.newPost(); | ||
} ); | ||
|
||
it( 'Should split and merge paragraph blocks using Enter and Backspace', () => { |
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.
This test looks like it is testing if enter
creates a new paragraph and backspace
removes an empty paragraph. Am I missing something?
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 had assumed this was the same functionality that's behind splitting and merging. I was trying to type in the blocks first, but Cypress is absolutely awful when it comes to moving cursors while typing. I will gladly spend some more time trying to add some text in order to make sure it is also splitting and merging text correctly.
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.
Yes, Cypress has some improvements queued in their pipeline. See #4089 and cypress-io/cypress#1108.
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 know what you meant. When there is a paragraph with text and you type enter
in the middle. Then move the cursor to the start of next paragraph and type backspace
. Yes, this is splitting and merging. I think it is specific to the paragraph and a few text-like blocks like heading or list.
Let's rename to 005-splitting-merging-blocks.js
and add some text inside the blocks.
enter
and backspace
handling
@@ -0,0 +1,24 @@ | |||
describe( 'Splitting and merging paragraph blocks', () => { |
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.
It seems like it could be part of the existing test suite: https://github.com/twsp/gutenberg/blob/0f4035b0b266390f9e8facc05037175180dceb67/test/e2e/integration/002-adding-blocks.js
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'm going to work a little more on this and then submit another pull request. Should I keep the testing of splitting/merging in a separate file, or add it onto 002-adding-blocks.js?
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 think it fits the existing test file, so you can put it there 👍 - see my other comment :)
Description
Added 005-splitting-merging-paragraph-blocks.js, which does an e2e test to ensure that, in regards to paragraph blocks, pressing Enter splits blocks and pressing Backspace merges blocks.
How Has This Been Tested?
I tested my script using Cypress and a version of Gutenberg running on my localhost. To test, I ran "npm run test-e2e:watch" and used the Cypress UI to run the e2e test. I compared Cypress's results to the results from when I manually split and merged paragraph blocks using Enter and Backspace, and they were the same.
This change does not affect any other areas of the project.
Screenshots (jpeg or gifs if applicable):
Types of changes
This is a non-breaking change that adds another e2e test of basic functionality.
Checklist: