-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add setGutenbergExperiments util * Use it in one of the tests * Fix test
- Loading branch information
1 parent
464961e
commit 46daa6e
Showing
4 changed files
with
46 additions
and
27 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
packages/e2e-test-utils-playwright/src/request-utils/gutenberg-experiments.ts
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,40 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import type { RequestUtils } from './index'; | ||
|
||
/** | ||
* Sets the Gutenberg experiments. | ||
* | ||
* @param this | ||
* @param experiments Array of experimental flags to enable. Pass in an empty array to disable all experiments. | ||
*/ | ||
async function setGutenbergExperiments( | ||
this: RequestUtils, | ||
experiments: string[] | ||
) { | ||
const response = await this.request.get( | ||
'/wp-admin/admin.php?page=gutenberg-experiments' | ||
); | ||
const html = await response.text(); | ||
const nonce = html.match( /name="_wpnonce" value="([^"]+)"/ )![ 1 ]; | ||
|
||
await this.request.post( '/wp-admin/options.php', { | ||
form: { | ||
option_page: 'gutenberg-experiments', | ||
action: 'update', | ||
_wpnonce: nonce, | ||
_wp_http_referer: '/wp-admin/admin.php?page=gutenberg-experiments', | ||
...Object.fromEntries( | ||
experiments.map( ( experiment ) => [ | ||
`gutenberg-experiments[${ experiment }]`, | ||
1, | ||
] ) | ||
), | ||
submit: 'Save Changes', | ||
}, | ||
failOnStatusCode: true, | ||
} ); | ||
} | ||
|
||
export { setGutenbergExperiments }; |
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 was deleted.
Oops, something went wrong.
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
46daa6e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Flaky tests detected in 46daa6e.
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/7537962161
📝 Reported issues:
/test/e2e/specs/editor/various/autocomplete-and-mentions.spec.js