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
ee5f0ac0
Commit
ee5f0ac0
authored
May 15, 2013
by
Will Daly
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Workaround for Ubuntu ChromeDriver issue. Now retries
until it acquires a valid session.
parent
9dbcf0ba
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
6 deletions
+34
-6
common/djangoapps/terrain/browser.py
+29
-1
common/djangoapps/terrain/course_helpers.py
+5
-5
No files found.
common/djangoapps/terrain/browser.py
View file @
ee5f0ac0
...
...
@@ -11,6 +11,7 @@ from splinter.browser import Browser
from
logging
import
getLogger
from
django.core.management
import
call_command
from
django.conf
import
settings
from
selenium.common.exceptions
import
WebDriverException
# Let the LMS and CMS do their one-time setup
# For example, setting up mongo caches
...
...
@@ -35,14 +36,41 @@ else:
LOGGER
=
getLogger
(
__name__
)
LOGGER
.
info
(
"Loading the lettuce acceptance testing terrain file..."
)
MAX_VALID_BROWSER_ATTEMPTS
=
20
@before.harvest
def
initial_setup
(
server
):
"""
Launch the browser once before executing the tests.
"""
browser_driver
=
getattr
(
settings
,
'LETTUCE_BROWSER'
,
'chrome'
)
world
.
browser
=
Browser
(
browser_driver
)
# 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.
success
=
False
num_attempts
=
0
while
(
not
success
)
and
num_attempts
<
MAX_VALID_BROWSER_ATTEMPTS
:
# Get a browser session
world
.
browser
=
Browser
(
browser_driver
)
# Try to visit the main page
# If the browser session is invalid, this will
# raise a WebDriverException
try
:
world
.
visit
(
'/'
)
except
WebDriverException
:
num_attempts
+=
1
else
:
success
=
True
# If we were unable to get a valid session within the limit of attempts,
# then we cannot run the tests.
if
not
success
:
raise
IOError
(
"Could not acquire valid ChromeDriver browser session."
)
@before.each_scenario
def
reset_data
(
scenario
):
...
...
common/djangoapps/terrain/course_helpers.py
View file @
ee5f0ac0
...
...
@@ -38,11 +38,11 @@ def create_user(uname):
@world.absorb
def
log_in
(
username
,
password
):
'''
Log the user in programatically
'''
world
.
browser
.
visit
(
django_url
(
'/'
))
"""
Log the user in programatically
.
This will delete any existing cookies to ensure that the user
logs in to the correct session.
"""
# Authenticate the user
user
=
authenticate
(
username
=
username
,
password
=
password
)
...
...
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