From 66f39678121cd0f9b1490298f50fd58d8edf05b5 Mon Sep 17 00:00:00 2001 From: sighphyre Date: Fri, 25 Mar 2022 13:13:39 +0200 Subject: [PATCH] docs: Add some details on running and debugging the e2e tests (#526) * docs: Add some details on running and debugging the e2e tests * docs: Designate code block in README as bash * refactor: update e2e instructions * refactor: remove e2e timeout warning Co-authored-by: Simon Hornby Co-authored-by: olav --- frontend/README.md | 46 +++++++++++++++++++++++++++++++++---------- frontend/package.json | 5 +++-- 2 files changed, 39 insertions(+), 12 deletions(-) diff --git a/frontend/README.md b/frontend/README.md index 8b85894d87..749c8d8976 100644 --- a/frontend/README.md +++ b/frontend/README.md @@ -1,27 +1,53 @@ # unleash-frontend -## Run with a local instance of the unleash-api: +This repo contains the Unleash Admin UI frontend app. -You need to first start the unleash-api on port 4242 -before you can start working on unleash-frontend. -Start webpack-dev-server with hot-reload: +## Run with a local instance of the unleash-api -```bash +First, start the unleash-api backend on port 4242. +Then, start the unleash-frontend dev server: + +``` cd ~/unleash-frontend yarn install yarn run start ``` -## Run with a heroku-hosted unleash-api: +## Run with a heroku-hosted instance of unleash-api -```bash +Alternatively, instead of running unleash-api on localhost, use a remote instance: + +``` cd ~/unleash-frontend yarn install yarn run start:heroku ``` -## UI Framework +## Running end-to-end Tests -We are using [material-ui](http://material-ui.com/). +We have a set of Cypress tests that run on the build before a PR can be merged so it's important that you check these yourself before submitting a PR. -Happy coding! +On the server the tests will run against the deployed Heroku app so this is what you probably want to test against: + +``` +yarn run start:heroku +``` + +In a different shell, you can run the tests themselves: + +``` +yarn run e2e:heroku +``` + +If you need to test against patches against a local server instance, you'll need to run that, and then run the end to end tests using: + +``` +yarn run e2e +``` + +You may also need to test that a feature works against the enterprise version of unleash. Assuming the Heroku instance is still running, this can be done by: + +``` +yarn run start:enterprise +yarn run e2e +``` diff --git a/frontend/package.json b/frontend/package.json index df8ab635f5..72405b2343 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -28,12 +28,13 @@ "lint": "eslint src", "start": "react-scripts start", "start:heroku": "UNLEASH_API=https://unleash.herokuapp.com yarn run start", - "start:ea": "UNLEASH_API=https://unleash4.herokuapp.com yarn run start", + "start:enterprise": "UNLEASH_API=https://unleash4.herokuapp.com yarn run start", "test": "react-scripts test", "prepare": "yarn run build", "fmt": "prettier src --write --loglevel warn", "fmt:check": "prettier src --check", - "e2e": "yarn run cypress open --config baseUrl='http://localhost:3000' --env AUTH_USER=admin,AUTH_PASSWORD=unleash4all" + "e2e": "yarn run cypress open --config baseUrl='http://localhost:3000' --env AUTH_USER=admin,AUTH_PASSWORD=unleash4all", + "e2e:heroku": "yarn run cypress open --config baseUrl='http://localhost:3000' --env AUTH_USER=example@example.com" }, "devDependencies": { "@material-ui/core": "4.12.3",