Skip to content

Latest commit

 

History

History
142 lines (107 loc) · 3.05 KB

GETTINGSTARTED.adoc

File metadata and controls

142 lines (107 loc) · 3.05 KB

Add environmental variables

Set basic host settings

The generic host and user settings are in the cypress.env.json file.

Note

The main configuration file is the cypress.env.json, but do try to separate the host settings and main configuration settings for cypress.

{
  "HOST": "http://localhost:3000",
  "BASE_URL": "http://localhost:3000",
  "ADMIN_URL": "http://localhost:8080",
  "COMPOSE_URL": "http://localhost:8081",
  "WORKFLOW_URL": "http://localhost:8082",
  "REPORTER_URL": "http://localhost:8083",
  "ONE_URL": "http://localhost:8084",
  "PRIVACY_URL": "http://localhost:8085",
  "USER_EMAIL": "[email protected]",
  "USER_PASSWORD": "cypress123",
  "USER_PASSWORD_NEW": "newcypress123",
  "USER_EMAIL_NEW": "[email protected]",
  "USER_DPO": "[email protected]",
  "USER_DPO_USER_PASSWORD": "[email protected]",
  "PROVISION_DB_DSN": "postgres://corteza:corteza@localhost:5432/corteza_cy_test?sslmode=disable",
  "AUTH_CLIENT_ID": "374948212714242049",
  "AUTH_CLIENT_SECRET": "hPK7hiO15mI3qwboi7oTOrhc1ntn68mRRpmgLkbV6seXLLRjZtieUHdJECvEEN8Y"
}

Running the tests

$ yarn cypress open

or

$ yarn run cy:open

Running specific cypress tests using CLI

$ yarn cypress run --spec <path-to-spec-file>
Example:
$ cypress run --spec cypress/e2e/basic-functionalities/local-tests/server/Create_user.cy.js

SMTP support

The SMTP testing is done via mailhog.

Running the mailhog in background
$ docker-compose up -d mailhog
Note

The mailhog container is ephemeral, so all the emails will NOT be persisted in the container (you will lose emails when the mailhog is stopped).

You can preview all the emails manually by visiting http://localhost:8025

Table 1. SMTP server settings
Setting Value

Server

localhost

Port

1025

User

<empty>

Password

<empty>

Running the tests dockerized

Set versions

Create an .env file and specify the Corteza and Cypress versions. The host configuration should be specified either via cypress.env.json or by environment variables in the docker-compose.yaml configuration.

Note

Refer to the .env.example file for an idea.

Pull Images

$ docker-compose pull

Run headless

$ docker-compose run --entrypoint='cypress run --spec cypress/e2e/basic-functionalities/local-tests/server/index.cy.js cypress' cypress

Run Cypress with screen

$ docker-compose -f docker-compose.yaml -f docker-compose.screen.yaml up --exit-code-from cypress

Custom commands

This project also adds several custom commands in cypress/support/. They are useful to create one or more default todos from the tests.

Cypress.Commands.add('login', (params) => {
  // custom login function
})

Troubleshooting

Use in case of a CSRF token issue

{ "AUTH_CSRF_ENABLED": false }