-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[RNMobile] Add block insertion flow e2e test (#27381)
Co-authored-by: Cameron Voell <[email protected]>
- Loading branch information
1 parent
b3620b5
commit efbee9f
Showing
10 changed files
with
168 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
135 changes: 135 additions & 0 deletions
135
packages/react-native-editor/__device-tests__/gutenberg-editor-block-insertion-2.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import { blockNames } from './pages/editor-page'; | ||
|
||
describe( 'Gutenberg Editor tests for Block insertion 2', () => { | ||
it( 'adds new block at the end of post', async () => { | ||
await editorPage.addNewBlock( blockNames.heading ); | ||
|
||
await editorPage.addNewBlock( blockNames.list ); | ||
|
||
const expectedHtml = `<!-- wp:heading --> | ||
<h2></h2> | ||
<!-- /wp:heading --> | ||
<!-- wp:list --> | ||
<ul><li></li></ul> | ||
<!-- /wp:list -->`; | ||
|
||
const html = await editorPage.getHtmlContent(); | ||
expect( html.toLowerCase() ).toBe( expectedHtml ); | ||
} ); | ||
|
||
it( 'inserts between 2 existing blocks', async () => { | ||
const headingBlockElement = await editorPage.getBlockAtPosition( | ||
blockNames.heading | ||
); | ||
|
||
await headingBlockElement.click(); | ||
|
||
await editorPage.addNewBlock( blockNames.separator ); | ||
|
||
const expectedHtml = `<!-- wp:heading --> | ||
<h2></h2> | ||
<!-- /wp:heading --> | ||
<!-- wp:separator --> | ||
<hr class="wp-block-separator"/> | ||
<!-- /wp:separator --> | ||
<!-- wp:list --> | ||
<ul><li></li></ul> | ||
<!-- /wp:list -->`; | ||
|
||
const html = await editorPage.getHtmlContent(); | ||
expect( html.toLowerCase() ).toBe( expectedHtml ); | ||
} ); | ||
|
||
it( 'inserts block before selected block', async () => { | ||
const separatorBlockElement = await editorPage.getBlockAtPosition( | ||
blockNames.separator, | ||
2 | ||
); | ||
await separatorBlockElement.click(); | ||
|
||
await editorPage.addNewBlock( blockNames.image, 'before' ); | ||
|
||
const expectedHtml = `<!-- wp:heading --> | ||
<h2></h2> | ||
<!-- /wp:heading --> | ||
<!-- wp:image --> | ||
<figure class="wp-block-image"><img alt=""/></figure> | ||
<!-- /wp:image --> | ||
<!-- wp:separator --> | ||
<hr class="wp-block-separator"/> | ||
<!-- /wp:separator --> | ||
<!-- wp:list --> | ||
<ul><li></li></ul> | ||
<!-- /wp:list -->`; | ||
|
||
const html = await editorPage.getHtmlContent(); | ||
expect( html.toLowerCase() ).toBe( expectedHtml ); | ||
} ); | ||
|
||
it( 'inserts block at the end of post when no block is selected', async () => { | ||
await editorPage.addNewBlock( blockNames.more ); | ||
|
||
const expectedHtml = `<!-- wp:heading --> | ||
<h2></h2> | ||
<!-- /wp:heading --> | ||
<!-- wp:image --> | ||
<figure class="wp-block-image"><img alt=""/></figure> | ||
<!-- /wp:image --> | ||
<!-- wp:separator --> | ||
<hr class="wp-block-separator"/> | ||
<!-- /wp:separator --> | ||
<!-- wp:list --> | ||
<ul><li></li></ul> | ||
<!-- /wp:list --> | ||
<!-- wp:more --> | ||
<!--more--> | ||
<!-- /wp:more -->`; | ||
|
||
const html = await editorPage.getHtmlContent(); | ||
expect( html.toLowerCase() ).toBe( expectedHtml ); | ||
} ); | ||
|
||
it( 'creates a new Paragraph block tapping on the empty area below the last block', async () => { | ||
await editorPage.addParagraphBlockByTappingEmptyAreaBelowLastBlock(); | ||
|
||
const expectedHtml = `<!-- wp:heading --> | ||
<h2></h2> | ||
<!-- /wp:heading --> | ||
<!-- wp:image --> | ||
<figure class="wp-block-image"><img alt=""/></figure> | ||
<!-- /wp:image --> | ||
<!-- wp:separator --> | ||
<hr class="wp-block-separator"/> | ||
<!-- /wp:separator --> | ||
<!-- wp:list --> | ||
<ul><li></li></ul> | ||
<!-- /wp:list --> | ||
<!-- wp:more --> | ||
<!--more--> | ||
<!-- /wp:more --> | ||
<!-- wp:paragraph --> | ||
<p></p> | ||
<!-- /wp:paragraph -->`; | ||
|
||
const html = await editorPage.getHtmlContent(); | ||
expect( html.toLowerCase() ).toBe( expectedHtml ); | ||
} ); | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters