{"id":18055821,"url":"https://github.com/tschortsch/cypress-wp-test-utils","last_synced_at":"2025-08-15T18:39:18.779Z","repository":{"id":40405120,"uuid":"255144476","full_name":"tschortsch/cypress-wp-test-utils","owner":"tschortsch","description":"Cypress E2E test utils for WordPress","archived":false,"fork":false,"pushed_at":"2023-03-16T13:54:05.000Z","size":985,"stargazers_count":4,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-09T04:20:38.764Z","etag":null,"topics":["commands","cypress","e2e","gutenberg","testing","utils","wordpress"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/tschortsch.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2020-04-12T18:24:46.000Z","updated_at":"2022-03-12T20:11:01.000Z","dependencies_parsed_at":"2024-10-31T01:12:06.147Z","dependency_job_id":"f68c216a-5ad0-4ffd-932c-524baa1cfcf5","html_url":"https://github.com/tschortsch/cypress-wp-test-utils","commit_stats":{"total_commits":144,"total_committers":1,"mean_commits":144.0,"dds":0.0,"last_synced_commit":"7f63b56cca9eb8f404dca52608e326d94e7078fe"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/tschortsch/cypress-wp-test-utils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tschortsch%2Fcypress-wp-test-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tschortsch%2Fcypress-wp-test-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tschortsch%2Fcypress-wp-test-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tschortsch%2Fcypress-wp-test-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tschortsch","download_url":"https://codeload.github.com/tschortsch/cypress-wp-test-utils/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tschortsch%2Fcypress-wp-test-utils/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269693443,"owners_count":24460237,"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","status":"online","status_checked_at":"2025-08-10T02:00:08.965Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["commands","cypress","e2e","gutenberg","testing","utils","wordpress"],"created_at":"2024-10-31T01:12:02.499Z","updated_at":"2025-08-15T18:39:18.745Z","avatar_url":"https://github.com/tschortsch.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cypress test utilities for WordPress\n\n[![Build Status](https://github.com/tschortsch/cypress-wp-test-utils/workflows/lint-test-deploy/badge.svg?branch=master)](https://github.com/tschortsch/cypress-wp-test-utils/actions?query=workflow%3A%22lint-test-deploy%22+branch%3Amaster)\n\nCollection of [cypress](https://www.cypress.io/) commands to test your WordPress page. \nInspired by the [`@wordpress/e2e-test-utils` package](https://www.npmjs.com/package/@wordpress/e2e-test-utils) which does the same for Puppeteer.\n\n## Installation\n\n1. Install npm dependency\n\n   ```shell\n   # NPM\n   npm install cypress-wp-test-utils --save-dev\n    \n   # Yarn\n   yarn add cypress-wp-test-utils --dev\n   ```\n\n1. Register commands in your cypress project (normally in `cypress/support/index.js`)\n\n   ```javascript\n   import { registerWpTestCommands } from 'cypress-wp-test-utils';\n\n   registerWpTestCommands();\n   ```\n\n1. Use the commands in your tests!\n\n## Configuration\n\nThere are several options to configure the commands. These options can be defined in your cypress configuration file (normally `cypress.json`):\n\n```json\n{\n  \"env\": {\n    \"cypress-wp-test-utils\": {\n      \"username\": \"myuser\",\n      \"password\": \"supersecurepassword\"\n    }\n  }\n}\n```\n\n* `username` (`string`): Username which is used as the default username in the `loginUser` command. (Default: `admin`)\n* `password` (`string`): Password which is used as the default password in the `loginUser` command. (Default: `password`)\n\n## List of available commands\n\n### activatePlugin\n\nActivates a plugin.\n\n#### Parameters\n\n* `slug` (`string`) Slug of the plugin which should be activated.\n\n### clickBlockToolbarButton\n\nClicks a button in the toolbar of the currently selected block.\n\n#### Parameters\n\n* `label` (`string`) The text string of the button label.\n* `index?` (`number`) The index of the button if multiple buttons were found with the given label. (Default: `0`)\n\n### clickButton\n\nClicks a button.\n\n#### Parameters\n\n* `label` (`string`) The text string of the button label.\n* `buttonLabelType?` (`'ariaLabel' | 'content'`) The type of button label: 'ariaLabel' or 'content'. (Default: `'content'`)\n\n### clickElementByText\n\nClicks an element by a given text.\n\n#### Parameters\n\n* `elementType` (`string`) The element type (eg. `'button'`, `'input'`).\n* `text` (`string`) The text of the element.\n* `strict?` (`boolean`) If set to true the given text has to match exactly the text of the element (Default: `false`).\n* `index?` (`number`) The index of the element if multiple elements were found with the given label. (Default: `0`)\n\n### closeWelcomeGuide\n\nCloses the welcome guide if displayed.\n\n### createNewPost\n\nCreates new post.\n\n#### Parameters\n\n* `object` (`object`) Object to create new post, along with tips enabling option.\n* `object.postType?` (`string`) Post type of the new post.\n* `object.title?` (`string`) Title of the new post.\n* `object.content?` (`string`) Content of the new post.\n* `object.excerpt?` (`string`) Excerpt of the new post.\n* `object.showWelcomeGuide?` (`boolean`) Whether to show the welcome guide or not. (Default: `false`)\n\n### deactivatePlugin\n\nDeactivates a plugin.\n\n#### Parameters\n\n* `slug` (`string`) Slug of the plugin which should be deactivated.\n\n### ensureSidebarOpened\n\nEnsures that the sidebar is opened (opens sidebar if closed).\n\n### getCheckboxByLabel\n\nGets a checkbox element by label.\n\n#### Parameters\n\n* `label` (`string`) Label of checkbox element.\n\n### getCurrentPostContent\n\nReturns current post content as object.\nsee: [https://developer.wordpress.org/block-editor/reference-guides/data/data-core-editor/#getCurrentPost](https://developer.wordpress.org/block-editor/reference-guides/data/data-core-editor/#getCurrentPost)\n\n### getEditedPostContent\n\nReturns the content of the post being edited as string.\n* see: [https://developer.wordpress.org/block-editor/reference-guides/data/data-core-editor/#getEditedPostContent](https://developer.wordpress.org/block-editor/reference-guides/data/data-core-editor/#getEditedPostContent)\n\n### getInputByLabel\n\nGets a input element by label.\n\n#### Parameters\n\n* `label` (`string`) Label of input element.\n\n### getSelectByLabel\n\nGets a select element by label.\n\n#### Parameters\n\n* `label` (`string`) Label of select element.\n\n### getTextControlByLabel\n\nGets a TextControl element by label.\n\n#### Parameters\n\n* `label` (`string`) Label of TextControl element.\n\n### getToggleByLabel\n\nGets a toggle element by label.\n\n#### Parameters\n\n* `label` (`string`) Label of toggle element.\n\n### insertBlock\n\nOpens the inserter, searches for the given term, then selects the first result that appears.\n\n#### Parameters\n\n* `searchTerm` (`string`) The text to search the inserter for.\n* `blockLabel?` (`string`) The label of the block to insert.\n\n### loginUser\n\nPerforms a login with specified username and password.\n\n#### Parameters\n\n* `username?` (`string`) Username which should be used. (Default: `admin`)\n* `password?` (`string`) Password which should be used. (Default: `password`)\n\n### openGlobalBlockInserter\n\nOpens the global block inserter.\n\n### openSidebarPanelWithTitle\n\nOpens sidebar panel with given title (if closed).\n\n#### Parameters\n\n* `title` (`string`) Title of sidebar panel to open.\n\n### searchForBlock\n\nSearch for block in the global inserter.\n\n#### Parameters\n\n* `searchTerm` (`string`) The text to search the inserter for.\n\n### selectBlockByName\n\nSelects a block by its name.\n\n#### Parameters\n\n* `name` (`string`) Name of the block to select. (eg. `'core/paragraph'`)\n* `index?` (`number`) The index of the block if multiple blocks were found with the given name.\n\n### selectOptionIsAvailable\n\nChecks if a certain option in a select box is available.\n\n#### Parameters\n\n* `selectLabel` (`string`) Label of the select box.\n* `optionValue` (`string`) The value of the option to search for.\n\n### setPostContent\n\nSets the editor content.\n\n#### Parameters\n\n* `content` (`string`) New editor content.\n\n### setTextControlValueByLabel\n\nSets the value of a TextControl element by its label.\n\n#### Parameters\n\n* `label` (`string`) Label of the TextControl element.\n* `value` (`string`) Value to set.\n\n### toolbarOptionIsActive\n\nChecks if a toolbar option is active.\n\n#### Parameters\n\n* `toolbarLabel` (`string`) Label of the toolbar option to check.\n* `buttonText` (`string`) Text of the button to check if it's active.\n* `toolbarIndex?` (`number`) The index of the toolbar option if multiple options were found with the given label.\n* `buttonIndex?` (`number`) The index of the button if multiple buttons were found with the given text.\n\n### visitAdminPage\n\nVisits a given admin page.\n\n#### Parameters\n\n* `adminPath` (`string`) Path to admin page.\n* `query?` (`string`) Query string which should be added to URL.\n\n## Compatibility\n\n* WordPress 5.7, 5.8, 5.9, 6.0, 6.1\n* Node \u003e=12\n* Cypress \u003e=5.x\n\nRight now those commands are only compatible with WordPress 5.7, 5.8, 5.9, 6.0 and 6.1.\nThe goal is to support further WordPress versions but since there are always a lot of changes in the editor between WordPress versions it's difficult to support all of them.\n\n## @cypress/xpath included\n\nThis package uses and includes the [@cypress/xpath](https://www.npmjs.com/package/@cypress/xpath) command.\nIf you're using it as well in your tests you don't need to include it again.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftschortsch%2Fcypress-wp-test-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftschortsch%2Fcypress-wp-test-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftschortsch%2Fcypress-wp-test-utils/lists"}