{"id":17290334,"url":"https://github.com/omribarzik/cywp","last_synced_at":"2025-10-26T15:12:20.179Z","repository":{"id":40250112,"uuid":"161618761","full_name":"OmriBarZik/cywp","owner":"OmriBarZik","description":"cypress environment builder for wordpress","archived":false,"fork":false,"pushed_at":"2023-07-18T23:34:52.000Z","size":2559,"stargazers_count":6,"open_issues_count":8,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-12T12:08:14.855Z","etag":null,"topics":["cypress","cywp","e2e","test","wordpress"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OmriBarZik.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-12-13T09:55:41.000Z","updated_at":"2023-10-27T18:43:44.000Z","dependencies_parsed_at":"2024-11-16T01:45:26.061Z","dependency_job_id":"53f698c3-b003-4c3a-9668-d8f352d76a74","html_url":"https://github.com/OmriBarZik/cywp","commit_stats":{"total_commits":608,"total_committers":6,"mean_commits":"101.33333333333333","dds":"0.023026315789473673","last_synced_commit":"f4aa099ca2b57c235724713e601f079a41b555e7"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OmriBarZik%2Fcywp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OmriBarZik%2Fcywp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OmriBarZik%2Fcywp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OmriBarZik%2Fcywp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OmriBarZik","download_url":"https://codeload.github.com/OmriBarZik/cywp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248870061,"owners_count":21174972,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cypress","cywp","e2e","test","wordpress"],"created_at":"2024-10-15T10:37:46.766Z","updated_at":"2025-10-26T15:12:15.143Z","avatar_url":"https://github.com/OmriBarZik.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cypress-for-wordpress [![Test](https://github.com/OmriBarZik/cywp/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/OmriBarZik/cywp/actions/workflows/tests.yml) [![Known Vulnerabilities](https://snyk.io/test/github/OmriBarZik/cywp/badge.svg)](https://snyk.io/test/github/OmriBarZik/cywp)\n\nCypress-for-wordpres helps you create testing environments for your WordPress plugins and themes.\n\nCypress is an end-to-end tool. WordPress is the most popular system for building sites. _cypress-for-WordPress_ (CYWP) is a wrapper that helps build an entire local WordPress environment with docker and run an end-to-end flow. It is helpful for continuous integration processes and builds.\n\n## Requirement\n\n1. You must have cypress 6.7 or above\n2. You must have docker up and running on your system.\n\n## Installation\n\n```bash\nnpm install --save-dev cypress-for-wordpress\n```\n\nAdd this at the `index.js` file in the plugin folder.\n\n```js\nmodule.exports = (on, config) =\u003e {\n  return require('cypress-for-wordpress')(on, config)\n}\n```\n\ncypress-for-wordpress will analyze the plugin configuration and will set the `baseUrl`. for more info [see Cypress configuration documentation](https://docs.cypress.io/guides/references/configuration#Global).\n\n## Usage\n\nyou can control the wordrpess site and the database right from your tests by using [`cy.task()`](https://docs.cypress.io/api/commands/task).\n\n### General Commands\n\nYou can use the general tasks to control the docker containers. please notest that you can only run one command at a time, no process chaining `\u0026`, `\u0026\u0026`, `|`, or `||`).\n\n#### `wordpress`\n\nthe wordpress task connect to the [wordpress contianer](https://hub.docker.com/_/wordpress), execute the given commands and return the stdout and stderr.\n\n##### Example\n\n```js\ncy.task('wordpress', ['ls', '/']).then((output) =\u003e {\n  console.log(output.stdout)\n  console.log(output.stderr)\n})\n```\n\n#### `mysql`\n\nthe mysql task connect to the [mysql contianer](https://hub.docker.com/_/mysql), execute the given commands and return the stdout and stderr.\n\n##### Example\n\n```js\ncy.task('mysql', ['ls', '/']).then((output) =\u003e {\n  console.log(output.stdout)\n  console.log(output.stderr)\n})\n```\n\n#### `wp`\n\nthe wp task create a [wp-cli container](https://hub.docker.com/_/wordpress) that connect to the wordpress container, execute the given commands with the `wp` prefix and return the stdout and stderr.\nwp-cli contianer is a normal wordpress container with the [wp-cli](https://wp-cli.org/) tool available. for more more info about how to use wp cli please see the [WP CLI documentation site](https://developer.wordpress.org/cli/commands/)\n\n##### Example\n\n```js\ncy.task('wp', ['cli', 'info']).then((output) =\u003e {\n  console.log(output.stdout)\n  console.log(output.stderr)\n})\n```\n\n### WP-CLI Tasks\n\nTo make your life easier we have some of the WP-CLI commands as cypress tasks. For the full list of commands please see our [docs](docs)\n\nSome tasks take one parameter and some take multipul parameters, we pass the arguments to the command depended of the namber of parameters.\n\n#### Tasks with one parameter\n\nWhen the tasks have only on parameter like the task [`wp:user:get`](docs/user.md#User+get) we pass it like so\n\n```js\ncy.task('wp:user:get', 1)\n```\n\n#### Tasks with multiple parameters\n\nWhen the task have multiple parameters we pass each parameter in an object with the name of the parameter as the object propety like in [`wp:plugin:install`](docs/plugin.md#Plugin+install)\n\n```js\ncy.task('wp:plugin:install', {\n  plugin: 'elementor',\n  activate: true,\n  version: '2.0.0'\n})\n```\n\neven if you pass the task only one parameter you need to spesify which one\n\n```js\ncy.task('wp:plugin:install', { plugin: 'elementor' })\n```\n\n## Configuration\n\nYou can configure your site by using the following configuration in your `cypress.json` file.\n\n#### Example\n\n```jsonc\n{\n  \"wordpressVersion\": \"latest\", // WordPress version of the site.\n  \"wordpressPort\": \"8000\", // On waht port the site will be expose.\n  \"wordpressTheme\": \"twentytwenty\", // The theme of the site.\n  \"wordpressThemeVersion\": \"latest\", // Version of the theme.\n  \"wordpressThemePath\": \"/path/to/theme\", // Uses localy installed theme.\n  \"wordpressPlugins\": {\n    // List of plugins you want to be installed on the site.\n    \"LocalPlugin\": \"./\", // Relative path to localy installed plugin.\n    \"OtherLocalPlugin\": \"/path/to/plugin/LocalPlugin\", // Absulute Path to localy installed plugin.\n    \"RemotePlugin\": \"1.0.0\", // Version of the plugins the runner will install automatically.\n    \"OtherRemotePlugin\": \"latest\" // Use the latest version available.\n  }\n}\n```\n\n### wordpressVersion\n\n#### Default `latest`\n\nSets the WordPress version on the site.\n\n### wordpressPort\n\n#### Default `8000`\n\nSets on which port the site will be expose.\n\n### wordpressTheme\n\n#### Default `twentytwenty`\n\nSets the theme of the site.\n\n### wordpressThemePath\n\n#### Default `latest`\n\nSets the theme's version.\n\n### wordpressThemePath\n\n#### Default `none`\n\nPath to localy installed theme.\nThis option enebale you to test your own theme on a vertual site.\n\nIf this config is set, the plugin will create a bind between the given path and the docker container. The `wordpressThemePath` config will be ignored.\nThis path must contain a theme with the same name as mentioned at `wordpressTheme`.\n\n### wordpressPlugins\n\n#### Default `none`\n\nObject the that contains two types of plugins.\n\n#### Local Plugins\n\nYou set the local plugins bypassing its path. The plugin's name must be the same as the parameter.\n\nYou can use relative and absolute paths.\n\n```jsonc\n{\n  \"wordpressPlugins\": {\n    \"LocalPath\": \"./\", // To expose current project to the docker contianer.\n    \"otherLocalPath\": \"/path/to/plugin/\" // This path contians otherLocalPath.php\n}\n```\n\n#### Remote Plugins\n\nRemote plugins are plugins that will be downloaded from the WordPress official site, installed, and activated on the site.\n\nYou add remote plugins bypassing the wanted version.\n\n```jsonc\n{\n  \"wordpressPlugins\": {\n    \"remotePlugin\": \"latest\", // Install the latest version available.\n    \"otherRemotePlugin\": \"1.3.5\" // Install a spesific version.\n  }\n}\n```\n\n### Docker Pull Skip\n\nTo skip docker pull just need to set the environment variable `cypress_skip_pull` to 1.\n\n```bash\ncypress_skip_pull=1 npm run test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fomribarzik%2Fcywp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fomribarzik%2Fcywp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fomribarzik%2Fcywp/lists"}