script to run selenium tests locally; try on travis too

pull/183/head
Gael Pasgrimaud 5 years ago
parent 0bd5e90292
commit 91629b3c2c
  1. 1
      .gitignore
  2. 8
      .travis.yml
  3. 10
      tests/selenium.sh
  4. 11
      tests/test_real_browser.py
  5. 3
      tox.ini

1
.gitignore vendored

@ -15,6 +15,7 @@ parts/
# Temporary files
*~
geckodriver
# Log files
geckodriver.log

@ -11,7 +11,7 @@ install:
script:
- tox
after_success:
# env:
# - MOZ_HEADLESS=1
# addons:
# firefox: latest
env:
- MOZ_HEADLESS=1
addons:
firefox: latest

@ -0,0 +1,10 @@
#!/bin/bash
# script to run selenium tests
driver="https://github.com/mozilla/geckodriver/releases/download/v0.19.1/geckodriver-v0.19.1-linux64.tar.gz"
# get geckodriver
[ -f geckodriver ] || wget -cqO- $driver | tar xvzf -
# run tox with py3.6
MOZ_HEADLESS=1 PATH=$PATH:$PWD tox -e py36 tests/test_real_browser.py

@ -1,18 +1,23 @@
import os
import unittest
from threading import Thread
from time import sleep
from .browser_base import TextExtractionMixin
SELENIUM = 'MOZ_HEADLESS' in os.environ
try:
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
except ImportError:
SELENIUM = False
if SELENIUM:
from urllib.parse import urlunsplit
from http.server import HTTPServer, BaseHTTPRequestHandler
from queue import Queue
except ImportError:
pass
else:
class BaseTestRequestHandler(BaseHTTPRequestHandler):
_last_html = ''

@ -4,10 +4,13 @@ envlist=py27,py33,py34,py35,py36
[testenv]
whitelist_externals=
rm
passenv=
MOZ_HEADLESS
commands =
rm -f .coverage
{envbindir}/nosetests []
deps =
py36: selenium
requests
WebOb>1.1.9
WebTest

Loading…
Cancel
Save