Skip to content

infralovers/training-atpb-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flask Blogging Application

This is the base for building a blogging application in Flask. It is used in a course by Commandemy.

Setup

pip3 install -r requirements.txt

Run

export FLASK_APP=app.py flask run

Prepare local virtualenv

How to prepare your local environment with virtualenv after cloning the repository

virtualenv .
source ./bin/activate
./bin/pip install -r requirements.txt

How to run behave

The default behave driver is at the moment set to firefox. This can be reset by the environment variable DRIVER. It is coded within features/environment.py.

Firefox

For using Firefox you must install the Firefox Geckodriver from Github and place it in the virtualenv bin directory

version=$(curl -sX GET https://api.github.com/repos/mozilla/geckodriver/releases/latest | grep 'tag_name' | cut -d\" -f4)
wget "https://github.com/mozilla/geckodriver/releases/download/${version}/geckodriver-${version}-macos.tar.gz" -O - | tar xz
mv geckodriver ./bin/

Chrome

To enable the chrome automation you must install the Chromedriver from Google and place it in the virtualenv bin directory.

curl -O "https://chromedriver.storage.googleapis.com/83.0.4103.39/chromedriver_mac64.zip"
unzip chromdriver_mac64.zip
mv chromedriver ./bin/

To switch behave to chrome you just need to set DRIVER variable

DRIVER=chrome ./bin/behave

Headless

Headless testing on your local machine just requires docker installed. You can start the container by following commandline

docker run -d -p 4444:4444 -e START_XVFB=false --shm-size 2g --name chrome-selenium selenium/standalone-chrome

The default configuration of chrome headless will point to the default selenium hub api. But this can also be reset by an environment variable SELENIUM

To run the selenium tests use following command

DRIVER=headless ./bin/behave

TODO

At the moment headless testing is broken for about_page feature. This tests always returns a Connection refused error.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published