DEV Community

loading...

Run automated e2e tests between separate dockers?

jwnelen profile image Jeroen Nelen ・2 min read

Okay so I am a bit lost with the automated testing using Gitlab CI. I hope I can explain my problem so somebody can help me. I'll try to explain the situation first, after which I'll try to ask a question (which is harder than it sounds)

Situation

(1) React frontend with Jest unit tests and Cypress e2e tests
(2) Django API server 1 for a Postgres database and tests using pytest
(3) Django API server 2 with a MongoDB database and tests using pytest

Gitlab

For the 2 API's, there is a Docker and a docker-compose file. These work fine on its own.

We are using GitLab for the CI/CD, there we have the following stages in this order:

  • build: where dockers for 1, 2 & 3 are build separate and pushed to registry
  • Test: Where the unit testing and e2e test (should) run
  • Release: where the docker images are released
  • Deploy: Where the docker images are deployed

Goal

I want to set up the GitLab CI such that it runs the cypress tests. But for this, all build dockers are needed. Currently, I am not able to use all dockers together when performing the end-to-end tests

Problem

I don't really get how I would achieve this.

  • Do I need one Docker-compose file including all dockers and databases?
  • Can I use the dockers that are built in the build stage for my e2e tests and can somebody give me an example of how this would be achieved?

I hope somebody can give me some advice on how to achieve this. An example would be even better but I don't know if somebody would want to do that.

Thanks for taking the time to read!

Discussion (0)

pic
Editor guide