diff --git a/tests/cypress/.gitignore b/tests/cypress/.gitignore new file mode 100644 index 0000000..5915326 --- /dev/null +++ b/tests/cypress/.gitignore @@ -0,0 +1,2 @@ +logs +videos diff --git a/tests/cypress/support/commands.js b/tests/cypress/support/commands.js index 9a3535b..16849f5 100644 --- a/tests/cypress/support/commands.js +++ b/tests/cypress/support/commands.js @@ -44,3 +44,19 @@ Cypress.Commands.add('clearThenType', { prevSubject: true }, (subject, text, for cy.wrap(subject).clear(); cy.wrap(subject).type(text, { force }); }); + +Cypress.Commands.add('wpCliEval', (command) => { + const fileName = (Math.random() + 1).toString(36).substring(7); + + // this will be written "local" plugin directory + const escapedCommand = command.replace(/^<\?php /, ''); + cy.writeFile(fileName, ` { + cy.exec(`rm ${fileName}`); + cy.wrap(result); + }); +});