From 4b204af92422e61fde425c61ecd543e49414512d Mon Sep 17 00:00:00 2001 From: Peter Makowski Date: Tue, 14 Dec 2021 13:21:11 +0100 Subject: [PATCH] enable local cypress configuration (#3417) * setup local cypress configuration - remove fixed baseUrl from npm scripts - move the default baseUrl to cypress.json * add info about overwriting cypress.json values --- integration/.gitignore | 1 + integration/README.md | 13 +++++++++++++ integration/cypress.json | 2 +- integration/package.json | 4 ++-- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/integration/.gitignore b/integration/.gitignore index 16bbfa6da0..8ea08355cc 100644 --- a/integration/.gitignore +++ b/integration/.gitignore @@ -19,6 +19,7 @@ yarn.lock # cypress cypress/screenshots cypress/videos +cypress.env.json # misc *.swp diff --git a/integration/README.md b/integration/README.md index 99c9e9d55a..9414406afb 100644 --- a/integration/README.md +++ b/integration/README.md @@ -14,6 +14,19 @@ yarn test-cypress This will automatically start legacy, ui and proxy servers and run the Cypress tests, in which results are logged to the console. After running the tests, the servers and process will close. +## Edit local configuration + +By default, cypress will run tests using the configuration defined in [cypress.json](/integration/cypress.json). + +If you wish to overwrite any of the settings (e.g. MAAS URL or username/password) you can create a local configuration file: + +```shell +cd integration +touch cypress.env.json +``` + +Values from `cypress.env.json` will overwrite conflicting variables in the main `cypress.json` configuration file. + ## Developing cypress tests ### On your host machine diff --git a/integration/cypress.json b/integration/cypress.json index f2e246a067..54a255b8d1 100644 --- a/integration/cypress.json +++ b/integration/cypress.json @@ -1,5 +1,5 @@ { - "baseUrl": "http://localhost:8400", + "baseUrl": "http://0.0.0.0:8400", "env": { "username": "admin", "password": "test" diff --git a/integration/package.json b/integration/package.json index 0e519c1472..6f82eb7a8b 100644 --- a/integration/package.json +++ b/integration/package.json @@ -10,8 +10,8 @@ "cypress-test": "yarn --cwd ../shared build && start-server-and-test serve-frontends '8401|8402' serve-base 'tcp:8400|8404' cypress-run", "serve-frontends": "yarn --cwd ../proxy serve-frontends", "serve-base": "yarn --cwd ../proxy serve-base", - "cypress-run": "yarn cypress run -c baseUrl=http://0.0.0.0:8400", - "cypress-open": "yarn cypress open -c baseUrl=http://0.0.0.0:8400" + "cypress-run": "yarn cypress run", + "cypress-open": "yarn cypress open" }, "devDependencies": { "@maas-ui/maas-ui-shared": "3.2.0",