Closed theskinnyghost closed 11 months ago
@peterwilsoncc I tried to run the cypress tests locally but wasn't able to so I'm not sure if I need to make any additional setup configuration to run them properly. Here's the error that I get when I run npm run cypress:run
Also, is this the test I would need to update? https://github.com/10up/distributor/blob/36d1c76/tests/cypress/e2e/external-connection.test.js#L99
Hey @peterwilsoncc, thanks for your feedback.
I made an update to show an error for the use case you mentioned above (when distributor is not installed).
I also updated the check_post_types_permissions()
logic as per your suggestion but I'm not sure I did it right so I left a comment for you to check.
RE: Cypress Tests β I only ran npm run cypress:run
and that's the error I got. Do I need to run additional commands? I use Local Flywheel not Docker.
RE: Cypress Tests β I only ran
npm run cypress:run
and that's the error I got. Do I need to run additional commands? I use Local Flywheel not Docker.
The E2E tests use @wordpress/env
which requires Docker. You may be able to change the URL returned by this function to use local but I've never had much luck doing that as a vagrant user.
I can take a look at the changes required.
@peterwilsoncc thanks again for your feedback. I implemented the changes you suggested but wasn't totally sure we could remove the else if
from line 367 as that would completely remove warnings. Is that what you'd like to achieve here?
re: tests - I was able to run the tests this time by running npm env:start
before runningnpm run cypress:run
. However, a lot of tests are failing (even when I use the develop
or trunk
branch). I wonder if I'm missing anything here?
wasn't totally sure we could remove the
else if
from line 367 as that would completely remove warnings. Is that what you'd like to achieve here?
Yes, that's what I was after. The two conditions response.data.errors.no_distributor || ! response.data.can_post.length
are both included in the first block now and throw errors instead of warnings.
A downside to switching to the dedicated Distributor endpoint is that it's basically all-or-nothing for connections at the moment. They'll either error or succeed, we're no longer able to have the partial connections that used to trigger warnings.
As the block-editor becomes more important, the partial connections of old become less effective as the block editor requires access to the raw content.
re: tests - I was able to run the tests this time by running
npm env:start
before runningnpm run cypress:run
. However, a lot of tests are failing (even when I use thedevelop
ortrunk
branch). I wonder if I'm missing anything here?
I'll test from scratch locally and reach out via the 10up Slack. It's possible the docs need to be updated.
Thanks @peterwilsoncc, I've updated the code and removed the warnings since they aren't applicable anymore. I also updated the tests and removed the test for warnings.
I also think we should add an additional test to make sure the Distributor not installed on remote site.
error appears when that's the case but I'm not sure how to set this up with the current setup and also wanted to double check with you if that's needed.
I was able to run the tests just fine following the instructions you provided on 10up's Slack, thanks! π
For others, these are the steps currently required to get the commands required to get e2e tests running locally.
Please ensure Docker is running before running these commands.
npm run env:destroy // Just to get back to scratch
npm run env:start
npm run copy-htaccess
npm run cypress:run
Description of the Change
Closes #1071
How to test the Change
Authentication failed due to insufficient or invalid credentials.
message insteadChangelog Entry
Credits
Props @theskinnyghost
Checklist: