{"id":36993692,"url":"https://github.com/kanopi/cypress-wordpress-support-commands","last_synced_at":"2026-02-21T08:29:46.965Z","repository":{"id":316985967,"uuid":"1065509256","full_name":"kanopi/cypress-wordpress-support-commands","owner":"kanopi","description":"Support commands to get you working with Cypress for WordPress","archived":false,"fork":false,"pushed_at":"2026-02-18T23:56:53.000Z","size":18,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-19T05:19:07.733Z","etag":null,"topics":["cypress","wordpress"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kanopi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-27T21:39:41.000Z","updated_at":"2026-02-18T23:55:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"f236c6fe-0bee-43f4-84f0-d7ebcb1929e1","html_url":"https://github.com/kanopi/cypress-wordpress-support-commands","commit_stats":null,"previous_names":["kanopi/cypress-wordpress-support-commands"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/kanopi/cypress-wordpress-support-commands","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kanopi%2Fcypress-wordpress-support-commands","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kanopi%2Fcypress-wordpress-support-commands/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kanopi%2Fcypress-wordpress-support-commands/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kanopi%2Fcypress-wordpress-support-commands/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kanopi","download_url":"https://codeload.github.com/kanopi/cypress-wordpress-support-commands/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kanopi%2Fcypress-wordpress-support-commands/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29677475,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-21T06:23:40.028Z","status":"ssl_error","status_checked_at":"2026-02-21T06:23:39.222Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","wordpress"],"created_at":"2026-01-13T23:45:53.280Z","updated_at":"2026-02-21T08:29:46.960Z","avatar_url":"https://github.com/kanopi.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cypress Support Commands for WordPress\n\nCommon commands that can be used to create Cypress tests for WordPress\n\n## Installation\n\n### Install/update composer installers.\n\nAdd two entries in composer.json for an install-type and its path:\n\n```\n\"installer-types\": [\"cypress-support\"],\n\"installer-paths\": {\n \"tests/cypress/cypress/support/{$name}\": [\n   \"type:cypress-support\"\n ]\n}\n```\n\nMake sure you also add that installed path to your `.gitignore` file.  I.E. `tests/cypress/cypress/support/cypress-wordpress-support-commands`\n\n### Tell Cypress where to import the tests\n\nIn the `support` folder for where your Cypress tests are located, edit `commands.js` and add the\nfollowing:\n\n```\n// Import commands.js using ES2015 syntax:\nimport './cypress-wordpress-support-commands/commands'\n```\n\nInstall the package using Composer:\n\n```bash\ncomposer require kanopi/cypress-wordpress-support-commands\n```\n\n## Commands\n\n### Authentication Commands\n\n#### login\nLogin to WordPress admin. Uses 'cypress' user with 'cypress' password by default.\n\n```javascript\ncy.login(); // Login as default user\ncy.login('username', 'password'); // Login as specific user\n```\n\n#### logout\nLogout from WordPress by clearing all cookies.\n\n```javascript\ncy.logout();\n```\n\n### Content Creation Commands\n\n#### setTitle\nSets the post/page title in the WordPress editor.\n\n```javascript\ncy.setTitle('Test Title');\n```\n\n#### createComponentHeading\nAdds a heading component and sets text content. Generates random text if no content provided.\n\n```javascript\ncy.createComponentHeading('My Heading Text');\ncy.createComponentHeading(); // Uses random text\n```\n\n#### createComponentParagraph\nAdds a paragraph component and sets text content. Generates random text if no content provided.\n\n```javascript\ncy.createComponentParagraph('My paragraph text');\ncy.createComponentParagraph(); // Uses random text\n```\n\n#### createComponentImage\nAdds an image component and uploads a file. Files should be stored in the 'fixtures' folder.\n\n```javascript\ncy.createComponentImage('image-sample_01.png');\ncy.createComponentImage('image-sample_01.png', true); // Use media library\n```\n\n### Component Management Commands\n\n#### selectComponent\nOpens the component inserter and selects a component by name.\n\n```javascript\ncy.selectComponent('Heading');\ncy.selectComponent('Paragraph');\ncy.selectComponent('Image');\n```\n\n#### editorReset\nClicks the page to deselect components and restore the \"Add Component\" button. Typically used after adding/editing components.\n\n```javascript\ncy.editorReset();\n```\n\n### Publishing Commands\n\n#### publish\nClicks the publish button and publishes the post/page. Compatible with WordPress 6.9+ which uses the REST API for publishing.\n\n```javascript\ncy.publish(); // Publishes and views post\ncy.publish(false); // Publishes without viewing\n```\n\n#### save\nSaves the post/page as published content.\n\n```javascript\ncy.save(); // Saves and views post\ncy.save(false); // Saves without viewing\n```\n\n#### saveDraft\nSaves the post/page as a draft.\n\n```javascript\ncy.saveDraft();\n```\n\n#### update\nUpdates an existing published post/page.\n\n```javascript\ncy.update(); // Updates and views post\ncy.update(false); // Updates without viewing\n```\n\n### Media Library Commands\n\n#### mediaLibraryAdd\nUploads a file directly to the media library. Files should be stored in 'cypress/fixtures/'.\n\n```javascript\ncy.mediaLibraryAdd('sample.png');\n```\n\n#### mediaLibrarySelect\nOpens media library modal and selects an existing media item by filename. Compatible with sites using the [WP Media Folder](https://www.joomunited.com/wordpress-products/wp-media-folder) plugin, which replaces the standard media grid with a folder-based view.\n\n```javascript\ncy.mediaLibrarySelect('#field_media_assets-media-library-wrapper', 'sample.png');\n```\n\n#### mediaLibraryUpload\nUploads a file through the media library modal. Files should be stored in 'cypress/fixtures/'.\n\n```javascript\ncy.mediaLibraryUpload('#selector', 'sample.png');\n```\n\n#### setFeaturedImage\nSets the featured image for a post/page. Files should be stored in 'cypress/fixtures/'.\n\n```javascript\ncy.setFeaturedImage('image-sample_01.png');\n```\n\n### Post Settings Commands\n\n#### setVisibility\nSets the visibility option for a post/page. Options: public, private, password.\n\n```javascript\ncy.setVisibility(); // Defaults to public\ncy.setVisibility('public');\ncy.setVisibility('private');\ncy.setVisibility('password'); // Uses default password 'password'\ncy.setVisibility('password', '123'); // Uses custom password\n```\n\n### Navigation Commands\n\n#### visitEditPage\nVisits a WordPress edit page and waits for common AJAX requests to complete.\n\n```javascript\ncy.visitEditPage('/wp-admin/post-new.php');\ncy.visitEditPage('/wp-admin/post.php?post=123\u0026action=edit');\n```\n\n### Utility Commands\n\n#### wp\nExecutes WP-CLI commands through various environments (Docksal, Lando, DDEV, Pantheon, Tugboat).\n\n```javascript\ncy.wp('cache flush');\ncy.wp('user list');\n```\n\n#### anonUrl404\nTests that a URL returns a 404 response for anonymous users.\n\n```javascript\ncy.anonUrl404('/private-post-url');\n```\n\n#### enterPostPassword\nEnters password for password-protected posts/pages.\n\n```javascript\ncy.enterPostPassword('mypassword');\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkanopi%2Fcypress-wordpress-support-commands","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkanopi%2Fcypress-wordpress-support-commands","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkanopi%2Fcypress-wordpress-support-commands/lists"}