Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
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
Roque
slapos
Commits
908dab9c
Commit
908dab9c
authored
Aug 27, 2022
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
software/seleniumserver: port to python3
parent
25003da4
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
27 deletions
+25
-27
software/seleniumserver/buildout.hash.cfg
software/seleniumserver/buildout.hash.cfg
+1
-1
software/seleniumserver/instance-selenium.cfg.in
software/seleniumserver/instance-selenium.cfg.in
+2
-2
software/seleniumserver/software.cfg
software/seleniumserver/software.cfg
+0
-3
software/seleniumserver/test/test.py
software/seleniumserver/test/test.py
+21
-20
software/slapos-sr-testing/software-py3.cfg
software/slapos-sr-testing/software-py3.cfg
+1
-0
software/slapos-sr-testing/software.cfg
software/slapos-sr-testing/software.cfg
+0
-1
No files found.
software/seleniumserver/buildout.hash.cfg
View file @
908dab9c
...
...
@@ -19,4 +19,4 @@ md5sum = 9b41238f67ea8e12f8ea9590fd552b33
[template-selenium]
filename = instance-selenium.cfg.in
md5sum =
3e50d629307ca9f1381909102a52756d
md5sum =
9b4742e8a249aef38c7c8c12d74b0605
software/seleniumserver/instance-selenium.cfg.in
View file @
908dab9c
...
...
@@ -316,10 +316,10 @@ recipe = slapos.recipe.template
output = $${directory:bin}/$${:_buildout_section_name_}
inline =
#!${buildout:executable}
import json, urllib, sys
import json, urllib
.request
, sys
api_url = sys.argv[1]
expected_node_count = int(sys.argv[2])
actual_node_count = json.load(urllib.urlopen(api_url))['slotCounts']['total']
actual_node_count = json.load(urllib.
request.
urlopen(api_url))['slotCounts']['total']
sys.exit(0 if expected_node_count == actual_node_count else 1)
...
...
software/seleniumserver/software.cfg
View file @
908dab9c
...
...
@@ -23,9 +23,6 @@ parts =
collective.recipe.shelloutput
template
[python]
part = python2.7
[collective.recipe.shelloutput]
recipe = zc.recipe.egg
...
...
software/seleniumserver/test/test.py
View file @
908dab9c
...
...
@@ -31,12 +31,12 @@ import multiprocessing
import
os
import
tempfile
import
unittest
import
urlparse
import
url
lib.
parse
import
base64
import
hashlib
import
logging
import
contextlib
from
BaseHTTPS
erver
import
BaseHTTPRequestHandler
from
http.s
erver
import
BaseHTTPRequestHandler
from
io
import
BytesIO
...
...
@@ -72,7 +72,7 @@ class WebServer(ManagedHTTPServer):
self
.
send_response
(
200
)
self
.
end_headers
()
self
.
wfile
.
write
(
'''
b
'''
<html>
<title>Test page</title>
<body>
...
...
@@ -97,15 +97,15 @@ class WebServer(ManagedHTTPServer):
self
.
send_response
(
200
)
self
.
end_headers
()
file_data
=
'no file'
if
form
.
has_key
(
'f'
)
:
file_data
=
form
[
'f'
].
file
.
read
()
if
'f'
in
form
:
file_data
=
form
[
'f'
].
file
.
read
()
.
decode
()
self
.
wfile
.
write
(
'''
(
'''
<html>
<title>%s</title>
<div>%s</div>
</html>
'''
%
(
form
[
'q'
].
value
,
file_data
))
'''
%
(
form
[
'q'
].
value
,
file_data
))
.
encode
())
log_message
=
logging
.
getLogger
(
__name__
+
'.WebServer'
).
info
...
...
@@ -148,7 +148,7 @@ class BrowserCompatibilityMixin(WebServerMixin):
WebDriverWait
(
self
.
driver
,
3
).
until
(
EC
.
title_is
(
self
.
id
()))
def
test_upload_file
(
self
):
f
=
tempfile
.
NamedTemporaryFile
(
delete
=
False
)
f
=
tempfile
.
NamedTemporaryFile
(
delete
=
False
,
mode
=
'w'
)
f
.
write
(
self
.
id
())
f
.
close
()
self
.
addCleanup
(
lambda
:
os
.
remove
(
f
.
name
))
...
...
@@ -307,7 +307,7 @@ class TestFrontend(WebServerMixin, SeleniumServerTestCase):
parameter_dict
=
self
.
computer_partition
.
getConnectionParameterDict
()
admin_url
=
parameter_dict
[
'admin-url'
]
parsed
=
urlparse
.
urlparse
(
admin_url
)
parsed
=
url
lib
.
parse
.
urlparse
(
admin_url
)
self
.
assertEqual
(
'admin'
,
parsed
.
username
)
self
.
assertTrue
(
parsed
.
password
)
...
...
@@ -316,7 +316,7 @@ class TestFrontend(WebServerMixin, SeleniumServerTestCase):
def
test_browser_use_hub
(
self
):
parameter_dict
=
self
.
computer_partition
.
getConnectionParameterDict
()
webdriver_url
=
parameter_dict
[
'url'
]
parsed
=
urlparse
.
urlparse
(
webdriver_url
)
parsed
=
url
lib
.
parse
.
urlparse
(
webdriver_url
)
self
.
assertEqual
(
'selenium'
,
parsed
.
username
)
self
.
assertTrue
(
parsed
.
password
)
...
...
@@ -343,7 +343,7 @@ class TestSSHServer(SeleniumServerTestCase):
def
test_connect
(
self
):
parameter_dict
=
self
.
computer_partition
.
getConnectionParameterDict
()
ssh_url
=
parameter_dict
[
'ssh-url'
]
parsed
=
urlparse
.
urlparse
(
ssh_url
)
parsed
=
url
lib
.
parse
.
urlparse
(
ssh_url
)
self
.
assertEqual
(
'ssh'
,
parsed
.
scheme
)
client
=
paramiko
.
SSHClient
()
...
...
@@ -359,9 +359,9 @@ class TestSSHServer(SeleniumServerTestCase):
with
contextlib
.
closing
(
client
):
client
.
connect
(
username
=
urlparse
.
urlparse
(
ssh_url
).
username
,
hostname
=
urlparse
.
urlparse
(
ssh_url
).
hostname
,
port
=
urlparse
.
urlparse
(
ssh_url
).
port
,
username
=
url
lib
.
parse
.
urlparse
(
ssh_url
).
username
,
hostname
=
url
lib
.
parse
.
urlparse
(
ssh_url
).
hostname
,
port
=
url
lib
.
parse
.
urlparse
(
ssh_url
).
port
,
pkey
=
self
.
ssh_key
,
)
...
...
@@ -378,7 +378,7 @@ class TestSSHServer(SeleniumServerTestCase):
# Paramiko does not allow to get the fingerprint as SHA256 easily yet
# https://github.com/paramiko/paramiko/pull/1103
self
.
assertEqual
(
fingerprint
,
fingerprint
.
encode
()
,
# XXX with sha256, we need to remove that trailing =
base64
.
b64encode
(
hashlib
.
new
(
fingerprint_algorithm
,
...
...
@@ -386,15 +386,15 @@ class TestSSHServer(SeleniumServerTestCase):
channel
=
client
.
invoke_shell
()
channel
.
settimeout
(
30
)
received
=
''
received
=
b
''
while
True
:
r
=
channel
.
recv
(
1024
)
if
not
r
:
break
received
+=
r
if
'Selenium Server.'
in
received
:
if
b
'Selenium Server.'
in
received
:
break
self
.
assertIn
(
"Welcome to SlapOS Selenium Server."
,
received
)
self
.
assertIn
(
b
"Welcome to SlapOS Selenium Server."
,
received
)
class
TestFirefox52
(
...
...
@@ -405,8 +405,9 @@ class TestFirefox52(
desired_capabilities
=
dict
(
DesiredCapabilities
.
FIREFOX
,
version
=
'52.9.0esr'
)
user_agent
=
'Gecko/20100101 Firefox/52.0'
# resizing window is not supported on firefox 52 geckodriver
test_resize_window
=
unittest
.
expectedFailure
(
BrowserCompatibilityMixin
.
test_resize_window
)
@
unittest
.
expectedFailure
def
test_resize_window
(
self
):
super
().
test_resize_window
()
class
TestFirefox60
(
...
...
software/slapos-sr-testing/software-py3.cfg
View file @
908dab9c
...
...
@@ -30,4 +30,5 @@ extra =
proftpd ${slapos.test.proftpd-setup:setup}
repman ${slapos.test.repman-setup:setup}
restic-rest-server ${slapos.test.restic_rest_server-setup:setup}
seleniumserver ${slapos.test.seleniumserver-setup:setup}
theia ${slapos.test.theia-setup:setup}
software/slapos-sr-testing/software.cfg
View file @
908dab9c
...
...
@@ -380,7 +380,6 @@ extra =
jscrawler ${slapos.test.jscrawler-setup:setup}
jstestnode ${slapos.test.jstestnode-setup:setup}
re6stnet ${slapos.test.re6stnet-setup:setup}
seleniumserver ${slapos.test.seleniumserver-setup:setup}
slapos-master ${slapos.test.slapos-master-setup:setup}
slaprunner ${slapos.test.slaprunner-setup:setup}
turnserver ${slapos.test.turnserver-setup:setup}
...
...
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