feat(GDB-11898) Run cypress test in parallel with Testcontainers#1898
Draft
teodossidossev wants to merge 1 commit intomasterfrom
Draft
feat(GDB-11898) Run cypress test in parallel with Testcontainers#1898teodossidossev wants to merge 1 commit intomasterfrom
teodossidossev wants to merge 1 commit intomasterfrom
Conversation
04356ed to
f5820db
Compare
|
1aa4cce to
169c6fb
Compare
ea23389 to
06451b8
Compare
## WHAT - Added detailed sections on how Docker containers for GraphDB and Workbench are managed dynamically via Testcontainers. - Included instructions on how custom Cypress tasks and hooks are used to start and stop containers, ensuring proper cleanup after tests. - Adjusted the Cypress configuration (`cypress.config.js`) to conditionally set the host and dynamically determine the free port. - Updated the Docker Compose file to set the correct build context and Dockerfile for the `cypress-tests` service - Updated the developers guide to document the E2E testing setup using Cypress and Testcontainers. ## WHY - To enable end-to-end testing with Cypress by dynamically managing dependent Docker containers (GraphDB and Workbench) using Testcontainers. - To ensure that each Cypress instance runs on its own unique free port, thereby avoiding conflicts during parallel test execution. - To allow every test spec to run both locally and within a Docker environment (e.g., on Jenkins) with fresh started containers (GraphDB and Workbench). ## HOW - Revised the `test-cypress/Dockerfile` to use proper relative paths (e.g., `COPY ../docker-rootfs/ /workbench/docker-rootfs/`) when the build context is set to the project root via Docker Compose. - In `test-cypress/support/index.js` and `test-cypress/plugins/index.js`, added detailed comments describing the logic of custom tasks (start/stop of GraphDB and Workbench) and the corresponding hooks (`before` and `after`) that ensure containers are running and are cleaned up after tests. - Adjusted the `cypress.config.js` to use an asynchronous function that imports `get-port`, determines a free port, and sets the `baseUrl` dynamically. It also checks the `IS_DOCKER` environment variable to set the appropriate host (using `172.17.0.1` when running in Docker). - Updated the `docker-compose.yml` to set the build context as the project root (`.`) and to use the correct Dockerfile (`test-cypress/Dockerfile`) for the `cypress-tests` service. Also added the mounting of `/var/run/docker.sock` to allow Testcontainers to interact with the host Docker daemon. - Modified `docs/developers-guide.md` to include a new section that explains the end-to-end testing setup with Cypress and Testcontainers. The guide now details: - How Docker containers for GraphDB and Workbench are started and stopped via custom Cypress tasks. - How dynamic port allocation is implemented with `get-port`. - How the Cypress configuration (`cypress.config.js`) dynamically sets the `baseUrl` based on the runtime environment.
06451b8 to
0c70e1a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



WHAT
cypress.config.js) to conditionally set the host and dynamically determine the free port.cypress-testsserviceWHY
HOW
test-cypress/Dockerfileto use proper relative paths (e.g.,COPY ../docker-rootfs/ /workbench/docker-rootfs/) when the build context is set to the project root via Docker Compose.test-cypress/support/index.jsandtest-cypress/plugins/index.js, added detailed comments describing the logic of custom tasks (start/stop of GraphDB and Workbench) and the corresponding hooks (beforeandafter) that ensure containers are running and are cleaned up after tests.cypress.config.jsto use an asynchronous function that importsget-port, determines a free port, and sets thebaseUrldynamically. It also checks theIS_DOCKERenvironment variable to set the appropriate host (using172.17.0.1when running in Docker).docker-compose.ymlto set the build context as the project root (.) and to use the correct Dockerfile (test-cypress/Dockerfile) for thecypress-testsservice. Also added the mounting of/var/run/docker.sockto allow Testcontainers to interact with the host Docker daemon.docs/developers-guide.mdto include a new section that explains the end-to-end testing setup with Cypress and Testcontainers. The guide now details:get-port.cypress.config.js) dynamically sets thebaseUrlbased on the runtime environment.Checklist