wp-cypress icon indicating copy to clipboard operation
wp-cypress copied to clipboard

Error: 'wp-cypress-set-user' is not a registered wp command.

Open danrhjones opened this issue 4 years ago • 5 comments

Describe the bug Occasionally, when running wp-cypress on CircleCI, we see the failure below.

Usually a rerun of the job fixes it

> wp-cypress start

- Checking for Docker
wp-cypress ✔ Docker found
- Creating test container
wp-cypress ✔ Test container created
- Waiting for database connection
wp-cypress ✔ Database connected
- Installing wp-cypress dependencies
wp-cypress ✔ Dependencies installed
- Creating wp-config.php
wp-cypress ✔ wp-config.php created
- Creating database
wp-cypress ✔ Database created
- Installing WordPress
wp-cypress ✔ WordPress installed
- Activating plugins
wp-cypress ✔ Activated plugins
- Set user to admin
wp-cypress ✖ Error: 'wp-cypress-set-user' is not a registered wp command. See 'wp help' for available commands.

To Reproduce No known way to reproduce

Additional context I managed to get logs off of CircleCI and they have the error as below

[2021-09-09T15:03:49.402Z] Exited with code 0 
[2021-09-09T15:03:52.466Z] stdout: Success: WordPress installed successfully.
 
[2021-09-09T15:03:52.617Z] Exited with code 0 
[2021-09-09T15:03:53.904Z] stderr: Warning: require(/var/www/html/wp-includes/class-wp-theme-json-resolver.php): failed to open stream: No such file or directory in /var/www/html/wp-settings.php on line 174
 
[2021-09-09T15:03:53.905Z] stderr: Fatal error: require(): Failed opening required '/var/www/html/wp-includes/class-wp-theme-json-resolver.php' (include_path='.:/usr/local/lib/php') in /var/www/html/wp-settings.php on line 174
 
[2021-09-09T15:03:53.907Z] stderr: Error: There has been a critical error on this website.Learn more about troubleshooting WordPress. There has been a critical error on this website.
 
[2021-09-09T15:03:54.104Z] Exited with code 255 

danrhjones avatar Sep 07 '21 11:09 danrhjones

I've had this happen to me for the first time, but not found a way to replicate it with certainty, but has allowed me to dig a little into this. I've not got all the answers but I believe this happens if the WP-Cypress plugin cannot activate and/or the process is slow to respond causing the set user command to fail as the plugin is not able to register it. I'm digging further to try and see why this might be happening.

ampersarnie avatar Jan 21 '22 17:01 ampersarnie

As far as I can tell, this happens if the plugin can't build correctly. In my case it was due to PHP8 incompatibility.

Check #92 and my fix in #93

noplanman avatar May 26 '22 00:05 noplanman

Is there any update on this issue?

preslavpetkov avatar Apr 24 '23 14:04 preslavpetkov

Is there any update on this issue?

https://github.com/bigbite/wp-cypress/pull/93 has been merged in which might fix this issue but this issue has never happened for me so can't say for certain.

PaulREnglish avatar Apr 24 '23 15:04 PaulREnglish

@preslavpetkov I assume you're still faced with this issue?

As mentioned in my previous comment, for me it was due to the plugin build failing.

What version of PHP are you using? Also can you check the output logs of the container running the cypress tests?

noplanman avatar Apr 25 '23 01:04 noplanman