Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move Playwright snapshots into the same local folder #40336

Merged
merged 2 commits into from
Apr 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions packages/e2e-test-utils-playwright/src/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ function observeConsoleLogging( message: ConsoleMessage ) {
const test = base.extend<
{
pageUtils: PageUtils;
snapshotSuffix: void;
snapshotConfig: void;
},
{
requestUtils: RequestUtils;
Expand Down Expand Up @@ -137,11 +137,19 @@ const test = base.extend<
},
{ scope: 'worker' },
],
// A work-around automatic fixture to remove the default snapshot suffix.
// See https://github.com/microsoft/playwright/issues/11134
snapshotSuffix: [
// An automatic fixture to configure snapshot settings globally.
snapshotConfig: [
async ( {}, use, testInfo ) => {
// A work-around to remove the default snapshot suffix.
// See https://github.com/microsoft/playwright/issues/11134
testInfo.snapshotSuffix = '';
// Normalize snapshots into the same `__snapshots__` folder to minimize
// the file name length on Windows.
// See https://github.com/WordPress/gutenberg/issues/40291
testInfo.snapshotDir = path.join(
path.dirname( testInfo.file ),
'__snapshots__'
);

await use();
},
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/specs/editor/various/copy-cut-paste.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ test.describe( 'Copy/cut/paste', () => {
await pageUtils.insertBlock( { name: 'core/spacer' } );
// At this point the spacer wrapper should be focused.
await pageUtils.pressKeyWithModifier( 'primary', 'x' );
expect( await pageUtils.getEditedPostContent() ).toMatchSnapshot();
expect( await pageUtils.getEditedPostContent() ).toBe( '' );

// The block appender is only visible when there's no selection.
await page.evaluate( () => {
Expand Down