Skip to content

Commit

Permalink
Merge pull request #6830 from wordpress-mobile/add/highlight-color-e2e
Browse files Browse the repository at this point in the history
E2E Tests - Adds more Highlight color visual tests
  • Loading branch information
Gerardo Pacheco authored Apr 25, 2024
2 parents 4d2fc98 + db1a728 commit 2467d43
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -459,5 +459,55 @@ describe( 'Gutenberg Editor - Test Suite 1', () => {
screenshot = await takeScreenshotByElement( paragraphBlockElement );
expect( screenshot ).toMatchImageSnapshot();
} );

it( 'should set a shorthand hex highlight color', async () => {
await editorPage.initializeEditor( {
rawFeatures:
'{"color":{"background":true,"custom":true,"palette":{"theme":[{"color":"#6a8cd0","name":"Base","slug":"base"},{"color":"#000","name":"Tertiary","slug":"tertiary"}]},"text":true}}',
rawStyles:
'{"color":{"background":"var(--wp--preset--color--base)","text":"var(--wp--preset--color--tertiary)"}}',
} );

const defaultBlockAppenderElement =
await editorPage.getDefaultBlockAppenderElement();
await defaultBlockAppenderElement.click();
const toolbar = await editorPage.getToolbar();

await editorPage.toggleHighlightColor( 'Tertiary' );

await editorPage.typeKeyString( 'Hey ' );

screenshot = await takeScreenshotByElement(
await toolbar.$( '~Text color' ),
{ padding: -5 }
);
expect( screenshot ).toMatchImageSnapshot();

const paragraphBlockElement = await editorPage.getBlockAtPosition(
blockNames.paragraph
);

await editorPage.dismissKeyboard();
await editorPage.driver.waitUntil( async function () {
return ! ( await editorPage.driver.isKeyboardShown() );
} );

screenshot = await takeScreenshotByElement( paragraphBlockElement );
expect( screenshot ).toMatchImageSnapshot();
} );

it( 'should render a mark tag with shorthand hex highlight color', async () => {
await editorPage.initializeEditor( {
initialData: `<!-- wp:paragraph -->
<p><mark style="background-color:rgba(0,0,0,0);color:#000" class="has-inline-color has-black-color">Hey</mark></p>
<!-- /wp:paragraph -->`,
} );

const paragraphBlockElement = await editorPage.getBlockAtPosition(
blockNames.paragraph
);
screenshot = await takeScreenshotByElement( paragraphBlockElement );
expect( screenshot ).toMatchImageSnapshot();
} );
} );
} );
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.
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.
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.

0 comments on commit 2467d43

Please sign in to comment.