-
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.
E2E Tests: Update Multi Entity Saving test to improve reliability (#3…
…7139) * Add docs * Add explanatory comment in the before/after all functions * Add changelog entry for e2e-test-utils
- Loading branch information
1 parent
9faa63e
commit 7129e1a
Showing
7 changed files
with
104 additions
and
45 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import { switchUserToAdmin } from './switch-user-to-admin'; | ||
import { visitAdminPage } from './visit-admin-page'; | ||
import { switchUserToTest } from './switch-user-to-test'; | ||
|
||
/** | ||
* Returns a site option, from the options admin page. | ||
* | ||
* @param {string} setting The option, used to get the option by id. | ||
* @return {string} The value of the option. | ||
*/ | ||
export async function getOption( setting ) { | ||
await switchUserToAdmin(); | ||
await visitAdminPage( 'options.php' ); | ||
|
||
const value = await page.$eval( | ||
`#${ setting }`, | ||
( element ) => element.value | ||
); | ||
await switchUserToTest(); | ||
return value; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import { switchUserToAdmin } from './switch-user-to-admin'; | ||
import { visitAdminPage } from './visit-admin-page'; | ||
import { switchUserToTest } from './switch-user-to-test'; | ||
import { pressKeyWithModifier } from './press-key-with-modifier'; | ||
|
||
/** | ||
* Sets a site option, from the options-general admin page. | ||
* | ||
* @param {string} setting The option, used to get the option by id. | ||
* @param {string} value The value to set the option to. | ||
*/ | ||
export async function setOption( setting, value ) { | ||
await switchUserToAdmin(); | ||
await visitAdminPage( 'options-general.php' ); | ||
|
||
await page.focus( `#${ setting }` ); | ||
await pressKeyWithModifier( 'primary', 'a' ); | ||
await page.type( `#${ setting }`, value ); | ||
|
||
await Promise.all( [ | ||
page.click( '#submit' ), | ||
page.waitForNavigation( { waitUntil: 'networkidle0' } ), | ||
] ); | ||
|
||
await switchUserToTest(); | ||
} |
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