-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from newfold-labs/update/test-isolation
Update tests for test isolation
- Loading branch information
Showing
3 changed files
with
93 additions
and
47 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,29 @@ | ||
/** | ||
* Loginto WordPress. | ||
*/ | ||
export const wpLogin = () => { | ||
cy.login( Cypress.env( 'wpUsername' ), Cypress.env( 'wpPassword' ) ); | ||
}; | ||
|
||
/** | ||
* wp-cli helper | ||
* | ||
* This wraps the command in the required npx wp-env run cli wp | ||
* | ||
* @param {string} cmd the command to send to wp-cli | ||
* @param {Object} paramArgs any args to pass to exec | ||
*/ | ||
export const wpCli = ( cmd, paramArgs ) => { | ||
const defaultArgs = { | ||
env: { | ||
NODE_TLS_REJECT_UNAUTHORIZED: '1', | ||
}, | ||
failOnNonZeroExit: true, | ||
}; | ||
const args = { ...defaultArgs, ...paramArgs }; | ||
cy.exec( `npx wp-env run cli wp ${ cmd }`, args ).then( ( result ) => { | ||
for ( const [ key, value ] of Object.entries( result ) ) { | ||
cy.log( `${ key }: ${ value }` ); | ||
} | ||
} ); | ||
}; |