Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
ab78c758
Commit
ab78c758
authored
Aug 12, 2014
by
Jesse Zoldak
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4638 from edx/zoldak/lettuce-log-js-console
Capture console log on lettuce test failure
parents
41425a46
f59dd647
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
2 deletions
+28
-2
common/djangoapps/terrain/browser.py
+28
-2
No files found.
common/djangoapps/terrain/browser.py
View file @
ab78c758
...
...
@@ -17,7 +17,6 @@ from base64 import encodestring
from
json
import
dumps
import
xmodule.modulestore.django
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.contentstore.django
import
_CONTENTSTORE
# There is an import issue when using django-staticfiles with lettuce
...
...
@@ -94,6 +93,14 @@ def initial_setup(server):
if
world
.
LETTUCE_SELENIUM_CLIENT
==
'local'
:
browser_driver
=
getattr
(
settings
,
'LETTUCE_BROWSER'
,
'chrome'
)
if
browser_driver
==
'chrome'
:
desired_capabilities
=
DesiredCapabilities
.
CHROME
desired_capabilities
[
'loggingPrefs'
]
=
{
'browser'
:
'ALL'
}
elif
browser_driver
==
'firefox'
:
desired_capabilities
=
DesiredCapabilities
.
FIREFOX
else
:
desired_capabilities
=
{}
# There is an issue with ChromeDriver2 r195627 on Ubuntu
# in which we sometimes get an invalid browser session.
# This is a work-around to ensure that we get a valid session.
...
...
@@ -106,7 +113,7 @@ def initial_setup(server):
# the browser session is invalid, this will
# raise a WebDriverException
try
:
world
.
browser
=
Browser
(
browser_driver
)
world
.
browser
=
Browser
(
browser_driver
,
desired_capabilities
=
desired_capabilities
)
world
.
browser
.
driver
.
set_script_timeout
(
GLOBAL_SCRIPT_TIMEOUT
)
world
.
visit
(
'/'
)
...
...
@@ -221,6 +228,25 @@ def screenshot_on_error(scenario):
LOGGER
.
error
(
'Could not capture a screenshot'
)
@after.each_scenario
def
capture_console_log
(
scenario
):
"""
Save the console log to help with debugging.
"""
if
scenario
.
failed
:
log
=
world
.
browser
.
driver
.
get_log
(
'browser'
)
try
:
output_dir
=
'{}/log'
.
format
(
settings
.
TEST_ROOT
)
file_name
=
'{}/{}.log'
.
format
(
output_dir
,
scenario
.
name
.
replace
(
' '
,
'_'
))
with
open
(
file_name
,
'w'
)
as
output_file
:
for
line
in
log
:
output_file
.
write
(
"{}{}"
.
format
(
dumps
(
line
),
'
\n
'
))
except
WebDriverException
:
LOGGER
.
error
(
'Could not capture the console log'
)
def
capture_screenshot_for_step
(
step
,
when
):
"""
Useful method for debugging acceptance tests that are run in Vagrant.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment