-
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
Changes from all commits
73392f5
1c03e20
80a19f8
d5aa10f
2e87e4c
08cff74
f9534bd
025d875
09cd0b1
a7d100f
6332d40
069eccd
f9a478f
e03fed6
2d6d57a
a9f9802
5fea1a8
8334e11
a207eaf
73993f8
0f4035b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
describe( 'Splitting and merging paragraph blocks', () => { | ||
before( () => { | ||
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 commentThe reason will be displayed to describe this comment to others. Learn more. This test looks like it is testing if There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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 commentThe 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 Let's rename to |
||
// Insert paragraph block and split using Enter | ||
cy.get( '.editor-default-block-appender' ).click(); | ||
cy.get( '.mce-content-body' ).type( '{enter}' ); | ||
|
||
// Assertion to check for two paragraph blocks | ||
cy.get( '.mce-content-body' ).should( ( $p ) => { | ||
expect( $p ).to.have.length( 2 ); | ||
} ); | ||
|
||
// Merge second paragraph block back into first using Backspace | ||
cy.get( '.mce-content-body:first' ).type( '{backspace}' ); | ||
|
||
// Assertion to check for one paragraph block | ||
cy.get( '.mce-content-body' ).should( ( $p ) => { | ||
expect( $p ).to.have.length( 1 ); | ||
} ); | ||
} ); | ||
} ); |
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 :)