Skip to content

Commit

Permalink
Merge trunk and update Gutenberg ref
Browse files Browse the repository at this point in the history
  • Loading branch information
derekblank committed Aug 14, 2023
2 parents 910fff0 + db879e1 commit 8384aa7
Show file tree
Hide file tree
Showing 9 changed files with 67 additions and 205 deletions.
12 changes: 0 additions & 12 deletions __device-tests__/gutenberg-editor-contact-info.test.js

This file was deleted.

9 changes: 4 additions & 5 deletions __device-tests__/gutenberg-editor-gallery-visual.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,19 @@ import { takeScreenshot } from './utils';

describe( 'Gutenberg Editor Visual test for Gallery Block', () => {
it( 'should be able to render the placeholder correctly', async () => {
await editorPage.initializeEditor();
await editorPage.addNewBlock( blockNames.gallery );
await editorPage.closePicker();

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

await editorPage.removeBlock();
} );

it( 'should be able to render a gallery correctly', async () => {
await editorPage.setHtmlContent(
[ e2eTestData.galleryBlock ].join( '\n\n' )
);
await editorPage.initializeEditor( {
initialData: [ e2eTestData.galleryBlock ].join( '\n\n' ),
} );
const galleryBlock = await editorPage.getBlockAtPosition(
blockNames.gallery
);
Expand Down
1 change: 1 addition & 0 deletions __device-tests__/gutenberg-editor-group-visual.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { takeScreenshot } from './utils';

describe( 'Gutenberg Editor Visual test for Group Block', () => {
it( 'should show the empty placeholder for the unselected state', async () => {
await editorPage.initializeEditor();
await editorPage.addNewBlock( blockNames.group );

// Select title to unfocus the block
Expand Down
30 changes: 6 additions & 24 deletions __device-tests__/[email protected]
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* Internal dependencies
*/
const { blockNames } = editorPage;
const { toggleOrientation, swipeUp } = e2eUtils;
import { takeScreenshot } from './utils';
import {
Expand All @@ -11,7 +10,9 @@ import {

describe( 'Gutenberg Editor iPad Visual test for Horizontal layouts', () => {
it( 'should show the right columns placeholders and alignments case 1', async () => {
await editorPage.setHtmlContent( NESTED_COLUMNS_CASE_1 );
await editorPage.initializeEditor( {
initialData: NESTED_COLUMNS_CASE_1,
} );

// Wait for images to load
await editorPage.driver.sleep( 4000 );
Expand Down Expand Up @@ -46,31 +47,12 @@ describe( 'Gutenberg Editor iPad Visual test for Horizontal layouts', () => {
await toggleOrientation( editorPage.driver );
// Wait for the device to finish rotating
await editorPage.driver.sleep( 3000 );

// Remvoe blocks
const coverBlock = await editorPage.getBlockAtPosition(
blockNames.cover
);
await coverBlock.click();

await editorPage.moveBlockSelectionUp();

await editorPage.removeBlock();

for ( let i = 3; i > 0; i-- ) {
const columnsBlock = await editorPage.getBlockAtPosition(
blockNames.columns
);
await columnsBlock.click();

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

await editorPage.removeBlock();
}
} );

it( 'should show the right columns placeholders and alignments case 2', async () => {
await editorPage.setHtmlContent( NESTED_COLUMNS_CASE_2 );
await editorPage.initializeEditor( {
initialData: NESTED_COLUMNS_CASE_2,
} );

// Wait for images to load
await editorPage.driver.sleep( 4000 );
Expand Down
56 changes: 9 additions & 47 deletions __device-tests__/gutenberg-editor-sanity-test-1-visual.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,7 @@
*/
const { blockNames } = editorPage;
import { takeScreenshot } from './utils';
const {
toggleOrientation,
isAndroid,
swipeFromTo,
toggleDarkMode,
isEditorVisible,
} = e2eUtils;
const { toggleOrientation, isAndroid, swipeFromTo, toggleDarkMode } = e2eUtils;
import { NESTED_COLUMNS_3_LEVELS } from './test-editor-data';

const ANDROID_COLUMN_APPENDER_BUTTON_XPATH =
Expand All @@ -18,6 +12,7 @@ const ANDROID_COLUMN_APPENDER_BUTTON_XPATH =
describe( 'Gutenberg Editor - Test Suite 1', () => {
describe( 'Columns block', () => {
it( 'displays placeholders when unselected', async () => {
await editorPage.initializeEditor();
await editorPage.addNewBlock( blockNames.columns );
// Wait for the modal to open
await editorPage.driver.sleep( 3000 );
Expand Down Expand Up @@ -45,17 +40,10 @@ describe( 'Gutenberg Editor - Test Suite 1', () => {
await toggleOrientation( editorPage.driver );
// Wait for the device to finish rotating
await editorPage.driver.sleep( 3000 );
const columnsBlock = await editorPage.getBlockAtPosition(
blockNames.columns
);
await columnsBlock.click();

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

await editorPage.removeBlock();
} );

it( 'displays correctly in portrait and landscape orientations', async () => {
await editorPage.initializeEditor();
await editorPage.addNewBlock( blockNames.columns );
// Wait for the modal to open
await editorPage.driver.sleep( 3000 );
Expand Down Expand Up @@ -109,10 +97,10 @@ describe( 'Gutenberg Editor - Test Suite 1', () => {
await toggleOrientation( editorPage.driver );
// Wait for the device to finish rotating
await editorPage.driver.sleep( 3000 );
await editorPage.removeBlock();
} );

it( 'mover buttons display in the correct positions', async () => {
await editorPage.initializeEditor();
await editorPage.addNewBlock( blockNames.columns );
// Wait for the modal to open
await editorPage.driver.sleep( 3000 );
Expand Down Expand Up @@ -164,20 +152,11 @@ describe( 'Gutenberg Editor - Test Suite 1', () => {
await toggleOrientation( editorPage.driver );
// Wait for the device to finish rotating
await editorPage.driver.sleep( 3000 );
// Navigate upwards in block hierarchy
await editorPage.moveBlockSelectionUp();
await editorPage.driver.sleep( 1000 );
await editorPage.removeBlock();
} );

it( 'displays with correct colors with dark mode enabled', async () => {
await toggleDarkMode( editorPage.driver, true );

// The Android editor requires a restart to apply dark mode
if ( isAndroid() ) {
await editorPage.driver.resetApp();
await isEditorVisible( editorPage.driver );
}
await editorPage.initializeEditor();

await editorPage.addNewBlock( blockNames.columns );
// Wait for the modal to open
Expand Down Expand Up @@ -236,17 +215,11 @@ describe( 'Gutenberg Editor - Test Suite 1', () => {
screenshot = await takeScreenshot();
expect( screenshot ).toMatchImageSnapshot();

await editorPage.removeBlock();
await toggleDarkMode( editorPage.driver, false );

// The Android editor requires a restart to apply dark mode
if ( isAndroid() ) {
await editorPage.driver.resetApp();
await isEditorVisible( editorPage.driver );
}
} );

it( 'sliders display proportionate fill level previews', async () => {
await editorPage.initializeEditor();
await editorPage.addNewBlock( blockNames.columns );
// Wait for the modal to open
await editorPage.driver.sleep( 3000 );
Expand Down Expand Up @@ -297,30 +270,19 @@ describe( 'Gutenberg Editor - Test Suite 1', () => {
// Visual test check for adjusted columns
const screenshot = await takeScreenshot();
expect( screenshot ).toMatchImageSnapshot();

await editorPage.dismissBottomSheet();
await editorPage.removeBlock();
} );

it( 'allows deep nesting to at least 3 levels', async () => {
await editorPage.setHtmlContent( NESTED_COLUMNS_3_LEVELS );
await editorPage.initializeEditor( {
initialData: 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

0 comments on commit 8384aa7

Please sign in to comment.