craftcms / nitro

Speedy local dev environment for @craftcms.
https://getnitro.sh
MIT License
178 stars 24 forks source link

Make it easier to use codeception for testing #440

Closed aloco closed 2 years ago

aloco commented 2 years ago

Description

Hi, we are using nitro for a while now and we are in general very happy to have such a local development bundle available from you guys. Currently we haven´t found a nice way to setup codeception api tests. I am not sure if this is a concern of nitro, but when setting up codeception like stated in the docs https://codeception.com/docs/modules/REST it comes to the point where we need to setup the target rest api url. In a testing szenario and from a developers workflow perspective, I don´t want to use my development instance, because I might have a lot of data already inside which I don´t want to reset after each test run. In general the same counts for all kind of tests .. It would be nice to have the option to setup a test instance within nitro - or asked more in general: What is your recommended way to use codeception and nitro with REST tests in mind?

Thanks!

jasonmccallister commented 2 years ago

@aloco can you share an example test, if you are trying to hit an endpoint (e.g. my-site.nitro) make sure you add the port 8080 to the request. This is changing in 3.0 to use port 80, but that might be the problem you are facing in 2.0.

Can you share an example test?

aloco commented 2 years ago

Hi Jason, thank you for your reply, I came to the conclusion that this is primarily a Craft CMS topic, not nitro. I opened the discussion about testing here: https://github.com/craftcms/cms/discussions/10284

Thanks for the hint about nitro 3.0 will keep that in mind.