Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
c71ea3ec
Commit
c71ea3ec
authored
Aug 29, 2013
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Record test result in Sauce
parent
ad2f811f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
3 deletions
+36
-3
trans/tests/test_selenium.py
trans/tests/test_selenium.py
+36
-3
No files found.
trans/tests/test_selenium.py
View file @
c71ea3ec
...
@@ -4,6 +4,9 @@ from selenium import webdriver
...
@@ -4,6 +4,9 @@ from selenium import webdriver
from
django.core.urlresolvers
import
reverse
from
django.core.urlresolvers
import
reverse
import
os
import
os
import
new
import
new
import
json
import
httplib
import
base64
# Check whether we should run Selenium tests
# Check whether we should run Selenium tests
DO_SELENIUM
=
(
DO_SELENIUM
=
(
...
@@ -20,6 +23,33 @@ class SeleniumTests(LiveServerTestCase):
...
@@ -20,6 +23,33 @@ class SeleniumTests(LiveServerTestCase):
'platform'
:
'LINUX'
,
'platform'
:
'LINUX'
,
}
}
def
set_test_status
(
self
,
passed
=
True
):
body_content
=
json
.
dumps
({
"passed"
:
passed
})
connection
=
httplib
.
HTTPConnection
(
"saucelabs.com"
)
connection
.
request
(
'PUT'
,
'/rest/v1/%s/jobs/%s'
%
(
self
.
username
,
self
.
driver
.
session_id
),
body_content
,
headers
=
{
"Authorization"
:
"Basic %s"
%
self
.
sauce_auth
}
)
result
=
connection
.
getresponse
()
return
result
.
status
==
200
def
run
(
self
,
result
=
None
):
print
'RUN'
if
result
is
None
:
result
=
self
.
defaultTestResult
()
errors
=
result
.
errors
failures
=
result
.
failures
super
(
SeleniumTests
,
self
).
run
(
result
)
self
.
set_test_status
(
(
errors
==
result
.
errors
and
failures
==
result
.
failures
)
)
@
classmethod
@
classmethod
def
setUpClass
(
cls
):
def
setUpClass
(
cls
):
if
DO_SELENIUM
:
if
DO_SELENIUM
:
...
@@ -35,9 +65,12 @@ class SeleniumTests(LiveServerTestCase):
...
@@ -35,9 +65,12 @@ class SeleniumTests(LiveServerTestCase):
]
]
# Use Sauce connect
# Use Sauce connect
username
=
os
.
environ
[
'SAUCE_USERNAME'
]
cls
.
username
=
os
.
environ
[
'SAUCE_USERNAME'
]
key
=
os
.
environ
[
'SAUCE_ACCESS_KEY'
]
cls
.
key
=
os
.
environ
[
'SAUCE_ACCESS_KEY'
]
hub_url
=
"%s:%s@localhost:4445"
%
(
username
,
key
)
cls
.
sauce_auth
=
base64
.
encodestring
(
'%s:%s'
%
(
cls
.
username
,
cls
.
key
)
)[:
-
1
]
hub_url
=
"%s:%s@localhost:4445"
%
(
cls
.
username
,
cls
.
key
)
cls
.
driver
=
webdriver
.
Remote
(
cls
.
driver
=
webdriver
.
Remote
(
desired_capabilities
=
cls
.
caps
,
desired_capabilities
=
cls
.
caps
,
command_executor
=
"http://%s/wd/hub"
%
hub_url
command_executor
=
"http://%s/wd/hub"
%
hub_url
...
...
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