bigbite / wp-cypress

WordPress end to end testing with Cypress.io.
MIT License
88 stars 21 forks source link

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

Open danrhjones opened 3 years ago

danrhjones commented 3 years ago

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 
ampersarnie commented 2 years ago

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.

noplanman commented 2 years ago

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

preslavpetkov commented 1 year ago

Is there any update on this issue?

PaulREnglish commented 1 year ago

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.

noplanman commented 1 year ago

@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?