In [1]:
# Make a directory called examples
#!mkdir ../examples
%cd ../examples
!ls
In [2]:
#%%writefile functional_tests.py
from selenium import webdriver
browser = webdriver.Firefox()
browser.get('http://localhost:8000')
assert 'Django' in browser.title
In [9]:
# Create a virtual env to load with selenium and django
#!conda create -yn django_class django python=3 # y flag automatically selects yes to install
!source activate django_class # activate virtual environment
!pip install --upgrade selenium # install selenium.
In [3]:
# Try running our tests. We're expecting an assertion error here.
%run functional_tests.py
In [10]:
!ls
In [11]:
# Use django to create a project called 'superlists'
django-admin.py startproject superlists
In [ ]:
!tree ../examples/
In [ ]:
!cd superlists/ && python3 manage.py runserver
In [ ]:
%run functional_tests.py
In [ ]:
# First, move our tests into the main project dir.
#!mv functional_tests.py superlists/
#
# Change directories and initialize our superlist into a new git repo
#%cd superlists/
#!git init .
In [ ]:
%ls
In [ ]:
# Don't add the database to git.
#! echo "db.sqlite3" >> .gitignore # >> means concatenate to end of file.
# Don't add .pyc files
#!echo "*.pyc" >> .gitignore
In [ ]:
# Add everything else.
#!git add .
#!git status
#!git commit -m "Initial commit"