-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reorganize e2e tests folders and files (#36734)
Co-authored-by: ntsekouras <ntsekouras@outlook.com>
- Loading branch information
1 parent
ebff4e2
commit 3adf577
Showing
19 changed files
with
50 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
39 changes: 39 additions & 0 deletions
39
packages/e2e-tests/specs/experiments/experimental-features.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { addQueryArgs } from '@wordpress/url'; | ||
import { visitAdminPage } from '@wordpress/e2e-test-utils'; | ||
|
||
async function setExperimentalFeaturesState( features, enable ) { | ||
const query = addQueryArgs( '', { | ||
page: 'gutenberg-experiments', | ||
} ); | ||
await visitAdminPage( '/admin.php', query ); | ||
|
||
await Promise.all( | ||
features.map( async ( feature ) => { | ||
await page.waitForSelector( feature ); | ||
const checkedSelector = `${ feature }[checked=checked]`; | ||
const isChecked = !! ( await page.$( checkedSelector ) ); | ||
if ( ( ! isChecked && enable ) || ( isChecked && ! enable ) ) { | ||
await page.click( feature ); | ||
} | ||
} ) | ||
); | ||
await Promise.all( [ | ||
page.waitForNavigation( { waitUntil: 'networkidle0' } ), | ||
page.click( '#submit' ), | ||
] ); | ||
} | ||
|
||
/** | ||
* Establishes test lifecycle to enable experimental feature for the duration of | ||
* the grouped test block. | ||
* | ||
* @param {Array} features Array of {string} selectors of settings to enable. | ||
* Assumes they can be enabled with one click. | ||
*/ | ||
export function useExperimentalFeatures( features ) { | ||
beforeAll( () => setExperimentalFeaturesState( features, true ) ); | ||
afterAll( () => setExperimentalFeaturesState( features, false ) ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters