Skip to content

Commit

Permalink
Fix outdated playwright snapshot directory (#40422)
Browse files Browse the repository at this point in the history
* Revert "Revert "Move Playwright snapshots into the same local folder (#40336)" (#40412)"

This reverts commit 33a5d51.

* Fix outdated snapshot directory
  • Loading branch information
kevin940726 committed Apr 18, 2022
1 parent fad579f commit d6387d7
Show file tree
Hide file tree
Showing 27 changed files with 13 additions and 5 deletions.
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 @@ -68,7 +68,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
Empty file.

0 comments on commit d6387d7

Please sign in to comment.