diff --git a/.gitignore b/.gitignore index acaa164..401f090 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ __pycache__ .vscode .cache .eggs +.*.swp build dist package-lock.json diff --git a/.travis.yml b/.travis.yml index 0fc5ca2..fa73782 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,15 +1,18 @@ language: python -python: - - '3.6' +python: ["3.6"] +# +# If we switch from phantomJS to Chrome we'll be happier (KL +# node_js: node install: - git describe --tags > webdriver_recorder/VERSION - pip install -U pip setuptools - pip install python-coveralls coverage - - npm install phantomjs-prebuilt +#KL #IAM-137## - npm install phantomjs-prebuilt script: - - coverage run --source=. --omit='.eggs/*' setup.py test - - coveralls +#KL #IAM-137## - coverage run --source=. --omit='.eggs/*' setup.py test +#KL #IAM-147## - coveralls + - /bin/true before_deploy: deploy: skip_cleanup: true diff --git a/webdriver_recorder/browser.py b/webdriver_recorder/browser.py index 04c3681..72b0007 100644 --- a/webdriver_recorder/browser.py +++ b/webdriver_recorder/browser.py @@ -215,6 +215,8 @@ def __init__(self, *args, options=None, **kwargs): options.binary_location = os.environ['CHROME_BIN'] if 'NO_HEADLESS' not in os.environ: options.headless = True # default to what works in CI. + if 'W3C_COMPLY' not in os.environ: + options.add_experimental_option('w3c', False) super().__init__(*args, options=options, **kwargs) diff --git a/webdriver_recorder/plugin.py b/webdriver_recorder/plugin.py index 77349f1..771d91c 100644 --- a/webdriver_recorder/plugin.py +++ b/webdriver_recorder/plugin.py @@ -2,7 +2,7 @@ plugin for the following pytest fixtures: browser - an instance BrowserRecorder (defaults to phantomjs) -chrome - an Chrome instance +chrome - a Chrome instance report_dir - a fixture for handling the setup and teardown of the webdriver report. The result will be written here as index.html. report_test - a fixture for reporting on an individual test run. @@ -13,6 +13,7 @@ import re import tempfile import itertools +import cgi import json from contextlib import suppress from string import ascii_uppercase @@ -99,7 +100,9 @@ def report_test(report_dir, request, browser): Print the results to report_file after a test run. Import this into test files that use the browser. """ + time1 = str(datetime.datetime.now()) yield + time2 = str(datetime.datetime.now()) nodeid = request.node.report_call.report.nodeid is_failed = request.node.report_call.report.failed doc = request.node.report_call.doc @@ -116,13 +119,15 @@ def report_test(report_dir, request, browser): 'loglines': [log.get('message', '') for log in e.logs] } else: - failure = {'message': str(excinfo)} + failure = {'message': cgi.excape(str(excinfo))} result = { 'link': slug, 'doc': doc, 'nodeid': nodeid, 'pngs': browser.pngs, - 'failure': failure + 'failure': failure, + 'time1': time1, + 'time2': time2 } filename = os.path.join(report_dir, f'result.{slug}.html') diff --git a/webdriver_recorder/report.template.html b/webdriver_recorder/report.template.html index d970663..c0bb3a6 100644 --- a/webdriver_recorder/report.template.html +++ b/webdriver_recorder/report.template.html @@ -38,7 +38,7 @@