#Can you provide a bit more details about

1 messages · Page 1 of 1 (latest)

vagrant dagger
round umbraBOT
#

Hi @vagrant dagger. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

vagrant dagger
#

I need to test the entire application, therefore E2E test would be more suitable, although I want to test specific API routes too.

For example, I have a route, that is accessible only for authorized users. It returns a populated data from MongoDB with few calculations (to calculate average rating). I need to test:

  • If the route returns 401 when not logged in
  • If the route returns 500 if the provided ID either doesn't exist or is not valid or the find function returns an empty object
  • If it returns correct data (these can be inserted into the database before the test runs)
round umbraBOT
#

Sorry @vagrant dagger, I seem to be having a bit of trouble. Don't worry though, I've pinged my supprt and they will try to fix me up! :technologist:

Perhaps try again in 15mins?

vagrant dagger
#

@native cove From my point of view, it would be best to test each API route. If an API route requires the user to be logged in, there will be a fetch request to obtain CSRF token and then a also a session cookie (I can insert the user to the database before tests begin)

#

However, I'm not sure how would you run these tests during a CI/CD pipeline

#

Right now the CI/CD pipeline consists of:

  • Copy repository to host
  • Docker builds Next
  • Docker creates image
  • Docker runs Next
#

I have two separate pipelines, one for dev branch (staging) and main branch (prod)

#

The project consists of max. 6 developers, however the Next application has about 50 API routes