Behavior driven E3E tests for BlenderKit web written in Python 3.9 and Cucumber. Using Behave and Selenium modules with support for Podman/Docker. Currently supporting Chrome and headless Chrome browsers. You can run the tests locally on your machine or in a container.
- Create virtual environment and install dependencies.
# Create and activate virtual environment
python -m venv venv
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
- Make sure you have Chrome browser installed.
Copy and rename file env-example.sh
to env.sh
and make it executable:
cp env-example.sh env.sh
chmod 755 env.sh
Fill in email address and password for testing account in the file env.sh
.
env.sh
file will then look like this:
export BK_USERNAME="set username of test account here"
export BK_PASSWORD="set password of test account here"
export PP_USERNAME="set paypal sandbox username of test account here"
export PP_PASSWORD="set paypal sandbox password of test account here"
source venv/bin/activate
If you have different usernames/passwords on staging or production server, you can overwrite default variables by setting up variables ending _STAGE or _PROD, for example:
export BK_USERNAME_PROD="production username overwrites BK_USERNAME for production tests" export BK_USERNAME_STAGE="stage username overwrites BK_USERNAME for stage tests"
# Source env.sh - this exports username/password and activates virtual environment
source env.sh
# Run the tests
behave
Test progress and results are printed to the terminal.
Screenshot is taken after each test step.
These screenshots are available in directory screenshots
.
buildah build --tag bk-tests
./container.sh
Test progress is printed to the console.
Screenshots are copied to the local directory screenshots-container
once all the tests are finished.
TBD
Outputs of print()
functions are normally deleted by Behave.
To overcome this problem run in plain format without capture:
behave --no-capture --format plain