Skip to content
This repository was archived by the owner on Sep 5, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
baea452
Run futurize command on python files.
Jun 14, 2019
9f18f9d
Fix issues from Python 2->3 conversion.
Jun 17, 2019
177d81d
Use python 'six' module for importing reload and urljoin.
abannerjee Mar 24, 2020
b6af7e9
Update CHANGES for django-selenium-testcase version 1.3.2.
abannerjee Jul 11, 2019
1dbea7d
Update manage.py for Django 2.2.
electroniceagle Jun 5, 2020
21cc9c5
Update settings.py using Django 2.2.
electroniceagle Jun 5, 2020
5c91ed5
Update test_project/urls.py for Django 2.2.
electroniceagle Jun 5, 2020
c044033
Update test_project wsgi.py for Django 2.2.
electroniceagle Jun 5, 2020
d9d0939
Update clear_url_caches in testcases/__init__.py.
electroniceagle Jun 5, 2020
101e9d9
Remove from future imports in navigation.py.
electroniceagle Jun 5, 2020
eab8121
Update the expected error message in test_navigation.py.
electroniceagle Jun 5, 2020
dbbab5d
Upgrade requirements.txt with Django<3.0.
electroniceagle Jun 5, 2020
466d6e1
Add .gitlab-ci.yml to repository root.
electroniceagle Jun 5, 2020
daff2d2
Add pipeline and coverage status badges to README.md.
electroniceagle Jun 5, 2020
f868e7e
Add postgres configuration to test_project settings.py
electroniceagle Jun 5, 2020
5edffe9
Rename .gitlab-ci.yaml to .gitlab-ci.yml.
electroniceagle Jun 5, 2020
952d6d3
Add psycopg2 to requirements.txt.
electroniceagle Jun 5, 2020
290802f
Add six to requirements.txt.
electroniceagle Jun 5, 2020
8652441
Update POSTGRES variables in .gitlab-ci.yml.
electroniceagle Jun 5, 2020
4f18655
Add chromium and chromedriver to gitlab-ci.yml before_script.
electroniceagle Jun 5, 2020
54d3142
Add alpine to the image in gitlab-ci.yml.
electroniceagle Jun 5, 2020
2d395df
Move requirements.txt to requirements.in.
electroniceagle Jun 7, 2020
288e429
Add initial hashed requirements.txt.
electroniceagle Jun 7, 2020
b644a19
Update requirements.in with test and docs target requirements.
electroniceagle Jun 7, 2020
1b77641
Replace pep8 with pycodestyle in requirements.txt and requirements.in.
electroniceagle Jun 7, 2020
5325bbd
PEP8 fixes to test_project settings.py and urls.py.
electroniceagle Jun 7, 2020
1db723c
Add selenium to requirements.in and requiements.txt.
electroniceagle Jun 7, 2020
37303cb
Remove postgres database configuration in test_projct settings.py.
electroniceagle Jun 7, 2020
f31b097
Add public to .gitignore.
electroniceagle Jun 7, 2020
3f235ec
Create the selenium html files dirctly in public.
electroniceagle Jun 7, 2020
82fd83b
Initial update to Makefile for docs and testing.
electroniceagle Jun 7, 2020
eef37a5
Initial updates for test job for gitlab-ci.yml.
electroniceagle Jun 7, 2020
37ab2ce
Update __pycache__ delete find to use -delete.
electroniceagle Jun 8, 2020
8655ffa
Add initial docs tree from template.
electroniceagle Jun 8, 2020
a056833
Add _modules to .gitignore.
electroniceagle Jun 8, 2020
46d0715
Add nitpick_ignore to docs/conf.py.
electroniceagle Jun 8, 2020
37c07d2
Disable error on warnings for make docs.
electroniceagle Jun 8, 2020
580f92e
Add django.contrib.staticfiles.testing.StaticLiveServerTestCase to ni…
electroniceagle Jun 8, 2020
5aea1b5
Include _modules/modules.rst in index.rst.
electroniceagle Jun 8, 2020
c69f1f3
Add --user to pip3 install in gitlab-ci.yml.
electroniceagle Jun 8, 2020
3208eaa
Add libpq-devel for postgres support.
electroniceagle Jun 8, 2020
2780269
Add docs building pipelines to gitlab-ci.yml.
electroniceagle Jun 8, 2020
a6f4494
Remove --user from pip3 install virtualenv.
electroniceagle Jun 8, 2020
e62f031
Replace common docs-ci.yml and replace with local definitions in gitl…
electroniceagle Jun 8, 2020
ceecbca
Add postgresql-devel to yum installed dependencies in gitlab-ci.yml.
electroniceagle Jun 8, 2020
7f2843a
Add gcc to yum dependencies.
electroniceagle Jun 8, 2020
8b2ad6b
Add python-devel to dependencies.
electroniceagle Jun 8, 2020
dd75620
Select python3 devel.
electroniceagle Jun 8, 2020
bfa3c95
Update make clean to recursively delete.
electroniceagle Jun 8, 2020
f54bde5
Add venv exclude to PEP8_OPTS and FLAKE8_OPTS.
electroniceagle Jun 8, 2020
6886a9c
Add gitlab-ci folds to make all.
electroniceagle Jun 8, 2020
83577f9
Restore postgres database configuration in test_projct settings.py.
electroniceagle Jun 8, 2020
78b411b
Configure the POSTGRES database varialbles in gitlab-ci.yml.
electroniceagle Jun 8, 2020
966a130
Update DATABASES setting to use environment variable configuration.
electroniceagle Jun 8, 2020
d8070cd
Add postgres service and DATABASE veriables to gitlab-ci.yml.
electroniceagle Jun 9, 2020
c8642ad
Setup before_scripts in travis-ci.yml.
electroniceagle Jun 9, 2020
a16732a
Update Makefile to drop make test and add make tree to all.
electroniceagle Jun 9, 2020
9999da0
Add breadcrumbs.html override and associated html context to conf.py.
electroniceagle Jun 9, 2020
0084c41
Merge branch 'gitlab-initial-port' into 'master'
electroniceagle Jun 9, 2020
af264ef
Add -y flag to pages chrome install in gitlab-ci.yml.
electroniceagle Jun 9, 2020
143d7c4
Add quick links to README.md.
electroniceagle Jun 9, 2020
b77b52a
Merge branch 'pages-fixes' into 'master'
electroniceagle Jun 9, 2020
47f515c
Add artifacts to .gitlab-ci.yml test phase.
electroniceagle Jun 10, 2020
e94b71b
Insert before script into dependency_scanning.
electroniceagle Jun 10, 2020
d7e7972
which it
electroniceagle Jun 10, 2020
28a222a
python3 dev
electroniceagle Jun 10, 2020
4c9984e
libpq-dev
electroniceagle Jun 10, 2020
ec7a1f1
Merge branch 'test-dependency-scanning-fix' into 'master'
electroniceagle Jun 10, 2020
839714c
Drop python 2.7 testing.
electroniceagle Jun 10, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ htmlselenium
*.pyc
dist
*egg-info
public
_modules
112 changes: 112 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# turn on all of the security pipelines
include:
- template: Dependency-Scanning.gitlab-ci.yml
- template: SAST.gitlab-ci.yml
- template: DAST.gitlab-ci.yml
- template: License-Scanning.gitlab-ci.yml

variables:
# Disable Docker-in-Docker so gemnasium scan uses build container
DS_DISABLE_DIND: "true"

dependency_scanning:
before_script:
# Install system dependencies required by `pip install requirements.txt`
- apt-get install -y python3-dev postgresql libpq-dev

test:
stage: test
image: centos:7
services:
- postgres:latest
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
POSTGRES_DB: ci
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_HOST_AUTH_METHOD: trust
DATABASE_URL: "postgresql://postgres:postgres@postgres:5432/ci"
DATABASE_HOST: postgres
DATABASE_NAME: $POSTGRES_DB
DATABASE_USER: $POSTGRES_USER
DATABASE_PASSWORD: $POSTGRES_PASSWORD
cache:
paths:
- .cache/pip
before_script:
# install required base packages
- yum -y install make gcc python3 python3-devel python3-pip git tree wget unzip
postgresql-devel postgresql-server postgresql-contrib
# install chrome
- wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
- yum -y localinstall google-chrome-stable_current_x86_64.rpm
# install latest chromedriver
- export LATEST_RELEASE=$(curl http://chromedriver.storage.googleapis.com/LATEST_RELEASE)
- wget https://chromedriver.storage.googleapis.com/$LATEST_RELEASE/chromedriver_linux64.zip
- mkdir chromedriver
- unzip chromedriver_linux64.zip -d chromedriver
- export PATH=$PATH:$PWD/chromedriver
# configure python 3 virtualenv
- pip3 install virtualenv
- virtualenv venv
- source venv/bin/activate
# install package requirements
- make reqs
script:
- python -V
- export PGPASSWORD=$POSTGRES_PASSWORD
- psql -h "postgres" -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c "SELECT 'OK' AS status;"
- make all
artifacts:
paths:
- public
rules:
- if: $CI_COMMIT_BRANCH != "master"

# deploy documentation to pages
pages:
stage: deploy
image: centos:7
services:
- postgres:latest
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
POSTGRES_DB: ci
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_HOST_AUTH_METHOD: trust
DATABASE_URL: "postgresql://postgres:postgres@postgres:5432/ci"
DATABASE_HOST: postgres
DATABASE_NAME: $POSTGRES_DB
DATABASE_USER: $POSTGRES_USER
DATABASE_PASSWORD: $POSTGRES_PASSWORD
cache:
paths:
- .cache/pip
before_script:
# install required base packages
- yum -y install make gcc python3 python3-devel python3-pip git tree wget unzip
postgresql-devel postgresql-server postgresql-contrib
# install chrome
- wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
- yum -y localinstall google-chrome-stable_current_x86_64.rpm
# install latest chromedriver
- export LATEST_RELEASE=$(curl http://chromedriver.storage.googleapis.com/LATEST_RELEASE)
- wget https://chromedriver.storage.googleapis.com/$LATEST_RELEASE/chromedriver_linux64.zip
- mkdir chromedriver
- unzip chromedriver_linux64.zip -d chromedriver
- export PATH=$PATH:$PWD/chromedriver
# configure python 3 virtualenv
- pip3 install virtualenv
- virtualenv venv
- source venv/bin/activate
# install package requirements
- make reqs
script:
- python -V
- make all
artifacts:
paths:
- public
rules:
- if: $CI_COMMIT_BRANCH == "master"
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
sudo: required
language: python
python:
- "2.7"
addons:
chrome: stable
firefox: latest
Expand Down
4 changes: 4 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
1.3.2 (2020-03-24):

* Update django-selenium-testcase for python3

1.3.1 (2019-07-08):

* Add method hover_over_button to the NavigationTestMixin to
Expand Down
170 changes: 105 additions & 65 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,75 +1,115 @@
.PHONY: check-venv test pep8 clean coverage

# Clean out potentially stale pyc files
# You can set these variables from the command line
# arguments for sphinx-apidoc autodoc builds

SPHINXOPTS ?= -n
SPHINXBUILD ?= sphinx-build
SOURCEDIR ?= docs
BUILDDIR ?= public
APIOPTS ?= -f -e
APIDOCBUILD ?= sphinx-apidoc
APISOURCE ?= selenium_testcase
APIDEST ?= docs/_modules

# Put it first so that "make" without argument is like "make help".
.PHONY: help
help:
@echo "*** Help ***"
@echo " all make clean pep8 flake8 test coverage docs"
@echo " clean remove generaed build files"
@echo " coverage run tests with code coverage being computed"
@echo " reqs update your requirements from requirements.txt"
@echo " reqs-update compile requirements.txt from requirements.in"
@echo " test run tests"
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

# run a complete test suite
.PHONY: all
all:
@echo -e "section_start:`date +%s`:make_clean\r\e[0KMake clean"
make clean
@echo -e "section_end:`date +%s`:make_clean\r\e[0K"
@echo -e "section_start:`date +%s`:make_pycodestyle\r\e[0KMake pycodestyle"
make pycodestyle
@echo -e "section_end:`date +%s`:make_pycodestyle\r\e[0K"
@echo -e "section_start:`date +%s`:make_flake8\r\e[0Kmake flake8"
make flake8
@echo -e "section_end:`date +%s`:make_flake8\r\e[0K"
@echo -e "section_start:`date +%s`:make_coverage\r\e[0Kmake coverage"
make coverage
make tree
@echo -e "section_end:`date +%s`:make_coverage\r\e[0K"
@echo -e "section_start:`date +%s`:make_docs\r\e[0Kmake docs"
make docs
@echo -e "section_end:`date +%s`:make_docs\r\e[0K"

# make all docs
.PHONY: docs
docs:
make linkcheck
make html

# clear the generated files
.PHONY: clean
clean:
find . -name "*.pyc" -exec rm {} \;

# Check that virtualenv is enabled
check-venv:
ifndef VIRTUAL_ENV
$(error VIRTUAL_ENV is undefined, try "workon" command)
endif

# Install pip requirements.txt file
reqs: check-venv
pip install --upgrade -r requirements.txt

PEP8_OPTS=--repeat --exclude=static,migrations,js,doc --show-source

pep8:
pep8 $(PEP8_OPTS) .

FLAKE8_OPTS=--exclude=static,migrations,js,doc
rm -rf $(BUILDDIR)/* $(APIDEST)
find . -name __pycache__ | xargs rm -rf

# install requirements using pip
.PHONY: reqs
reqs:
pip install --require-hashes --upgrade -r requirements.txt

# use pip-compile to lock down requirements
.PHONY: update-reqs reqs-update
update-reqs reqs-update:
pip-compile --no-index --generate-hashes --allow-unsafe

# pep8
.PHONY: pep8 pycodestyle
PEP8_OPTS ?= --repeat --exclude=static,migrations,js,docs,venv --show-source
pep8 pycodestyle:
pycodestyle $(PEP8_OPTS) .

# flake8
.PHONY: flake8
FLAKE8_OPTS ?= --exclude=static,migrations,js,docs,venv
flake8:
flake8 $(FLAKE8_OPTS) .

#
# Unit tests
#
# test
.PHONY: test
TEST_OPTS ?= -v 2
test:
python ./manage.py test $(TEST_OPTS)

test: check-venv clean
python ./manage.py test --keepdb -v 2

travis-tests: check-venv
@echo "travis_fold:start:flake8"
make flake8
@echo "travis_fold:end:flake8"

@echo "travis_fold:start:pip_freeze"
pip freeze -l
@echo "travis_fold:end:pip_freeze"

coverage erase
@echo "travis_fold:start:test"
coverage run $(COVERAGE_ARGS) ./manage.py test --keepdb -v 2
@echo "travis_fold:end:test"

@echo "travis_fold:start:coverage"
coverage report
coverage html
@echo "travis_fold:end:coverage"

#
# Run a django instance with a test project for the current app
#
# tree
.PHONY: tree
tree:
cd public/htmlselenium; tree -h -H . > index.html

# run
.PHONY: run
run: check-venv clean
python ./manage.py runserver
RUN_OPTS ?=
run:
python ./manage.py $(RUN_OPTS) runserver

#
# Code coverage
#
# coverage

COVERAGE_ARGS=--source=selenium_testcase --omit=/tests

coverage: check-venv
COVERAGE_ARGS ?= --source=$(APISOURCE) --omit=/tests
COVERAGE_OPTS ?= --keepdb -v 2
COVERAGE_REPORT_OPTS ?= -m
COVERAGE_HTML_OPTS ?= -d public/coverage
coverage:
coverage erase
coverage run $(COVERAGE_ARGS) ./manage.py test --keepdb -v 2
coverage report
coverage html
@echo "See ./htmlcov/index.html for coverage report"

develop-%: check-venv
cd ../$*; python setup.py develop -N

coverage run $(COVERAGE_ARGS) ./manage.py test $(COVERAGE_OPTS)
coverage report $(COVERAGE_REPORT_OPTS)
coverage html $(COVERAGE_HTML_OPTS)
@echo "See ./public/coverage/index.html for coverage report"

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%:
ifdef APISOURCE
@$(APIDOCBUILD) -o "$(APIDEST)" "$(APISOURCE)" $(APIOPTS)
endif
@$(SPHINXBUILD) -b $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
django-selenium-testcase
========================

[![Build Status](https://travis-ci.org/nimbis/django-selenium-testcase.svg?branch=master)](https://travis-ci.org/nimbis/django-selenium-testcase)
[![pipeline status](https://gitlab.nimbis.io/nimbis/sites/django-selenium-testcase/badges/master/pipeline.svg)](https://gitlab.nimbis.io/nimbis/sites/django-selenium-testcase/-/commits/master)
[![coverage report](https://gitlab.nimbis.io/nimbis/sites/django-selenium-testcase/badges/master/coverage.svg)](https://gitlab.nimbis.io/nimbis/sites/django-selenium-testcase/-/commits/master)

Quick Links
-----------

* [Online Documentation](https://nimbis.pages.nimbis.io/sites/django-selenium-testcase/index.html)
* [Coverage Report](https://nimbis.pages.nimbis.io/sites/django-selenium-testcase/coverage/index.html)
* [Selenium Test](https://nimbis.pages.nimbis.io/sites/django-selenium-testcase/htmlselenium/index.html)

Introduction
------------
This repository implements a simple subclass of Django LiveServerTestCase that
enables selenium testing of the Django live server. Rather than relying on
Gherkin syntax found in Lettuce and Aloe tools, this package favors of python
Expand Down
1 change: 1 addition & 0 deletions docs/README.md
29 changes: 29 additions & 0 deletions docs/_templates/breadcrumbs.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{% extends "!breadcrumbs.html" %}

{% block breadcrumbs_aside %}
{% if selenium_url %}
<li class="wy-breadcrumbs-aside">
<a href="{{ selenium_url }}" class="fa fa-film" title="View Selenium"> </a>
</li>
{% endif %}
{% if coverage_url %}
<li class="wy-breadcrumbs-aside">
<a href="{{ coverage_url }}" class="fa fa-umbrella" title="View Coverage"> </a>
</li>
{% endif %}
{% if pdf_url %}
<li class="wy-breadcrumbs-aside">
<a href="{{ pdf_url }}" class="fa fa-print" title="View PDF"> </a>
</li>
{% endif %}
{% if ide_url %}
<li class="wy-breadcrumbs-aside">
<a href="{{ ide_url }}{{ pagename }}{{ suffix }}" class="fa fa-pencil-square-o" title="Edit on GitLab"></a>
</li>
{% endif %}
{% if gitlab_url %}
<li class="wy-breadcrumbs-aside">
<a href="{{ gitlab_url }}{{ pagename }}{{ suffix }}" class="fa fa-gitlab" title="View Source"> </a>
</li>
{% endif %}
{% endblock %}
Loading