Skip to content
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

Closed
wants to merge 21 commits into from

Conversation

twsp
Copy link
Contributor

@twsp twsp commented Mar 8, 2018

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):

e2e-1

Types of changes

This is a non-breaking change that adds another e2e test of basic functionality.

Checklist:

  • [X ] My code is tested.
  • [ X] My code follows the WordPress code style.
  • [ X] My code has proper inline documentation.

@gziolo gziolo requested a review from noisysocks March 9, 2018 06:07
@gziolo gziolo added the [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. label Mar 9, 2018
@gziolo
Copy link
Member

gziolo commented Mar 9, 2018

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.

@gziolo gziolo requested a review from aduth March 9, 2018 06:10
@twsp
Copy link
Contributor Author

twsp commented Mar 9, 2018

Yeah I thought everything was up to date, but might not have done it quite right. I'll try rebasing again.

@gziolo
Copy link
Member

gziolo commented Mar 9, 2018

You can also try to squash your commits while doing rebase :)

cy.newPost();
} );

it( 'Should split and merge paragraph blocks using Enter and Backspace', () => {
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Member

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.

@gziolo gziolo changed the title E2e testing E2e testing: Add test for empty blocks with enter and backspace handling Mar 9, 2018
@@ -0,0 +1,24 @@
describe( 'Splitting and merging paragraph blocks', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

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?

Copy link
Member

@gziolo gziolo Mar 9, 2018

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 :)

@twsp twsp closed this Mar 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants