Skip to content

Commit

Permalink
Merge pull request #5815 from wordpress-mobile/add/more-visual-tests
Browse files Browse the repository at this point in the history
Visual tests - Adds testing nesting multiple Columns blocks
  • Loading branch information
Gerardo Pacheco authored May 30, 2023
2 parents c03f6f5 + cc1d539 commit 90d0683
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 1 deletion.
22 changes: 22 additions & 0 deletions __device-tests__/gutenberg-editor-sanity-test-1-visual.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const {
toggleDarkMode,
isEditorVisible,
} = e2eUtils;
import { NESTED_COLUMNS_3_LEVELS } from './test-editor-data';

describe( 'Gutenberg Editor - Test Suite 1', () => {
describe( 'Columns block', () => {
Expand Down Expand Up @@ -296,5 +297,26 @@ describe( 'Gutenberg Editor - Test Suite 1', () => {
await editorPage.dismissBottomSheet();
await editorPage.removeBlock();
} );

it( 'allows deep nesting to at least 3 levels', async () => {
await editorPage.setHtmlContent( NESTED_COLUMNS_3_LEVELS );

// Wait for the block to be rendered
await editorPage.driver.sleep( 3000 );

// Visual test check
const screenshot = await takeScreenshot();
expect( screenshot ).toMatchImageSnapshot();

// Remove block
const columnsBlock = await editorPage.getBlockAtPosition(
blockNames.columns
);
await columnsBlock.click();

await editorPage.moveBlockSelectionUp( { toRoot: true } );

await editorPage.removeBlock();
} );
} );
} );
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions __device-tests__/test-editor-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -721,3 +721,37 @@ export const NESTED_COLUMNS_CASE_2 = `<!-- wp:separator -->
<!-- /wp:paragraph --></div></div>
<!-- /wp:cover --></div></div>
<!-- /wp:cover -->`;

export const NESTED_COLUMNS_3_LEVELS = `<!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column {"width":"50%"} -->
<div class="wp-block-column" style="flex-basis:50%"><!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column {"width":"50%"} -->
<div class="wp-block-column" style="flex-basis:50%"><!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column {"width":"50%"} -->
<div class="wp-block-column" style="flex-basis:50%"><!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column {"width":"50%"} -->
<div class="wp-block-column" style="flex-basis:50%"></div>
<!-- /wp:column -->
<!-- wp:column {"width":"50%"} -->
<div class="wp-block-column" style="flex-basis:50%"></div>
<!-- /wp:column --></div>
<!-- /wp:columns --></div>
<!-- /wp:column -->
<!-- wp:column {"width":"50%"} -->
<div class="wp-block-column" style="flex-basis:50%"></div>
<!-- /wp:column --></div>
<!-- /wp:columns --></div>
<!-- /wp:column -->
<!-- wp:column {"width":"50%"} -->
<div class="wp-block-column" style="flex-basis:50%"></div>
<!-- /wp:column --></div>
<!-- /wp:columns --></div>
<!-- /wp:column -->
<!-- wp:column {"width":"50%"} -->
<div class="wp-block-column" style="flex-basis:50%"></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->`;
2 changes: 1 addition & 1 deletion gutenberg
Submodule gutenberg updated 166 files

0 comments on commit 90d0683

Please sign in to comment.