Skip to content

Commit

Permalink
Move request utils reset to global setup (#52412)
Browse files Browse the repository at this point in the history
  • Loading branch information
swissspidy committed Jul 13, 2023
1 parent 306c6e3 commit 0d00717
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 12 deletions.
12 changes: 0 additions & 12 deletions packages/e2e-test-utils-playwright/src/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,18 +136,6 @@ const test = base.extend<
storageStatePath: STORAGE_STATE_PATH,
} );

await Promise.all( [
requestUtils.activateTheme( 'twentytwentyone' ),
// Disable this test plugin as it's conflicting with some of the tests.
// We already have reduced motion enabled and Playwright will wait for most of the animations anyway.
requestUtils.deactivatePlugin(
'gutenberg-test-plugin-disables-the-css-animations'
),
requestUtils.deleteAllPosts(),
requestUtils.deleteAllBlocks(),
requestUtils.resetPreferences(),
] );

await use( requestUtils );
},
{ scope: 'worker', auto: true },
Expand Down
13 changes: 13 additions & 0 deletions test/e2e/config/global-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,19 @@ async function globalSetup( config: FullConfig ) {
// Authenticate and save the storageState to disk.
await requestUtils.setupRest();

// Reset the test environment before running the tests.
await Promise.all( [
requestUtils.activateTheme( 'twentytwentyone' ),
// Disable this test plugin as it's conflicting with some of the tests.
// We already have reduced motion enabled and Playwright will wait for most of the animations anyway.
requestUtils.deactivatePlugin(
'gutenberg-test-plugin-disables-the-css-animations'
),
requestUtils.deleteAllPosts(),
requestUtils.deleteAllBlocks(),
requestUtils.resetPreferences(),
] );

await requestContext.dispose();
}

Expand Down
13 changes: 13 additions & 0 deletions test/performance/config/global-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,19 @@ async function globalSetup( config: FullConfig ) {
// Authenticate and save the storageState to disk.
await requestUtils.setupRest();

// Reset the test environment before running the tests.
await Promise.all( [
requestUtils.activateTheme( 'twentytwentyone' ),
// Disable this test plugin as it's conflicting with some of the tests.
// We already have reduced motion enabled and Playwright will wait for most of the animations anyway.
requestUtils.deactivatePlugin(
'gutenberg-test-plugin-disables-the-css-animations'
),
requestUtils.deleteAllPosts(),
requestUtils.deleteAllBlocks(),
requestUtils.resetPreferences(),
] );

await requestContext.dispose();
}

Expand Down

1 comment on commit 0d00717

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in 0d00717.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5547134060
📝 Reported issues:

Please sign in to comment.