diff --git a/build/e2e/Dockerfile b/build/e2e/Dockerfile new file mode 100644 index 00000000000..bcecbd047ca --- /dev/null +++ b/build/e2e/Dockerfile @@ -0,0 +1,12 @@ +ARG GO_VERSION=1.17 + +####################### +## run initialize setup step for ZITADEL tests +####################### +FROM golang:${GO_VERSION} +RUN mkdir -p /cmd/e2e-setup +WORKDIR / + +# copy setup +COPY . . +RUN e2e/e2e-setup-compose.sh diff --git a/e2e/compose.env b/e2e/compose.env new file mode 100644 index 00000000000..72b76dd0f9b --- /dev/null +++ b/e2e/compose.env @@ -0,0 +1,12 @@ +ZITADEL_E2E_CYPRESS_PORT=5000 +ZITADEL_E2E_ORG=e2e-tests +ZITADEL_E2E_ORGOWNERPW=Password1! +ZITADEL_E2E_ORGOWNERVIEWERPW=Password1! +ZITADEL_E2E_ORGPROJECTCREATORPW=Password1! +ZITADEL_E2E_PASSWORDCOMPLEXITYUSERPW=Password1! +ZITADEL_E2E_LOGINPOLICYUSERPW=Password1! +ZITADEL_E2E_MACHINEKEYPATH="${projectRoot}/.keys/e2e.json" +ZITADEL_E2E_BASEURL="http://zitadel:8080" +ZITADEL_E2E_OTHERZITADELIDPINSTANCE=false +ZITADEL_E2E_ZITADELPROJECTRESOURCEID="bignumber-$(echo -n $(${projectRoot}/e2e/docker-compose.sh exec --no-TTY db cockroach sql --database zitadel --insecure --execute "select aggregate_id from eventstore.events where event_type = 'project.added' and event_data = '{\"name\": \"ZITADEL\"}';" --format tsv) | cut -d " " -f 2)" +ZITADEL_E2E_INSTANCEID="$(echo -n $(${projectRoot}/e2e/docker-compose.sh exec --no-TTY db cockroach sql --database zitadel --insecure --execute "select aggregate_id from eventstore.events where event_type = 'instance.added' and event_data = '{\"name\": \"Localhost\"}';" --format tsv) | cut -d " " -f 2)" diff --git a/e2e/docker-compose-overwrite.yaml b/e2e/docker-compose-overwrite.yaml index 7a1380fbb6a..9bbb966a668 100644 --- a/e2e/docker-compose-overwrite.yaml +++ b/e2e/docker-compose-overwrite.yaml @@ -1,3 +1,29 @@ services: zitadel: image: 'zitadel:${BUILD_DATE}' + e2e: + image: cypress/included:10.3.0 + #build: ./e2e + container_name: cypress + depends_on: + - zitadel + # note: inside e2e container, the network allows accessing + # "zitadel" host under name "zitadel" + # so "curl http://web" would return whatever the webserver + # in the "web" container is cooking + # see https://docs.docker.com/compose/networking/ + #environment: + # - CYPRESS_baseUrl=http://web + #command: npx cypress run + # mount the host directory e2e/cypress and the file e2e/cypress.config.js as + # volumes within the container + # this means that: + # 1. anything that Cypress writes to these folders (e.g., screenshots, + # videos) appears also on the Docker host's filesystem + # 2. any change that the developer applies to Cypress files on the host + # machine immediately takes effect within the e2e container (no docker + # rebuild required). + working_dir: /e2e + volumes: + - /Users/christianjakob/caos/internal/zitadel/console:/e2e +# - ./console/cypress.config.js:/e2e/cypress.config.js diff --git a/e2e/e2e-setup-compose.sh b/e2e/e2e-setup-compose.sh new file mode 100755 index 00000000000..63ed3a3ced1 --- /dev/null +++ b/e2e/e2e-setup-compose.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +set -ex + +export projectRoot="." + +set -a +source ./e2e/compose.env +set +a + +go run ./cmd/e2e-setup/*.go "$@"