From 1a89c4b8b38d923a70492e1cc6a01000fc00cb6f Mon Sep 17 00:00:00 2001 From: Nick Steinhauser Date: Fri, 20 Mar 2020 09:52:55 -0500 Subject: [PATCH 1/2] experience test readme and refactor --- README.md | 2 ++ scripts/README.md | 17 +++++++++++++++++ scripts/{python_flask.py => experience_test.py} | 0 scripts/experience_test.sh | 2 +- 4 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 scripts/README.md rename scripts/{python_flask.py => experience_test.py} (100%) diff --git a/README.md b/README.md index 597257c..d172cb2 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,8 @@ There are two different options for debugging a Flask project: 1. Run `python manage.py runserver` to start a native Flask development server. This comes with the Werkzeug stack-trace debugger, which will present runtime failure stack-traces in-browser with the ability to inspect objects at any point in the trace. For more information, see [Werkzeug documentation](http://werkzeug.pocoo.org/). 2. Run `python manage.py debug` to run a Flask development server with debug exposed, but the native debugger/reloader turned off. This grants access for an IDE to attach itself to the process (i.e. in PyCharm, use `Run` -> `Attach to Local Process`). +You can also verify the state of your locally running application using the Selenium UI test script included in the scripts/ directory. + Note for Windows users: `gunicorn` is not supported on Windows. You may start the server with `python manage.py run` on your local machine or build and start the Dockerfile. #### IBM Cloud Developer Tools diff --git a/scripts/README.md b/scripts/README.md new file mode 100644 index 0000000..68645f7 --- /dev/null +++ b/scripts/README.md @@ -0,0 +1,17 @@ +#### Experience Testing + +This application includes a UI test for the application experience written in Python, using Selenium, that you can extend as you further develop your application. + +To run the experience test, first you need to [install Python](https://www.python.org/downloads/) on your system. + +Then install selenium. +```bash +pip install selenium +``` +[Set up the Chrome WebDriver](https://chromedriver.chromium.org/getting-started) on your system, you will also need to install the [Chrome Browser](https://www.google.com/chrome/) if you do not have it. If you prefer, you can update the experience test experience_test.py to use the [Firefox WebDriver](https://developer.mozilla.org/en-US/docs/Web/WebDriver). Make sure that you have added the driver to your system PATH. + +With the application running locally, export the necessary environment variables, and run the Python web experience test in this directory. +```bash +export APP_URL=https://localhost:3000 # default value for the local application +python3 experience_test.py +``` diff --git a/scripts/python_flask.py b/scripts/experience_test.py similarity index 100% rename from scripts/python_flask.py rename to scripts/experience_test.py diff --git a/scripts/experience_test.sh b/scripts/experience_test.sh index 3ac8254..3e0e056 100755 --- a/scripts/experience_test.sh +++ b/scripts/experience_test.sh @@ -15,4 +15,4 @@ echo "Installing Selenium Python package..." pip install selenium echo "Running UI test using Selenium..." -python3 python_flask.py +python3 experience_test.py From cd2e8384c2a59c0170e07e573f5e7efd05327f6a Mon Sep 17 00:00:00 2001 From: Joseph Meis Date: Fri, 20 Mar 2020 10:34:51 -0500 Subject: [PATCH 2/2] docs(readme): small formatting adjustment --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d172cb2..b4eaebc 100644 --- a/README.md +++ b/README.md @@ -80,9 +80,9 @@ There are two different options for debugging a Flask project: 1. Run `python manage.py runserver` to start a native Flask development server. This comes with the Werkzeug stack-trace debugger, which will present runtime failure stack-traces in-browser with the ability to inspect objects at any point in the trace. For more information, see [Werkzeug documentation](http://werkzeug.pocoo.org/). 2. Run `python manage.py debug` to run a Flask development server with debug exposed, but the native debugger/reloader turned off. This grants access for an IDE to attach itself to the process (i.e. in PyCharm, use `Run` -> `Attach to Local Process`). -You can also verify the state of your locally running application using the Selenium UI test script included in the scripts/ directory. +You can also verify the state of your locally running application using the Selenium UI test script included in the `scripts` directory. -Note for Windows users: `gunicorn` is not supported on Windows. You may start the server with `python manage.py run` on your local machine or build and start the Dockerfile. +> **Note for Windows users:** `gunicorn` is not supported on Windows. You may start the server with `python manage.py run` on your local machine or build and start the Dockerfile. #### IBM Cloud Developer Tools