From 6c5baa2f338caba76e13b546baab22714b8a78d3 Mon Sep 17 00:00:00 2001 From: jannisvisser Date: Mon, 25 Apr 2022 14:45:08 +0200 Subject: [PATCH] feat: improve env setup AB#13492 --- README.md | 6 +----- cypress.env.json.example | 5 +++++ tests/cypress/cypress.json | 4 +--- tests/cypress/support/constants.js | 24 +++++++++++------------- 4 files changed, 18 insertions(+), 21 deletions(-) create mode 100644 cypress.env.json.example diff --git a/README.md b/README.md index 978b65fc61..9c54168f71 100644 --- a/README.md +++ b/README.md @@ -139,11 +139,7 @@ Installation: 0. (Potentially on Ubuntu?: - If it fails, find out why and/or install Cypress in some other way (e.g. `npm install cypress`) -2. Set necessary environment variables, for example by using a CYPRESS\_\* - prefix (see https://docs.cypress.io/guides/guides/environment-variables for - more) - -- e.g. on Windows Powershell: $env:CYPRESS_LOGIN_USER = "" +2. Set necessary environment variables by copying `cypress.env.json.example` to `cypress.env.json` and filling in the variables. 3. Run `npm run cypress:open` diff --git a/cypress.env.json.example b/cypress.env.json.example new file mode 100644 index 0000000000..8c33befee8 --- /dev/null +++ b/cypress.env.json.example @@ -0,0 +1,5 @@ +{ + "LOGIN_USER": "", + "LOGIN_PASSWORD": "", + "API_URL": "" +} diff --git a/tests/cypress/cypress.json b/tests/cypress/cypress.json index 063fb0aed0..db16748fbf 100644 --- a/tests/cypress/cypress.json +++ b/tests/cypress/cypress.json @@ -1,8 +1,6 @@ { "baseUrl": "http://localhost:4200", - "env": { - "apiUrl": "https://ibf-test.510.global/api" - }, + "env": {}, "projectId": "jkaw7k", "fixturesFolder": "tests/cypress/fixtures", "integrationFolder": "tests/cypress/integration", diff --git a/tests/cypress/support/constants.js b/tests/cypress/support/constants.js index de5f673667..f34471164e 100644 --- a/tests/cypress/support/constants.js +++ b/tests/cypress/support/constants.js @@ -1,15 +1,13 @@ export default { - envApiUrl: "apiUrl", - loginPageTitle: "Login", - envLoginUser: "LOGIN_USER", - envLoginPassword: "LOGIN_PASSWORD", - loginToken: "jwt", - userDisplayNameLabelText: "Logged In As:", - loginPagePath: "/login", - loginApiUrl: "/user/login", - dashboardPagePath: "/", - ExposedPopulationText:' Exposed population ', - TotalPopulationText:' Total Population ', - CattleExposedText: ' Cattle exposed ', - SmallRuminantsText: ' Small ruminants exposed ' + loginPageTitle: 'Login', + envApiUrl: 'API_URL', + envLoginUser: 'LOGIN_USER', + envLoginPassword: 'LOGIN_PASSWORD', + loginToken: 'jwt', + userDisplayNameLabelText: 'Logged In As:', + loginPagePath: '/login', + loginApiUrl: '/user/login', + dashboardPagePath: '/', + ExposedPopulationText: 'Exposed population', + TotalPopulationText: 'Total Population', };