Skip to content

Commit

Permalink
Update Unsupported block tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerardo committed Jun 6, 2024
1 parent ffe0d8d commit 558f27b
Show file tree
Hide file tree
Showing 11 changed files with 9 additions and 30 deletions.
39 changes: 9 additions & 30 deletions __device-tests__/gutenberg-editor-unsupported-block-visual.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Internal dependencies
*/
const { isAndroid, toggleDarkMode } = e2eUtils;
import { takeScreenshot } from './utils';
import { takeScreenshot, takeScreenshotByElement } from './utils';

describe( 'Gutenberg Editor Visual test for Unsupported Block', () => {
it( 'should show the empty placeholder for the selected/unselected state', async () => {
Expand All @@ -13,22 +13,11 @@ describe( 'Gutenberg Editor Visual test for Unsupported Block', () => {
const unsupportedBlock = await editorPage.getBlockAtPosition(
editorPage.blockNames.unsupported
);
await unsupportedBlock.click();
// Wait for the block to be selected
await editorPage.driver.pause( 500 );

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

// Select title to unfocus the block
const titleElement = await editorPage.getTitleElement();
await titleElement.click();

await editorPage.dismissKeyboard();

// Visual test check
screenshot = await takeScreenshot();
const screenshot = await takeScreenshotByElement( unsupportedBlock, {
padding: 7,
} );
expect( screenshot ).toMatchImageSnapshot();
} );

Expand All @@ -42,28 +31,18 @@ describe( 'Gutenberg Editor Visual test for Unsupported Block', () => {
const unsupportedBlock = await editorPage.getBlockAtPosition(
editorPage.blockNames.unsupported
);
await unsupportedBlock.click();
// Wait for the block to be selected
await editorPage.driver.pause( 1000 );

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

// Select title to unfocus the block
const titleElement = await editorPage.getTitleElement();
await titleElement.click();

await editorPage.dismissKeyboard();

// Visual test check
screenshot = await takeScreenshot();
const screenshot = await takeScreenshotByElement( unsupportedBlock, {
padding: 7,
} );
expect( screenshot ).toMatchImageSnapshot();

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

it( 'should be able to open the unsupported block web view editor', async () => {
// Disabled temporarily
it.skip( 'should be able to open the unsupported block web view editor', async () => {
await editorPage.initializeEditor( {
initialData: e2eTestData.unsupportedBlockHtml,
} );
Expand Down
Binary file not shown.
Binary file not shown.
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.
Binary file not shown.
Binary file not shown.
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.
Binary file not shown.
Binary file not shown.

0 comments on commit 558f27b

Please sign in to comment.