Skip to content

Commit

Permalink
Move request utils to global setup
Browse files Browse the repository at this point in the history
  • Loading branch information
swissspidy committed Jul 7, 2023
1 parent 667fa36 commit 42cefe4
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

0 comments on commit 42cefe4

Please sign in to comment.