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
35e5f4ca
Commit
35e5f4ca
authored
Aug 15, 2013
by
JonahStanley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved global things in browser.py to functions
parent
0b6e6298
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
29 deletions
+28
-29
cms/envs/acceptance.py
+1
-1
common/djangoapps/terrain/browser.py
+26
-27
lms/envs/acceptance.py
+1
-1
No files found.
cms/envs/acceptance.py
View file @
35e5f4ca
...
@@ -97,7 +97,7 @@ MITX_FEATURES['AUTOMATIC_AUTH_FOR_TESTING'] = True
...
@@ -97,7 +97,7 @@ MITX_FEATURES['AUTOMATIC_AUTH_FOR_TESTING'] = True
USE_I18N
=
True
USE_I18N
=
True
# Information needed to utilize Sauce Labs.
# Information needed to utilize Sauce Labs.
MITX_FEATURES
[
'SAUCE'
]
=
{
SAUCE
=
{
'SAUCE_ENABLED'
:
os
.
environ
.
get
(
'SAUCE_ENABLED'
),
'SAUCE_ENABLED'
:
os
.
environ
.
get
(
'SAUCE_ENABLED'
),
'USERNAME'
:
os
.
environ
.
get
(
'SAUCE_USER_NAME'
),
'USERNAME'
:
os
.
environ
.
get
(
'SAUCE_USER_NAME'
),
'ACCESS_ID'
:
os
.
environ
.
get
(
'SAUCE_API_KEY'
),
'ACCESS_ID'
:
os
.
environ
.
get
(
'SAUCE_API_KEY'
),
...
...
common/djangoapps/terrain/browser.py
View file @
35e5f4ca
...
@@ -51,41 +51,40 @@ except ImportError:
...
@@ -51,41 +51,40 @@ except ImportError:
import
simplejson
as
json
import
simplejson
as
json
SAUCE
=
settings
.
MITX_FEATURES
.
get
(
'SAUCE'
,
{})
config
=
{
"username"
:
SAUCE
.
get
(
'USERNAME'
),
"access-key"
:
SAUCE
.
get
(
'ACCESS_ID'
)}
world
.
absorb
(
SAUCE
.
get
(
'SAUCE_ENABLED'
),
'SAUCE_ENABLED'
)
desired_capabilities
=
SAUCE
.
get
(
'BROWSER'
,
DesiredCapabilities
.
CHROME
)
desired_capabilities
[
'platform'
]
=
SAUCE
.
get
(
'PLATFORM'
)
desired_capabilities
[
'version'
]
=
SAUCE
.
get
(
'VERSION'
)
desired_capabilities
[
'device-type'
]
=
SAUCE
.
get
(
'DEVICE'
)
desired_capabilities
[
'name'
]
=
SAUCE
.
get
(
'SESSION'
)
desired_capabilities
[
'build'
]
=
SAUCE
.
get
(
'BUILD'
)
desired_capabilities
[
'video-upload-on-pass'
]
=
False
desired_capabilities
[
'sauce-advisor'
]
=
False
desired_capabilities
[
'record-screenshots'
]
=
False
desired_capabilities
[
'selenium-version'
]
=
"2.34.0"
desired_capabilities
[
'max-duration'
]
=
3600
desired_capabilities
[
'public'
]
=
'public restricted'
jobid
=
''
base64string
=
base64
.
encodestring
(
'{}:{}'
.
format
(
config
[
'username'
],
config
[
'access-key'
]))[:
-
1
]
def
set_job_status
(
jobid
,
passed
=
True
):
def
set_job_status
(
jobid
,
passed
=
True
):
body_content
=
json
.
dumps
({
"passed"
:
passed
})
body_content
=
json
.
dumps
({
"passed"
:
passed
})
result
=
requests
.
put
(
'http://saucelabs.com/rest/v1/{}/jobs/{}'
.
format
(
config
[
'username'
],
jobid
),
config
=
get_username_and_key
()
base64string
=
base64
.
encodestring
(
'{}:{}'
.
format
(
config
[
'username'
],
config
[
'access-key'
]))[:
-
1
]
result
=
requests
.
put
(
'http://saucelabs.com/rest/v1/{}/jobs/{}'
.
format
(
config
[
'username'
],
world
.
jobid
),
data
=
body_content
,
data
=
body_content
,
headers
=
{
"Authorization"
:
"Basic {}"
.
format
(
base64string
)})
headers
=
{
"Authorization"
:
"Basic {}"
.
format
(
base64string
)})
return
result
.
status_code
==
200
return
result
.
status_code
==
200
def
make_desired_capabilities
():
desired_capabilities
=
settings
.
SAUCE
.
get
(
'BROWSER'
,
DesiredCapabilities
.
CHROME
)
desired_capabilities
[
'platform'
]
=
settings
.
SAUCE
.
get
(
'PLATFORM'
)
desired_capabilities
[
'version'
]
=
settings
.
SAUCE
.
get
(
'VERSION'
)
desired_capabilities
[
'device-type'
]
=
settings
.
SAUCE
.
get
(
'DEVICE'
)
desired_capabilities
[
'name'
]
=
settings
.
SAUCE
.
get
(
'SESSION'
)
desired_capabilities
[
'build'
]
=
settings
.
SAUCE
.
get
(
'BUILD'
)
desired_capabilities
[
'video-upload-on-pass'
]
=
False
desired_capabilities
[
'sauce-advisor'
]
=
False
desired_capabilities
[
'record-screenshots'
]
=
False
desired_capabilities
[
'selenium-version'
]
=
"2.34.0"
desired_capabilities
[
'max-duration'
]
=
3600
desired_capabilities
[
'public'
]
=
'public restricted'
return
desired_capabilities
def
get_username_and_key
():
return
{
"username"
:
settings
.
SAUCE
.
get
(
'USERNAME'
),
"access-key"
:
settings
.
SAUCE
.
get
(
'ACCESS_ID'
)}
@before.harvest
@before.harvest
def
initial_setup
(
server
):
def
initial_setup
(
server
):
"""
"""
Launch the browser once before executing the tests.
Launch the browser once before executing the tests.
"""
"""
world
.
absorb
(
settings
.
SAUCE
.
get
(
'SAUCE_ENABLED'
),
'SAUCE_ENABLED'
)
browser_driver
=
getattr
(
settings
,
'LETTUCE_BROWSER'
,
'chrome'
)
browser_driver
=
getattr
(
settings
,
'LETTUCE_BROWSER'
,
'chrome'
)
# There is an issue with ChromeDriver2 r195627 on Ubuntu
# There is an issue with ChromeDriver2 r195627 on Ubuntu
...
@@ -97,13 +96,13 @@ def initial_setup(server):
...
@@ -97,13 +96,13 @@ def initial_setup(server):
# Get a browser session
# Get a browser session
if
world
.
SAUCE_ENABLED
:
if
world
.
SAUCE_ENABLED
:
config
=
get_username_and_key
()
world
.
browser
=
Browser
(
world
.
browser
=
Browser
(
'remote'
,
'remote'
,
url
=
"http://{}:{}@ondemand.saucelabs.com:80/wd/hub"
.
format
(
config
[
'username'
],
config
[
'access-key'
]),
url
=
"http://{}:{}@ondemand.saucelabs.com:80/wd/hub"
.
format
(
config
[
'username'
],
config
[
'access-key'
]),
**
desired_capabilities
**
make_desired_capabilities
()
)
)
global
jobid
world
.
absorb
(
world
.
browser
.
driver
.
session_id
,
'jobid'
)
jobid
=
world
.
browser
.
driver
.
session_id
else
:
else
:
world
.
browser
=
Browser
(
browser_driver
)
world
.
browser
=
Browser
(
browser_driver
)
...
@@ -180,5 +179,5 @@ def teardown_browser(total):
...
@@ -180,5 +179,5 @@ def teardown_browser(total):
Quit the browser after executing the tests.
Quit the browser after executing the tests.
"""
"""
if
world
.
SAUCE_ENABLED
:
if
world
.
SAUCE_ENABLED
:
set_job_status
(
jobid
,
total
.
scenarios_ran
==
total
.
scenarios_passed
)
set_job_status
(
world
.
jobid
,
total
.
scenarios_ran
==
total
.
scenarios_passed
)
world
.
browser
.
quit
()
world
.
browser
.
quit
()
lms/envs/acceptance.py
View file @
35e5f4ca
...
@@ -105,7 +105,7 @@ MITX_FEATURES['AUTOMATIC_AUTH_FOR_TESTING'] = True
...
@@ -105,7 +105,7 @@ MITX_FEATURES['AUTOMATIC_AUTH_FOR_TESTING'] = True
USE_I18N
=
True
USE_I18N
=
True
# Information needed to utilize Sauce Labs.
# Information needed to utilize Sauce Labs.
MITX_FEATURES
[
'SAUCE'
]
=
{
SAUCE
=
{
'SAUCE_ENABLED'
:
os
.
environ
.
get
(
'SAUCE_ENABLED'
),
'SAUCE_ENABLED'
:
os
.
environ
.
get
(
'SAUCE_ENABLED'
),
'USERNAME'
:
os
.
environ
.
get
(
'SAUCE_USER_NAME'
),
'USERNAME'
:
os
.
environ
.
get
(
'SAUCE_USER_NAME'
),
'ACCESS_ID'
:
os
.
environ
.
get
(
'SAUCE_API_KEY'
),
'ACCESS_ID'
:
os
.
environ
.
get
(
'SAUCE_API_KEY'
),
...
...
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